summaryrefslogtreecommitdiff
path: root/history/modules/__tests__/TestSequences/HashChangeTransitionHook.js
diff options
context:
space:
mode:
Diffstat (limited to 'history/modules/__tests__/TestSequences/HashChangeTransitionHook.js')
-rw-r--r--history/modules/__tests__/TestSequences/HashChangeTransitionHook.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/history/modules/__tests__/TestSequences/HashChangeTransitionHook.js b/history/modules/__tests__/TestSequences/HashChangeTransitionHook.js
new file mode 100644
index 0000000..73fdeb9
--- /dev/null
+++ b/history/modules/__tests__/TestSequences/HashChangeTransitionHook.js
@@ -0,0 +1,33 @@
+import expect from 'expect';
+
+import execSteps from './execSteps.js';
+
+export default function(history, done) {
+ let unblock,
+ hookWasCalled = false;
+ const steps = [
+ location => {
+ expect(location).toMatchObject({
+ pathname: '/'
+ });
+
+ unblock = history.block(() => {
+ hookWasCalled = true;
+ });
+
+ window.location.hash = 'something-new';
+ },
+ location => {
+ expect(location).toMatchObject({
+ pathname: '/',
+ hash: '#something-new'
+ });
+
+ expect(hookWasCalled).toBe(true);
+
+ unblock();
+ }
+ ];
+
+ execSteps(steps, history, done);
+}