|
1 | | -"use strict"; |
2 | 1 |
|
3 | | -import React from "react"; |
4 | | -import { shallow, mount } from "enzyme"; |
5 | | -import { expect } from "chai"; |
6 | 2 |
|
7 | | -import SubMenu from "../src/submenu"; |
| 3 | +import React from 'react'; |
| 4 | +import { shallow, mount } from 'enzyme'; |
| 5 | +import { expect } from 'chai'; |
8 | 6 |
|
9 | | -describe("<SubMenu/>", () => { |
10 | | - it("should have `react-context-menu-item` & `submenu` classes", () => { |
11 | | - const wrapper = shallow(<SubMenu title="foo"/>); |
| 7 | +import SubMenu from '../src/submenu'; |
12 | 8 |
|
13 | | - expect(wrapper).to.have.className("react-context-menu-item"); |
14 | | - expect(wrapper).to.have.className("submenu"); |
| 9 | +describe('<SubMenu/>', () => { |
| 10 | + it('should have `react-context-menu-item` & `submenu` classes', () => { |
| 11 | + const wrapper = shallow(<SubMenu title='foo' />); |
| 12 | + |
| 13 | + expect(wrapper).to.have.className('react-context-menu-item'); |
| 14 | + expect(wrapper).to.have.className('submenu'); |
15 | 15 | }); |
16 | 16 |
|
17 | | - it("<a/> should have `react-context-menu-link` class", () => { |
18 | | - const wrapper = shallow(<SubMenu title="foo"/>); |
| 17 | + it('<a/> should have `react-context-menu-link` class', () => { |
| 18 | + const wrapper = shallow(<SubMenu title='foo' />); |
19 | 19 |
|
20 | | - expect(wrapper.find("a")).to.have.className("react-context-menu-link"); |
21 | | - expect(wrapper.find("a")).to.not.have.className("disabled"); |
| 20 | + expect(wrapper.find('a')).to.have.className('react-context-menu-link'); |
| 21 | + expect(wrapper.find('a')).to.not.have.className('disabled'); |
22 | 22 | }); |
23 | 23 |
|
24 | | - it("<a/> should have `disabled` class when disabled", () => { |
25 | | - const wrapper = shallow(<SubMenu title="foo" disabled/>); |
| 24 | + it('<a/> should have `disabled` class when disabled', () => { |
| 25 | + const wrapper = shallow(<SubMenu title='foo' disabled />); |
26 | 26 |
|
27 | | - expect(wrapper.find("a")).to.have.className("react-context-menu-link"); |
28 | | - expect(wrapper.find("a")).to.have.className("disabled"); |
| 27 | + expect(wrapper.find('a')).to.have.className('react-context-menu-link'); |
| 28 | + expect(wrapper.find('a')).to.have.className('disabled'); |
29 | 29 | }); |
30 | 30 |
|
31 | | - it("should render `title` inside `<a/>`", () => { |
32 | | - const title = Math.random().toString(36), |
33 | | - wrapper = shallow(<SubMenu title={title} disabled/>); |
| 31 | + it('should render `title` inside `<a/>`', () => { |
| 32 | + const title = Math.random().toString(36); |
| 33 | + const wrapper = shallow(<SubMenu title={title} disabled />); |
34 | 34 |
|
35 | | - expect(wrapper.find("a")).to.have.text(title); |
| 35 | + expect(wrapper.find('a')).to.have.text(title); |
36 | 36 | }); |
37 | 37 |
|
38 | | - xit("should open submenu `onMouseEnter`", function() { |
39 | | - const wrapper = mount(<SubMenu title="foo" hoverDelay={0}/>); |
| 38 | + xit('should open submenu `onMouseEnter`', function () { |
| 39 | + const wrapper = mount(<SubMenu title='foo' hoverDelay={0} />); |
40 | 40 |
|
41 | | - wrapper.find(".submenu").simulate("mouseEnter"); |
42 | | - expect(wrapper).to.have.state("visible", true); |
| 41 | + wrapper.find('.submenu').simulate('mouseEnter'); |
| 42 | + expect(wrapper).to.have.state('visible', true); |
43 | 43 | }); |
44 | 44 |
|
45 | | - xit("should not open submenu `onMouseEnter` when disabled", function() { |
46 | | - const wrapper = mount(<SubMenu title="foo" hoverDelay={0} disabled/>); |
| 45 | + xit('should not open submenu `onMouseEnter` when disabled', function () { |
| 46 | + const wrapper = mount(<SubMenu title='foo' hoverDelay={0} disabled />); |
47 | 47 |
|
48 | | - wrapper.simulate("mouseenter"); |
49 | | - expect(wrapper).to.have.state("visible", false); |
| 48 | + wrapper.simulate('mouseenter'); |
| 49 | + expect(wrapper).to.have.state('visible', false); |
50 | 50 | }); |
51 | 51 | }); |
0 commit comments