diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2018-08-02 21:14:20 +0200 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-08-08 16:25:33 +0200 |
| commit | 7ae25a0835a27cb9bf46ed64d6c59a1147110bee (patch) | |
| tree | 4df13757e114bf9291b31f05305cb01e1513ed53 /test | |
| parent | 045e915f7de99f9a16519a453169b05140810e81 (diff) | |
| download | mullvadvpn-7ae25a0835a27cb9bf46ed64d6c59a1147110bee.tar.xz mullvadvpn-7ae25a0835a27cb9bf46ed64d6c59a1147110bee.zip | |
Make HeaderBar more composable
Diffstat (limited to 'test')
| -rw-r--r-- | test/components/Connect.spec.js | 4 | ||||
| -rw-r--r-- | test/components/HeaderBar.spec.js | 44 |
2 files changed, 2 insertions, 46 deletions
diff --git a/test/components/Connect.spec.js b/test/components/Connect.spec.js index 67dae303d8..e445b2c788 100644 --- a/test/components/Connect.spec.js +++ b/test/components/Connect.spec.js @@ -19,7 +19,7 @@ describe('components/Connect', () => { const header = getComponent(component, 'header'); const securityMessage = getComponent(component, 'networkSecurityMessage'); const connectButton = getComponent(component, 'secureConnection'); - expect(header.prop('style')).to.equal('error'); + expect(header.prop('barStyle')).to.equal('error'); expect(securityMessage.html()).to.contain('UNSECURED'); expect(connectButton.html()).to.contain('Secure my connection'); }); @@ -35,7 +35,7 @@ describe('components/Connect', () => { const header = getComponent(component, 'header'); const securityMessage = getComponent(component, 'networkSecurityMessage'); const disconnectButton = getComponent(component, 'disconnect'); - expect(header.prop('style')).to.equal('success'); + expect(header.prop('barStyle')).to.equal('success'); expect(securityMessage.html()).to.contain('SECURE '); expect(disconnectButton.html()).to.contain('Disconnect'); }); diff --git a/test/components/HeaderBar.spec.js b/test/components/HeaderBar.spec.js deleted file mode 100644 index 09eab134ad..0000000000 --- a/test/components/HeaderBar.spec.js +++ /dev/null @@ -1,44 +0,0 @@ -// @flow - -import React from 'react'; -import { shallow } from 'enzyme'; -import HeaderBar from '../../app/components/HeaderBar'; - -describe('components/HeaderBar', () => { - it('should display settings button', () => { - const component = render({ - showSettings: true, - }); - const hasChildMatching = hasChild(component, 'headerbar__settings'); - expect(hasChildMatching).to.be.true; - }); - - it('should not display settings button', () => { - const component = render({ - showSettings: false, - }); - const hasChildMatching = hasChild(component, 'headerbar__settings'); - expect(hasChildMatching).to.be.false; - }); - - it('should call settings callback', (done) => { - const component = render({ - showSettings: true, - onSettings: () => done(), - }); - const settingsButton = getComponent(component, 'headerbar__settings'); - settingsButton.simulate('press'); - }); -}); - -function render(props) { - return shallow(<HeaderBar {...props} />); -} - -function getComponent(container, testName) { - return container.findWhere((n) => n.prop('testName') === testName); -} - -function hasChild(container, testName) { - return getComponent(container, testName).length > 0; -} |
