diff options
Diffstat (limited to 'history/modules/__tests__/TestSequences/EncodedReservedCharacters.js')
-rw-r--r-- | history/modules/__tests__/TestSequences/EncodedReservedCharacters.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/history/modules/__tests__/TestSequences/EncodedReservedCharacters.js b/history/modules/__tests__/TestSequences/EncodedReservedCharacters.js new file mode 100644 index 0000000..355a2ff --- /dev/null +++ b/history/modules/__tests__/TestSequences/EncodedReservedCharacters.js @@ -0,0 +1,38 @@ +import expect from 'expect'; + +import execSteps from './execSteps.js'; + +export default function(history, done) { + const steps = [ + () => { + // encoded string + const pathname = '/view/%23abc'; + history.replace(pathname); + }, + location => { + expect(location).toMatchObject({ + pathname: '/view/%23abc' + }); + + // encoded object + const pathname = '/view/%23abc'; + history.replace({ pathname }); + }, + location => { + expect(location).toMatchObject({ + pathname: '/view/%23abc' + }); + // unencoded string + const pathname = '/view/#abc'; + history.replace(pathname); + }, + location => { + expect(location).toMatchObject({ + pathname: '/view/', + hash: '#abc' + }); + } + ]; + + execSteps(steps, history, done); +} |