diff options
Diffstat (limited to 'history/modules/__tests__/TestSequences/TransitionHookArgs.js')
-rw-r--r-- | history/modules/__tests__/TestSequences/TransitionHookArgs.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/history/modules/__tests__/TestSequences/TransitionHookArgs.js b/history/modules/__tests__/TestSequences/TransitionHookArgs.js new file mode 100644 index 0000000..bc79f02 --- /dev/null +++ b/history/modules/__tests__/TestSequences/TransitionHookArgs.js @@ -0,0 +1,32 @@ +import expect from 'expect'; + +import execSteps from './execSteps.js'; + +export default function(history, done) { + let hookLocation, hookAction; + const steps = [ + location => { + expect(location).toMatchObject({ + pathname: '/' + }); + + history.push('/home'); + }, + (location, action) => { + expect(hookAction).toBe(action); + expect(hookLocation).toBe(location); + } + ]; + + const unblock = history.block((location, action) => { + hookLocation = location; + hookAction = action; + + return 'Are you sure?'; + }); + + execSteps(steps, history, (...args) => { + unblock(); + done(...args); + }); +} |