diff options
Diffstat (limited to 'spec/javascript')
-rw-r--r-- | spec/javascript/components/avatar.test.js (renamed from spec/javascript/components/avatar.test.jsx) | 4 | ||||
-rw-r--r-- | spec/javascript/components/button.test.js (renamed from spec/javascript/components/button.test.jsx) | 2 | ||||
-rw-r--r-- | spec/javascript/components/display_name.test.js (renamed from spec/javascript/components/display_name.test.jsx) | 8 | ||||
-rw-r--r-- | spec/javascript/components/dropdown_menu.test.js (renamed from spec/javascript/components/dropdown_menu.test.jsx) | 12 | ||||
-rw-r--r-- | spec/javascript/components/features/ui/components/column.test.js (renamed from spec/javascript/components/features/ui/components/column.test.jsx) | 2 | ||||
-rw-r--r-- | spec/javascript/components/loading_indicator.test.js (renamed from spec/javascript/components/loading_indicator.test.jsx) | 4 | ||||
-rw-r--r-- | spec/javascript/setup.js | 5 |
7 files changed, 17 insertions, 20 deletions
diff --git a/spec/javascript/components/avatar.test.jsx b/spec/javascript/components/avatar.test.js index f70173880..03b71dc9d 100644 --- a/spec/javascript/components/avatar.test.jsx +++ b/spec/javascript/components/avatar.test.js @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { render } from 'enzyme'; - -import Avatar from '../../../app/javascript/mastodon/components/avatar' +import React from 'react'; +import Avatar from '../../../app/javascript/mastodon/components/avatar'; describe('<Avatar />', () => { const src = '/path/to/image.jpg'; diff --git a/spec/javascript/components/button.test.jsx b/spec/javascript/components/button.test.js index e08671c01..9cf8b1eed 100644 --- a/spec/javascript/components/button.test.jsx +++ b/spec/javascript/components/button.test.js @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { shallow } from 'enzyme'; import sinon from 'sinon'; - +import React from 'react'; import Button from '../../../app/javascript/mastodon/components/button'; describe('<Button />', () => { diff --git a/spec/javascript/components/display_name.test.jsx b/spec/javascript/components/display_name.test.js index 7072e653e..d6dc7edc0 100644 --- a/spec/javascript/components/display_name.test.jsx +++ b/spec/javascript/components/display_name.test.js @@ -1,15 +1,15 @@ import { expect } from 'chai'; import { render } from 'enzyme'; import Immutable from 'immutable'; - -import DisplayName from '../../../app/javascript/mastodon/components/display_name' +import React from 'react'; +import DisplayName from '../../../app/javascript/mastodon/components/display_name'; describe('<DisplayName />', () => { it('renders display name + account name', () => { const account = Immutable.fromJS({ username: 'bar', acct: 'bar@baz', - display_name: 'Foo' + display_name: 'Foo', }); const wrapper = render(<DisplayName account={account} />); expect(wrapper).to.have.text('Foo @bar@baz'); @@ -19,7 +19,7 @@ describe('<DisplayName />', () => { const account = Immutable.fromJS({ username: 'bar', acct: 'bar@baz', - display_name: '' + display_name: '', }); const wrapper = render(<DisplayName account={account} />); expect(wrapper).to.have.text('bar @bar@baz'); diff --git a/spec/javascript/components/dropdown_menu.test.jsx b/spec/javascript/components/dropdown_menu.test.js index c5bbf5ad6..54cdcabf0 100644 --- a/spec/javascript/components/dropdown_menu.test.jsx +++ b/spec/javascript/components/dropdown_menu.test.js @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { shallow, mount } from 'enzyme'; import sinon from 'sinon'; - +import React from 'react'; import DropdownMenu from '../../../app/javascript/mastodon/components/dropdown_menu'; import Dropdown, { DropdownTrigger, DropdownContent } from 'react-simple-dropdown'; @@ -12,7 +12,7 @@ describe('<DropdownMenu />', () => { const items = [ { text: 'first item', action: action, href: '/some/url' }, - { text: 'second item', action: 'noop' } + { text: 'second item', action: 'noop' }, ]; const wrapper = shallow(<DropdownMenu icon={icon} items={items} size={size} />); @@ -35,23 +35,23 @@ describe('<DropdownMenu />', () => { }); it('uses props.icon as icon class name', () => { - expect(wrapper.find(DropdownTrigger).find('i')).to.have.className(`fa-${icon}`) + expect(wrapper.find(DropdownTrigger).find('i')).to.have.className(`fa-${icon}`); }); it('is not expanded by default', () => { expect(wrapper.state('expanded')).to.be.equal(false); - }) + }); it('does not render the list elements if not expanded', () => { const lis = wrapper.find(DropdownContent).find('li'); expect(lis.length).to.be.equal(0); - }) + }); it('sets expanded to true when clicking the trigger', () => { const wrapper = mount(<DropdownMenu icon={icon} items={items} size={size} />); wrapper.find(DropdownTrigger).first().simulate('click'); expect(wrapper.state('expanded')).to.be.equal(true); - }) + }); // Error: ReactWrapper::state() can only be called on the root /*it('sets expanded to false when clicking outside', () => { diff --git a/spec/javascript/components/features/ui/components/column.test.jsx b/spec/javascript/components/features/ui/components/column.test.js index 6359905e6..df0f43e60 100644 --- a/spec/javascript/components/features/ui/components/column.test.jsx +++ b/spec/javascript/components/features/ui/components/column.test.js @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { mount } from 'enzyme'; import sinon from 'sinon'; - +import React from 'react'; import Column from '../../../../../../app/javascript/mastodon/features/ui/components/column'; import ColumnHeader from '../../../../../../app/javascript/mastodon/features/ui/components/column_header'; diff --git a/spec/javascript/components/loading_indicator.test.jsx b/spec/javascript/components/loading_indicator.test.js index a372640be..0859dd192 100644 --- a/spec/javascript/components/loading_indicator.test.jsx +++ b/spec/javascript/components/loading_indicator.test.js @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { shallow } from 'enzyme'; - -import LoadingIndicator from '../../../app/javascript/mastodon/components/loading_indicator' +import React from 'react'; +import LoadingIndicator from '../../../app/javascript/mastodon/components/loading_indicator'; describe('<LoadingIndicator />', () => { diff --git a/spec/javascript/setup.js b/spec/javascript/setup.js index 24f21db72..7d4b2866e 100644 --- a/spec/javascript/setup.js +++ b/spec/javascript/setup.js @@ -15,8 +15,5 @@ Object.keys(document.defaultView).forEach((property) => { }); global.navigator = { - userAgent: 'node.js' + userAgent: 'node.js', }; - -var React = window.React = global.React = require('react'); -var ReactDOM = window.ReactDOM = global.ReactDOM = require('react-dom'); |