diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2017-12-27 14:39:44 +0100 |
|---|---|---|
| committer | Andrej Mihajlov <and@mullvad.net> | 2018-03-29 13:54:10 +0200 |
| commit | a32adf9be4f077d1b0f0abdc041e161b51ec5331 (patch) | |
| tree | 8cd43fa0a5e562ec894b3f0cb705dbd9361dfab8 /test | |
| parent | 42d137a33e9376dd850aae374c16750c36ab72c4 (diff) | |
| download | mullvadvpn-a32adf9be4f077d1b0f0abdc041e161b51ec5331.tar.xz mullvadvpn-a32adf9be4f077d1b0f0abdc041e161b51ec5331.zip | |
Convert accordion to ReactXP
Diffstat (limited to 'test')
| -rw-r--r-- | test/components/Accordion.spec.js | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/test/components/Accordion.spec.js b/test/components/Accordion.spec.js deleted file mode 100644 index 1ef4d2871e..0000000000 --- a/test/components/Accordion.spec.js +++ /dev/null @@ -1,94 +0,0 @@ -// @flow -/* eslint react/no-find-dom-node: off */ - -import { expect } from 'chai'; -import * as React from 'react'; -import ReactDOM from 'react-dom'; -import Accordion from '../../app/components/Accordion'; - -describe('components/Accordion', () => { - - let container: ?HTMLElement; - - function renderIntoDocument(instance) { - if(!container) { - container = document.createElement('div'); - if(!document.documentElement) { - throw new Error('document.documentElement cannot be null.'); - } - document.documentElement.appendChild(container); - } - return ReactDOM.render(instance, container); - } - - // unmount container and clean up DOM - afterEach(() => { - if(container) { - ReactDOM.unmountComponentAtNode(container); - container = null; - } - }); - - it('should be collapsed upon mount', () => { - const component = renderIntoDocument( - <Accordion height={ 0 }> - <div style={{ height: 100 }}></div> - </Accordion> - ); - const domNode = ReactDOM.findDOMNode(component); - expect(domNode).to.have.property('clientHeight', 0); - }); - - it('should be expanded to provided height upon mount', () => { - const component = renderIntoDocument( - <Accordion height={ 100 } /> - ); - const domNode = ReactDOM.findDOMNode(component); - expect(domNode).to.have.property('clientHeight', 100); - }); - - it('should be expanded using layout upon mount', () => { - const component = renderIntoDocument( - <Accordion height={ 'auto' }> - <div style={{ height: 100 }}></div> - </Accordion> - ); - const domNode = ReactDOM.findDOMNode(component); - expect(domNode).to.have.property('clientHeight', 100); - }); - - it('should collapse', () => { - const component = renderIntoDocument( - <Accordion height={ 'auto' }> - <div style={{ height: 100 }}></div> - </Accordion> - ); - - renderIntoDocument( - <Accordion height={ 0 } transitionStyle="none"> - <div style={{ height: 100 }}></div> - </Accordion> - ); - - const domNode = ReactDOM.findDOMNode(component); - expect(domNode).to.have.property('clientHeight', 0); - }); - - it('should expand', () => { - const component = renderIntoDocument( - <Accordion height={ 0 }> - <div style={{ height: 100 }}></div> - </Accordion> - ); - - renderIntoDocument( - <Accordion height="auto" transitionStyle="none"> - <div style={{ height: 100 }}></div> - </Accordion> - ); - - const domNode = ReactDOM.findDOMNode(component); - expect(domNode).to.have.property('clientHeight', 100); - }); - -});
\ No newline at end of file |
