Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Merge pull request #495 from eregs/499-search-back
Browse files Browse the repository at this point in the history
Check the correct version parameter in search.
  • Loading branch information
cmc333333 authored Aug 10, 2017
2 parents e8e056d + f9199c3 commit 4521c58
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 3 deletions.
8 changes: 8 additions & 0 deletions docs/regulations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ Subpackages
Submodules
----------

regulations\.all\_urls module
-----------------------------

.. automodule:: regulations.all_urls
:members:
:undoc-members:
:show-inheritance:

regulations\.apps module
------------------------

Expand Down
2 changes: 1 addition & 1 deletion regulations/static/config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "regulations-site",
"version": "7.0.2",
"version": "8.1.0",
"homepage": "https://eregs.github.io/",
"contributors": [
{
Expand Down
2 changes: 1 addition & 1 deletion regulations/static/regulations/js/source/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
44 changes: 44 additions & 0 deletions regulations/static/regulations/js/unittests/specs/router-spec.js
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');
});
});
});
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name="regulations",
version="8.0.0",
version="8.1.0",
packages=find_packages(),
include_package_data=True,
install_requires=[
Expand Down

0 comments on commit 4521c58

Please sign in to comment.