| Conditions | 1 |
| Paths | 1 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | 'use strict'; |
||
| 18 | test( 'ValidationDispatcherCollection update method calls dispatchers', function ( t ) { |
||
| 19 | var formContent = { amount: 42 }, |
||
| 20 | state = { donationForm: formContent }, |
||
| 21 | storeSpy = { |
||
| 22 | subscribe: sinon.spy(), |
||
| 23 | getState: sinon.stub().returns( state ) |
||
| 24 | }, |
||
| 25 | validatorSpy = { dispatchIfChanged: sinon.spy() }, |
||
| 26 | collection = createValidationDispatcherCollection( storeSpy, [ validatorSpy ], 'donationForm' ); |
||
| 27 | |||
| 28 | collection.onUpdate(); |
||
| 29 | |||
| 30 | t.ok( storeSpy.getState.calledOnce, 'onUpdate gets state from the store' ); |
||
| 31 | t.ok( validatorSpy.dispatchIfChanged.calledOnce, 'dispatchers are called' ); |
||
| 32 | t.ok( validatorSpy.dispatchIfChanged.calledWith( formContent, storeSpy ), 'dispatchers are called' ); |
||
| 33 | t.end(); |
||
| 34 | } ); |
||
| 35 | |||
| 36 |