Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop to master #2054

Merged
merged 6 commits into from
Mar 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
command: |
docker run -p 5432:5432 -d --name db arminc/clair-db:latest
docker run -p 6060:6060 --link db:postgres -d --name clair arminc/clair-local-scan:v2.0.1
docker run -v /var/run/docker.sock:/var/run/docker.sock -d --name clair-scanner cdssnc/clair-scanner:latest tail -f /dev/null
docker run -v /var/run/docker.sock:/var/run/docker.sock -d --name clair-scanner veteransaffairscanada/clair-scanner:latest tail -f /dev/null
clair_ip=`docker exec -it clair hostname -i | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'`
scanner_ip=`docker exec -it clair-scanner hostname -i | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'`
docker exec -it clair-scanner clair-scanner --ip ${scanner_ip} --clair=http://${clair_ip}:6060 -t High "${DOCKER_REGISTRY}/${NAMESPACE}/${CIRCLE_PROJECT_REPONAME}:${CIRCLE_SHA1}"
Expand Down
10 changes: 9 additions & 1 deletion __tests__/components/search_box_test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import React from "react";
import { mount } from "enzyme";
import SearchBox from "../../components/search_box";
import Router from "next/router";
const { axe, toHaveNoViolations } = require("jest-axe");
expect.extend(toHaveNoViolations);

describe("SearchBox", () => {
let props;
Router.replace = jest.fn().mockImplementation(() => new Promise(() => true));
beforeEach(() => {
props = {
onButtonClick: jest.fn(),
Expand All @@ -14,7 +16,13 @@ describe("SearchBox", () => {
onKeyUp: jest.fn(),
value: "the value",
onChange: jest.fn(),
onClear: jest.fn()
onClear: jest.fn(),
url: {
query: {
lng: "en",
searchString: "disability"
}
}
};
});

Expand Down
1 change: 1 addition & 0 deletions components/benefits_pane.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export class BenefitsPane extends Component {
onChange={this.handleSearchChange}
disableButton={true}
onClear={() => setSearchString("")}
url={this.props.url}
/>
</div>
</Grid>
Expand Down
9 changes: 8 additions & 1 deletion components/search_box.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import styled from "@emotion/styled";
import SearchIcon from "./icons/Search";
import CancelIcon from "./icons/Cancel";
import { globalTheme } from "../theme";
import Router from "next/router";
import { mutateUrl } from "../utils/common";

const SearchBoxWrapper = styled("div")({
boxSizing: "border-box",
Expand Down Expand Up @@ -105,6 +107,8 @@ class SearchBox extends Component {
}
handleChange = event => {
this.setState({ value: event.target.value }); // state of InputSearchBox
this.props.url.query.searchString = event.target.value;
Router.replace(mutateUrl(this.props.url));
if (this.props.onChange) {
this.props.onChange(event);
}
Expand All @@ -113,6 +117,8 @@ class SearchBox extends Component {
handleClear = () => {
this.textInput.current.value = "";
this.setState({ value: "" }); // state of InputSearchBox
this.props.url.query.searchString = "";
Router.replace(mutateUrl(this.props.url));
if (this.props.onClear) {
this.props.onClear();
}
Expand Down Expand Up @@ -189,7 +195,8 @@ SearchBox.propTypes = {
inputId: PropTypes.string,
buttonId: PropTypes.string,
disableButton: PropTypes.bool,
onButtonClick: PropTypes.func
onButtonClick: PropTypes.func,
url: PropTypes.object
};

export default SearchBox;