From ac022fa3c61a034efff4f4c211c8f192c2aee096 Mon Sep 17 00:00:00 2001 From: CM Lubinski Date: Tue, 8 Aug 2017 18:15:28 -0400 Subject: [PATCH 1/3] Check the correct version parameter in search. Here, `params` refers to URL params, not the internal `config` objects we pass around. Unfortunately, they have two slightly different sets of field names. --- .../static/regulations/js/source/router.js | 2 +- .../js/unittests/specs/router-spec.js | 44 +++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 regulations/static/regulations/js/unittests/specs/router-spec.js diff --git a/regulations/static/regulations/js/source/router.js b/regulations/static/regulations/js/source/router.js index e4cf3c65a..c44026e57 100644 --- a/regulations/static/regulations/js/source/router.js +++ b/regulations/static/regulations/js/source/router.js @@ -71,7 +71,7 @@ if (typeof window.history.pushState === 'undefined') { loadSearchResults: function loadSearchResults(docType, reg, params) { const config = { query: params.q, - regVersion: params.regVersion, + regVersion: params.version, docType, }; diff --git a/regulations/static/regulations/js/unittests/specs/router-spec.js b/regulations/static/regulations/js/unittests/specs/router-spec.js new file mode 100644 index 000000000..c4e3091ba --- /dev/null +++ b/regulations/static/regulations/js/unittests/specs/router-spec.js @@ -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'); + }); + }); +}); From d05895d554133bbf786483c90377aa193c06f70b Mon Sep 17 00:00:00 2001 From: CM Lubinski Date: Thu, 10 Aug 2017 10:31:36 -0400 Subject: [PATCH 2/3] Rebuild docs --- docs/regulations.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/regulations.rst b/docs/regulations.rst index 6115c66c3..5a2a84d87 100644 --- a/docs/regulations.rst +++ b/docs/regulations.rst @@ -18,6 +18,14 @@ Subpackages Submodules ---------- +regulations\.all\_urls module +----------------------------- + +.. automodule:: regulations.all_urls + :members: + :undoc-members: + :show-inheritance: + regulations\.apps module ------------------------ From f9199c367704bbf02c642907061ad4adaf1089f7 Mon Sep 17 00:00:00 2001 From: CM Lubinski Date: Thu, 10 Aug 2017 10:17:26 -0400 Subject: [PATCH 3/3] Bump to 8.1.0. New Features * #496 New styles for sidebar Bugfixes * #492 Prevent 500 when "version" isn't present in search * #493 Request a page size when searching (will only be effective if regcore is >= 4.0.0 * #494 Prevent JS error when paging through search results * #495 Prevent JS error when back button is pressed in search results --- regulations/static/config/package.json | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/regulations/static/config/package.json b/regulations/static/config/package.json index 02818e6f8..cdd70d240 100644 --- a/regulations/static/config/package.json +++ b/regulations/static/config/package.json @@ -1,6 +1,6 @@ { "name": "regulations-site", - "version": "7.0.2", + "version": "8.1.0", "homepage": "https://eregs.github.io/", "contributors": [ { diff --git a/setup.py b/setup.py index 613d8c08e..536691396 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name="regulations", - version="8.0.0", + version="8.1.0", packages=find_packages(), include_package_data=True, install_requires=[