[ARVADOS-WORKBENCH2] updated: 1.2.0-547-gb6501a1
Git user
git at public.curoverse.com
Mon Oct 8 03:28:33 EDT 2018
Summary of changes:
.../search-bar/search-bar-advanced-view.tsx | 4 ++--
.../search-bar/search-bar-autocomplete-view.tsx | 4 ++--
.../search-bar/search-bar-basic-view.tsx | 10 +++++-----
.../search-bar/search-bar-view.test.tsx | 18 +++++++++---------
src/views-components/search-bar/search-bar-view.tsx | 12 ++++++++----
5 files changed, 26 insertions(+), 22 deletions(-)
via b6501a16242c15f3dcff3910cee91ec92f91716e (commit)
from dd8c26f9525bf0a8733314d5717e99f231cc90d1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit b6501a16242c15f3dcff3910cee91ec92f91716e
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Mon Oct 8 09:28:16 2018 +0200
cr change + tests fix
Feature #14275
Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
diff --git a/src/views-components/search-bar/search-bar-advanced-view.tsx b/src/views-components/search-bar/search-bar-advanced-view.tsx
index 2ed8f06..ef13547 100644
--- a/src/views-components/search-bar/search-bar-advanced-view.tsx
+++ b/src/views-components/search-bar/search-bar-advanced-view.tsx
@@ -5,7 +5,7 @@
import * as React from 'react';
import { Paper, StyleRulesCallback, withStyles, WithStyles, List, Button } from '@material-ui/core';
import { SearchView } from '~/store/search-bar/search-bar-reducer';
-import { renderRecentQueries } from '~/views-components/search-bar/search-bar-view';
+import { RenderRecentQueries } from '~/views-components/search-bar/search-bar-view';
type CssRules = 'list';
@@ -25,7 +25,7 @@ export const SearchBarAdvancedView = withStyles(styles)(
({ classes, setView }: SearchBarAdvancedViewProps & WithStyles<CssRules>) =>
<Paper>
<List component="nav" className={classes.list}>
- {renderRecentQueries('ADVANCED VIEW')}
+ <RenderRecentQueries text='ADVANCED VIEW' />
</List>
<Button onClick={() => setView(SearchView.BASIC)}>Back</Button>
</Paper>
diff --git a/src/views-components/search-bar/search-bar-autocomplete-view.tsx b/src/views-components/search-bar/search-bar-autocomplete-view.tsx
index 29db23a..64b8361 100644
--- a/src/views-components/search-bar/search-bar-autocomplete-view.tsx
+++ b/src/views-components/search-bar/search-bar-autocomplete-view.tsx
@@ -4,7 +4,7 @@
import * as React from 'react';
import { Paper, StyleRulesCallback, withStyles, WithStyles, List } from '@material-ui/core';
-import { renderRecentQueries } from '~/views-components/search-bar/search-bar-view';
+import { RenderRecentQueries } from '~/views-components/search-bar/search-bar-view';
type CssRules = 'list';
@@ -23,7 +23,7 @@ export const SearchBarAutocompleteView = withStyles(styles)(
({ classes }: SearchBarAutocompleteViewProps & WithStyles<CssRules>) =>
<Paper>
<List component="nav" className={classes.list}>
- {renderRecentQueries('AUTOCOMPLETE VIEW')}
+ <RenderRecentQueries text='AUTOCOMPLETE VIEW' />
</List>
</Paper>
);
\ No newline at end of file
diff --git a/src/views-components/search-bar/search-bar-basic-view.tsx b/src/views-components/search-bar/search-bar-basic-view.tsx
index d6cff7a..7e25214 100644
--- a/src/views-components/search-bar/search-bar-basic-view.tsx
+++ b/src/views-components/search-bar/search-bar-basic-view.tsx
@@ -5,7 +5,7 @@
import * as React from 'react';
import { Paper, StyleRulesCallback, withStyles, WithStyles, List } from '@material-ui/core';
import { SearchView } from '~/store/search-bar/search-bar-reducer';
-import { renderRecentQueries, renderSavedQueries } from '~/views-components/search-bar/search-bar-view';
+import { RenderRecentQueries, RenderSavedQueries } from '~/views-components/search-bar/search-bar-view';
type CssRules = 'advanced' | 'searchQueryList' | 'list' | 'searchView';
@@ -42,13 +42,13 @@ export const SearchBarBasicView = withStyles(styles)(
<Paper className={classes.searchView}>
<div className={classes.searchQueryList}>Saved search queries</div>
<List component="nav" className={classes.list}>
- {renderSavedQueries('Test')}
- {renderSavedQueries('Demo')}
+ <RenderSavedQueries text="Test" />
+ <RenderSavedQueries text="Demo" />
</List>
<div className={classes.searchQueryList}>Recent search queries</div>
<List component="nav" className={classes.list}>
- {renderRecentQueries('cos')}
- {renderRecentQueries('testtest')}
+ <RenderRecentQueries text="cos" />
+ <RenderRecentQueries text="testtest" />
</List>
<div className={classes.advanced} onClick={() => setView(SearchView.ADVANCED)}>Advanced search</div>
</Paper>
diff --git a/src/views-components/search-bar/search-bar-view.test.tsx b/src/views-components/search-bar/search-bar-view.test.tsx
index 7ec90ee..843374b 100644
--- a/src/views-components/search-bar/search-bar-view.test.tsx
+++ b/src/views-components/search-bar/search-bar-view.test.tsx
@@ -22,28 +22,28 @@ describe("<SearchBar />", () => {
describe("on submit", () => {
it("calls onSearch with initial value passed via props", () => {
- const searchBar = mount(<SearchBarView value="initial value" onSearch={onSearch} />);
+ const searchBar = mount(<SearchBarView value="initial value" onSearch={onSearch} currentView='' open={true} onSetView={jest.fn()} openView={jest.fn()} closeView={jest.fn()} />);
searchBar.find("form").simulate("submit");
expect(onSearch).toBeCalledWith("initial value");
});
it("calls onSearch with current value", () => {
- const searchBar = mount(<SearchBarView value="" onSearch={onSearch} />);
+ const searchBar = mount(<SearchBarView value="" onSearch={onSearch} currentView='' open={true} onSetView={jest.fn()} openView={jest.fn()} closeView={jest.fn()} />);
searchBar.find("input").simulate("change", { target: { value: "current value" } });
searchBar.find("form").simulate("submit");
expect(onSearch).toBeCalledWith("current value");
});
it("calls onSearch with new value passed via props", () => {
- const searchBar = mount(<SearchBarView value="" onSearch={onSearch} />);
+ const searchBar = mount(<SearchBarView value="" onSearch={onSearch} currentView='' open={true} onSetView={jest.fn()} openView={jest.fn()} closeView={jest.fn()} />);
searchBar.find("input").simulate("change", { target: { value: "current value" } });
- searchBar.setProps({value: "new value"});
+ searchBar.setProps({ value: "new value" });
searchBar.find("form").simulate("submit");
expect(onSearch).toBeCalledWith("new value");
});
it("cancels timeout set on input value change", () => {
- const searchBar = mount(<SearchBarView value="" onSearch={onSearch} debounce={1000} />);
+ const searchBar = mount(<SearchBarView value="" onSearch={onSearch} debounce={1000} currentView='' open={true} onSetView={jest.fn()} openView={jest.fn()} closeView={jest.fn()} />);
searchBar.find("input").simulate("change", { target: { value: "current value" } });
searchBar.find("form").simulate("submit");
jest.advanceTimersByTime(1000);
@@ -55,7 +55,7 @@ describe("<SearchBar />", () => {
describe("on input value change", () => {
it("calls onSearch after default timeout", () => {
- const searchBar = mount(<SearchBarView value="" onSearch={onSearch} />);
+ const searchBar = mount(<SearchBarView value="" onSearch={onSearch} currentView='' open={true} onSetView={jest.fn()} openView={jest.fn()} closeView={jest.fn()} />);
searchBar.find("input").simulate("change", { target: { value: "current value" } });
expect(onSearch).not.toBeCalled();
jest.advanceTimersByTime(DEFAULT_SEARCH_DEBOUNCE);
@@ -63,7 +63,7 @@ describe("<SearchBar />", () => {
});
it("calls onSearch after the time specified in props has passed", () => {
- const searchBar = mount(<SearchBarView value="" onSearch={onSearch} debounce={2000}/>);
+ const searchBar = mount(<SearchBarView value="" onSearch={onSearch} debounce={2000} currentView='' open={true} onSetView={jest.fn()} openView={jest.fn()} closeView={jest.fn()} />);
searchBar.find("input").simulate("change", { target: { value: "current value" } });
jest.advanceTimersByTime(1000);
expect(onSearch).not.toBeCalled();
@@ -72,7 +72,7 @@ describe("<SearchBar />", () => {
});
it("calls onSearch only once after no change happened during the specified time", () => {
- const searchBar = mount(<SearchBarView value="" onSearch={onSearch} debounce={1000}/>);
+ const searchBar = mount(<SearchBarView value="" onSearch={onSearch} debounce={1000} currentView='' open={true} onSetView={jest.fn()} openView={jest.fn()} closeView={jest.fn()} />);
searchBar.find("input").simulate("change", { target: { value: "current value" } });
jest.advanceTimersByTime(500);
searchBar.find("input").simulate("change", { target: { value: "changed value" } });
@@ -81,7 +81,7 @@ describe("<SearchBar />", () => {
});
it("calls onSearch again after the specified time has passed since previous call", () => {
- const searchBar = mount(<SearchBarView value="" onSearch={onSearch} debounce={1000}/>);
+ const searchBar = mount(<SearchBarView value="" onSearch={onSearch} debounce={1000} currentView='' open={true} onSetView={jest.fn()} openView={jest.fn()} closeView={jest.fn()} />);
searchBar.find("input").simulate("change", { target: { value: "current value" } });
jest.advanceTimersByTime(500);
searchBar.find("input").simulate("change", { target: { value: "intermediate value" } });
diff --git a/src/views-components/search-bar/search-bar-view.tsx b/src/views-components/search-bar/search-bar-view.tsx
index 385c4fa..acd7ca2 100644
--- a/src/views-components/search-bar/search-bar-view.tsx
+++ b/src/views-components/search-bar/search-bar-view.tsx
@@ -60,16 +60,20 @@ interface SearchBarState {
value: string;
}
-export const renderRecentQueries = (text: string) => {
+interface RenderQueriesProps {
+ text: string;
+}
+
+export const RenderRecentQueries = (props: RenderQueriesProps) => {
return <ListItem button>
- <ListItemText secondary={text} />
+ <ListItemText secondary={props.text} />
</ListItem>;
};
-export const renderSavedQueries = (text: string) => {
+export const RenderSavedQueries = (props: RenderQueriesProps) => {
return <ListItem button>
- <ListItemText secondary={text} />
+ <ListItemText secondary={props.text} />
<ListItemSecondaryAction>
<Tooltip title="Remove">
<IconButton aria-label="Remove">
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list