[ARVADOS-WORKBENCH2] updated: c96d8f5b046114354ce8bc64419c427912b520ea
Git user
git at public.curoverse.com
Tue Jun 12 09:00:27 EDT 2018
Summary of changes:
.../dropdown-menu/dropdown-menu.test.tsx | 43 ++++++++++++++++++++++
.../main-app-bar/dropdown-menu/dropdown-menu.tsx | 5 +--
2 files changed, 44 insertions(+), 4 deletions(-)
create mode 100644 src/components/main-app-bar/dropdown-menu/dropdown-menu.test.tsx
via c96d8f5b046114354ce8bc64419c427912b520ea (commit)
from 6ac1c00c725bab873d1f7e85eeffb917af1a9635 (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 c96d8f5b046114354ce8bc64419c427912b520ea
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Tue Jun 12 15:00:12 2018 +0200
Create dropdown-menu tests
Feature #13590
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/components/main-app-bar/dropdown-menu/dropdown-menu.test.tsx b/src/components/main-app-bar/dropdown-menu/dropdown-menu.test.tsx
new file mode 100644
index 0000000..19924ad
--- /dev/null
+++ b/src/components/main-app-bar/dropdown-menu/dropdown-menu.test.tsx
@@ -0,0 +1,43 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import { shallow, configure } from "enzyme";
+import DropdownMenu from "./dropdown-menu";
+import ChevronRightIcon from '@material-ui/icons/ChevronRight';
+
+import * as Adapter from 'enzyme-adapter-react-16';
+import { MenuItem, IconButton, Menu } from "@material-ui/core";
+
+configure({ adapter: new Adapter() });
+
+describe("<DropdownMenu />", () => {
+ it("renders menu icon", () => {
+ const dropdownMenu = shallow(<DropdownMenu id="test-menu" icon={ChevronRightIcon} />);
+ expect(dropdownMenu.find(ChevronRightIcon)).toHaveLength(1);
+ });
+
+ it("render menu items", () => {
+ const dropdownMenu = shallow(
+ <DropdownMenu id="test-menu" icon={ChevronRightIcon}>
+ <MenuItem>Item 1</MenuItem>
+ <MenuItem>Item 2</MenuItem>
+ </DropdownMenu>
+ );
+ expect(dropdownMenu.find(MenuItem)).toHaveLength(2);
+ });
+
+ it("opens on menu icon click", () => {
+ const dropdownMenu = shallow(<DropdownMenu id="test-menu" icon={ChevronRightIcon} />);
+ dropdownMenu.find(IconButton).simulate("click", {currentTarget: {}});
+ expect(dropdownMenu.state().anchorEl).toBeDefined();
+ });
+
+ it("closes on menu click", () => {
+ const dropdownMenu = shallow(<DropdownMenu id="test-menu" icon={ChevronRightIcon} />);
+ dropdownMenu.find(Menu).simulate("click", {currentTarget: {}});
+ expect(dropdownMenu.state().anchorEl).toBeUndefined();
+ });
+
+});
\ No newline at end of file
diff --git a/src/components/main-app-bar/dropdown-menu/dropdown-menu.tsx b/src/components/main-app-bar/dropdown-menu/dropdown-menu.tsx
index 533e5a4..34f9bf3 100644
--- a/src/components/main-app-bar/dropdown-menu/dropdown-menu.tsx
+++ b/src/components/main-app-bar/dropdown-menu/dropdown-menu.tsx
@@ -3,10 +3,7 @@
// SPDX-License-Identifier: AGPL-3.0
import * as React from 'react';
-import { Button, Grid, StyleRulesCallback, WithStyles, Menu, MenuItem } from '@material-ui/core';
-import ChevronRightIcon from '@material-ui/icons/ChevronRight';
-import { withStyles } from '@material-ui/core';
-import { IconButton } from '@material-ui/core/es';
+import { Button, Grid, StyleRulesCallback, WithStyles, Menu, MenuItem, IconButton } from '@material-ui/core';
import { PopoverOrigin } from '@material-ui/core/Popover';
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list