This repository has been archived by the owner on Apr 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #495 from eregs/499-search-back
Check the correct version parameter in search.
- Loading branch information
Showing
5 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
regulations/static/regulations/js/unittests/specs/router-spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { expect } from 'chai'; | ||
import jsdom from 'mocha-jsdom'; | ||
import sinon from 'sinon'; | ||
|
||
describe('RegRouter', () => { | ||
jsdom(); | ||
let MainEvents; | ||
let RegRouter; | ||
let triggerStub; | ||
|
||
before(() => { | ||
MainEvents = require('../../source/events/main-events'); | ||
RegRouter = require('../../source/router'); | ||
triggerStub = sinon.stub(MainEvents, 'trigger'); | ||
window.history.pushState = true; | ||
}); | ||
|
||
describe('::loadSearchResults', () => { | ||
it('passes along the correct variables', () => { | ||
RegRouter.loadSearchResults( | ||
'aDocType', 'aReg', { q: 'terms here', version: 'aVersion' }); | ||
expect(triggerStub).to.have.been.calledWith( | ||
'search-results:open', | ||
null, | ||
{ query: 'terms here', regVersion: 'aVersion', docType: 'aDocType' }, | ||
'search-results'); | ||
}); | ||
|
||
it('passes along the page, if present', () => { | ||
RegRouter.loadSearchResults( | ||
'aDocType', | ||
'aReg', | ||
{ q: 'terms here', version: 'aVersion', page: '4', ignored: 'aaa' }); | ||
expect(triggerStub).to.have.been.calledWith( | ||
'search-results:open', | ||
null, | ||
{ query: 'terms here', | ||
regVersion: 'aVersion', | ||
docType: 'aDocType', | ||
page: '4' }, | ||
'search-results'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters