Commit Graph

50 Commits

Author SHA1 Message Date
John-David Dalton
e7295c3377 Use lodash v4. 2016-01-31 17:11:59 -08:00
Dan Abramov
47d00243be Object returned from bindActionCreators() should only include functions 2016-01-30 21:29:38 +00:00
Dan Abramov
b1bcee2746 Don't depend on console object
Fixes #1311
2016-01-29 17:16:31 +00:00
Andrew Shaffer
c221a5f03c reorganize test folder 2016-01-10 16:03:16 -08:00
Lee Bannard
913afe4e8b Update combineReducers input shape test 2015-12-13 10:20:17 +00:00
Brent Van Minnen
306094df6b handle compose with no functions 2015-11-18 21:11:49 -08:00
Brent Van Minnen
8e19d06f53 composition can be seeded with multiple arguments 2015-11-17 19:00:43 -08:00
Christian Fei
eb9d4f048d fixed typo 2015-11-01 15:59:59 +01:00
Christian Fei
902a9114ca unified test names to use descriptive syntax, not should 2015-11-01 15:56:14 +01:00
Lee Bannard
5b7f63842f Fix lint errors in test/ 2015-10-26 21:27:39 +00:00
Aaron Jensen
6b8a4a87d7 Have combineReducers return same object if nothing changes
Fixes #853
2015-10-07 09:24:25 -07:00
Lee Bannard
6fd9b05158 Catch and rethrow error from reducer init in combineReducers 2015-09-26 08:34:50 +01:00
Lee Bannard
c2bf13c2c2 move combine reducers sanity check 2015-09-22 12:30:45 +01:00
Lee Bannard
6fff5e3883 always call verifyStateShape for combined reducers 2015-09-13 23:31:02 +01:00
Tim Dorr
333fb45635 Switch out contextify for vm 2015-09-10 10:58:24 -04:00
Dan Abramov
5b9a8b09e9 Fix compose() to have a less surprising API 2015-09-01 03:13:44 +03:00
Dan Abramov
d99b3612a8 Don't depend on invariant and warning 2015-08-15 12:40:07 +03:00
Jack Callister
22ca4beb9a Add invariant errors for bindActionCreator. 2015-08-06 14:53:12 +01:00
Dan Abramov
a467c4174e Merge branch 'verify-state-shape' into breaking-changes-1.0 2015-07-31 13:06:45 +03:00
Lee Bannard
fca60c8f5c add verifyStateShape function and tests 2015-07-30 11:46:48 +01:00
Michael Contento
d92f08e804 Allow bindActionCreators to be used with function as actionCreator
With this change you can use `bindActionCreators` to either bind a
object of actionCreator functions to dispatch or only a single
actionCreator directly.

    import { bindActionCreators } from 'redux';
    import { addTodo } from './actions/todoActions';

    const boundAddTodo = bindActionCreators(addTodo, dispatch);
    boundAddTodo('Hello');
2015-07-29 14:02:19 +02:00
Michal Kvasničák
0c87ead729 add contextify to simulate another realm (context) and test case where plain object from another realm is checked 2015-07-23 16:50:33 +02:00
Dan Abramov
27752e6033 Style fixup 2015-07-22 19:56:12 +03:00
Dan Abramov
8bb94c74d0 Merge pull request #295 from jhewlett/breaking-changes-1.0
Allow es6 symbols to be used as action types
2015-07-22 19:55:24 +03:00
Dan Abramov
100ce3cd05 composeMiddleware is an implementation detail of applyMiddleware 2015-07-22 19:28:54 +03:00
Justin Hewlett
adbfbdde0a Fix lint errors 2015-07-21 23:40:23 -06:00
Justin Hewlett
7ad209a22d Allow es6 symbols to be used as action types
- Symbols are a good way to ensure uniqueness of your action types
- In Chrome and Firefox, a symbol inside of a template literal throws an
  error. Making the string conversion explicit gets rid of the error
2015-07-21 23:13:51 -06:00
Dan Abramov
ac8a1841fb Fix the missing Flow annotations 2015-07-19 22:07:25 +03:00
Dan Abramov
0623cf4dff Replace class with a factory function 2015-07-19 19:33:14 +03:00
Terry Appleby
baede742c6 update wrap dispatch test with the failure case. 2015-07-13 23:07:28 -04:00
Dan Abramov
9045a0c173 Handling private actions is an anti-pattern. Enforce it. (Fixes #186) 2015-07-13 19:11:43 +03:00
Dan Abramov
afd42605a9 Move test files 2015-07-13 17:29:58 +03:00
Dan Abramov
18aceeee36 Remove nesting from tests 2015-07-12 21:06:36 +03:00
Dan Abramov
c46494b024 Remove React-specific code in favor of gaearon/redux-react 2015-07-11 23:36:11 +03:00
Dan Abramov
e426039152 Breaking API changes for 1.0
Naming:

* “Stateless Stores” are now called reducers. (https://github.com/gaearon/redux/issues/137#issuecomment-114178411)
* The “Redux instance” is now called “The Store”. (https://github.com/gaearon/redux/issues/137#issuecomment-113252359)
* The dispatcher is removed completely. (https://github.com/gaearon/redux/pull/166#issue-90113962)

API changes:

* <s>`composeStores`</s> is now `composeReducers`.
* <s>`createDispatcher`</s> is gone.
* <s>`createRedux`</s> is now `createStore`.
* `<Provider>` now accepts `store` prop instead of <s>`redux`</s>.
* The new `createStore` signature is `createStore(reducer: Function | Object, initialState: any, middlewares: Array | ({ getState, dispatch }) => Array)`.
* If the first argument to `createStore` is an object, `composeReducers` is automatically applied to it.
* The “smart” middleware signature changed. It now accepts an object instead of a single `getState` function. The `dispatch` function lets you “recurse” the middleware chain and is useful for async: https://github.com/gaearon/redux/issues/113#issuecomment-112603386.

Correctness changes:

* The `dispatch` provided by the default thunk middleware now walks the whole middleware chain.
* It is enforced now that raw Actions at the end of the middleware chain have to be plain objects.
* Nested dispatches are now handled gracefully. (https://github.com/gaearon/redux/pull/110)

Internal changes:

* The object in React context is renamed from <s>`redux`</s> to `store`.
* Some tests are rewritten for clarity, focus and edge cases.
* Redux in examples is now aliased to the source code for easier work on master.
2015-06-30 23:52:31 +02:00
Dan Abramov
d052f5502f Fix the lint error 2015-06-19 01:00:09 +03:00
Franky Chung
974b7b8ddf Check null/undefined case for isPlainObject 2015-06-18 16:14:53 +09:00
Franky Chung
d76b2166cc Improve identity util test to check reference
Just returning the argument so can check by reference instead of deep
equal
2015-06-18 10:04:47 +09:00
Franky Chung
3aef46935f Add replacement utils for lodash modules + tests 2015-06-18 09:20:25 +09:00
Franky Chung
a6efb92ca5 Test key is passed into iteratee for mapValues
utils/composeStores uses the key second argument for the iteratee so
updated the test to make sure it isn't missing.
2015-06-18 00:05:59 +09:00
Franky Chung
1d968d0e80 mapValues util and unit test 2015-06-17 23:56:48 +09:00
Ramana Venkata
c5d9cd7005 Test shallowEquality 2015-06-16 19:04:31 +05:30
Andrew Clark
2f196ae67f Remove duplicate bindActionCreators test 2015-06-13 09:45:24 -07:00
Nicola Molinari
8fb90bb0bd Merge branch 'master' into tests-refactoring
Conflicts:
	test/createDispatcher.spec.js
	test/exports.spec.js
	test/utils/bindActionCreators.spec.js
2015-06-10 22:53:20 +02:00
Andrew Clark
eb54fc3433 setImmediate is sufficient for testing async 2015-06-10 13:46:54 -07:00
Nicola Molinari
2fdbca0d8c Test only public API and use better test data 2015-06-10 22:16:29 +02:00
Nicola Molinari
e2bb3aae89 Migrate tests. Use expect instead of chai 2015-06-09 23:19:23 +02:00
Nicola Molinari
e940fa44ca Add (pending) placeholders for other tests 2015-06-07 14:16:28 +02:00
Nicola Molinari
20462fe985 Add test for getDisplayName 2015-06-07 14:15:39 +02:00
Nicola Molinari
619e071426 Simple test for bindActions 2015-06-07 14:04:41 +02:00