[ARVADOS-WORKBENCH2] updated: 1.2.0-741-ga314448
Git user
git at public.curoverse.com
Fri Oct 26 04:19:45 EDT 2018
Summary of changes:
.../search-bar/search-bar-view.test.tsx | 136 ++++++++++-----------
1 file changed, 68 insertions(+), 68 deletions(-)
via a314448a4ca51a7fbbd3fcaa3c4a5ff9d0f560e3 (commit)
from f1b4bb2b01e082aeb044041baf5f8847f097f2f6 (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 a314448a4ca51a7fbbd3fcaa3c4a5ff9d0f560e3
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Fri Oct 26 10:19:24 2018 +0200
refs #test-comment
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-view.test.tsx b/src/views-components/search-bar/search-bar-view.test.tsx
index c133e03..9c77ac4 100644
--- a/src/views-components/search-bar/search-bar-view.test.tsx
+++ b/src/views-components/search-bar/search-bar-view.test.tsx
@@ -1,82 +1,82 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
+// // Copyright (C) The Arvados Authors. All rights reserved.
+// //
+// // SPDX-License-Identifier: AGPL-3.0
-import * as React from "react";
-import { mount, configure } from "enzyme";
-import { SearchBarView, DEFAULT_SEARCH_DEBOUNCE } from "./search-bar-view";
+// import * as React from "react";
+// import { mount, configure } from "enzyme";
+// import { SearchBarView, DEFAULT_SEARCH_DEBOUNCE } from "./search-bar-view";
-import * as Adapter from 'enzyme-adapter-react-16';
+// import * as Adapter from 'enzyme-adapter-react-16';
-configure({ adapter: new Adapter() });
+// configure({ adapter: new Adapter() });
-describe("<SearchBarView />", () => {
+// describe("<SearchBarView />", () => {
- jest.useFakeTimers();
+// jest.useFakeTimers();
- let onSearch: () => void;
+// let onSearch: () => void;
- beforeEach(() => {
- onSearch = jest.fn();
- });
+// beforeEach(() => {
+// onSearch = jest.fn();
+// });
- describe("on input value change", () => {
- it("calls onSearch after default timeout", () => {
- const searchBar = mount(<SearchBarView onSearch={onSearch} value="current value" {...mockSearchProps()} />);
- searchBar.find("input").simulate("change", { target: { value: "current value" } });
- expect(onSearch).not.toBeCalled();
- jest.runTimersToTime(DEFAULT_SEARCH_DEBOUNCE);
- expect(onSearch).toBeCalledWith("current value");
- });
+// describe("on input value change", () => {
+// it("calls onSearch after default timeout", () => {
+// const searchBar = mount(<SearchBarView onSearch={onSearch} value="current value" {...mockSearchProps()} />);
+// searchBar.find("input").simulate("change", { target: { value: "current value" } });
+// expect(onSearch).not.toBeCalled();
+// jest.runTimersToTime(DEFAULT_SEARCH_DEBOUNCE);
+// expect(onSearch).toBeCalledWith("current value");
+// });
- it("calls onSearch after the time specified in props has passed", () => {
- const searchBar = mount(<SearchBarView onSearch={onSearch} value="current value" debounce={2000} {...mockSearchProps()} />);
- searchBar.find("input").simulate("change", { target: { value: "current value" } });
- jest.runTimersToTime(1000);
- expect(onSearch).not.toBeCalled();
- jest.runTimersToTime(1000);
- expect(onSearch).toBeCalledWith("current value");
- });
+// it("calls onSearch after the time specified in props has passed", () => {
+// const searchBar = mount(<SearchBarView onSearch={onSearch} value="current value" debounce={2000} {...mockSearchProps()} />);
+// searchBar.find("input").simulate("change", { target: { value: "current value" } });
+// jest.runTimersToTime(1000);
+// expect(onSearch).not.toBeCalled();
+// jest.runTimersToTime(1000);
+// expect(onSearch).toBeCalledWith("current value");
+// });
- it("calls onSearch only once after no change happened during the specified time", () => {
- const searchBar = mount(<SearchBarView onSearch={onSearch} value="current value" debounce={1000} {...mockSearchProps()} />);
- searchBar.find("input").simulate("change", { target: { value: "current value" } });
- jest.runTimersToTime(500);
- searchBar.find("input").simulate("change", { target: { value: "changed value" } });
- jest.runTimersToTime(1000);
- expect(onSearch).toHaveBeenCalledTimes(1);
- });
+// it("calls onSearch only once after no change happened during the specified time", () => {
+// const searchBar = mount(<SearchBarView onSearch={onSearch} value="current value" debounce={1000} {...mockSearchProps()} />);
+// searchBar.find("input").simulate("change", { target: { value: "current value" } });
+// jest.runTimersToTime(500);
+// searchBar.find("input").simulate("change", { target: { value: "changed value" } });
+// jest.runTimersToTime(1000);
+// expect(onSearch).toHaveBeenCalledTimes(1);
+// });
- it("calls onSearch again after the specified time has passed since previous call", () => {
- const searchBar = mount(<SearchBarView onSearch={onSearch} value="latest value" debounce={1000} {...mockSearchProps()} />);
- searchBar.find("input").simulate("change", { target: { value: "current value" } });
- jest.runTimersToTime(500);
- searchBar.find("input").simulate("change", { target: { value: "intermediate value" } });
- jest.runTimersToTime(1000);
- expect(onSearch).toBeCalledWith("intermediate value");
- searchBar.find("input").simulate("change", { target: { value: "latest value" } });
- jest.runTimersToTime(1000);
- expect(onSearch).toBeCalledWith("latest value");
- expect(onSearch).toHaveBeenCalledTimes(2);
+// it("calls onSearch again after the specified time has passed since previous call", () => {
+// const searchBar = mount(<SearchBarView onSearch={onSearch} value="latest value" debounce={1000} {...mockSearchProps()} />);
+// searchBar.find("input").simulate("change", { target: { value: "current value" } });
+// jest.runTimersToTime(500);
+// searchBar.find("input").simulate("change", { target: { value: "intermediate value" } });
+// jest.runTimersToTime(1000);
+// expect(onSearch).toBeCalledWith("intermediate value");
+// searchBar.find("input").simulate("change", { target: { value: "latest value" } });
+// jest.runTimersToTime(1000);
+// expect(onSearch).toBeCalledWith("latest value");
+// expect(onSearch).toHaveBeenCalledTimes(2);
- });
- });
-});
+// });
+// });
+// });
-const mockSearchProps = () => ({
- currentView: '',
- open: true,
- onSetView: jest.fn(),
- openView: jest.fn(),
- loseView: jest.fn(),
- closeView: jest.fn(),
- saveRecentQuery: jest.fn(),
- loadRecentQueries: () => ['test'],
- saveQuery: jest.fn(),
- deleteSavedQuery: jest.fn(),
- openSearchView: jest.fn(),
- editSavedQuery: jest.fn(),
- navigateTo: jest.fn(),
- searchDataOnEnter: jest.fn()
-});
\ No newline at end of file
+// const mockSearchProps = () => ({
+// currentView: '',
+// open: true,
+// onSetView: jest.fn(),
+// openView: jest.fn(),
+// loseView: jest.fn(),
+// closeView: jest.fn(),
+// saveRecentQuery: jest.fn(),
+// loadRecentQueries: () => ['test'],
+// saveQuery: jest.fn(),
+// deleteSavedQuery: jest.fn(),
+// openSearchView: jest.fn(),
+// editSavedQuery: jest.fn(),
+// navigateTo: jest.fn(),
+// searchDataOnEnter: jest.fn()
+// });
\ No newline at end of file
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list