aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/modal/tests
diff options
context:
space:
mode:
authorChi Kei Chan <chikeichan@gmail.com>2019-03-22 07:03:30 +0800
committerDan J Miller <danjm.com@gmail.com>2019-03-22 07:03:30 +0800
commit31175625b446cb5d18b17db23018bca8b14d280c (patch)
treef54e159883deef003fb281267025edf796eb8004 /ui/app/components/modal/tests
parent7287133e15fab22299e07704206e85bc855d1064 (diff)
downloadtangerine-wallet-browser-31175625b446cb5d18b17db23018bca8b14d280c.tar.gz
tangerine-wallet-browser-31175625b446cb5d18b17db23018bca8b14d280c.tar.zst
tangerine-wallet-browser-31175625b446cb5d18b17db23018bca8b14d280c.zip
Folder restructure (#6304)
* Remove ui/app/keychains/ * Remove ui/app/img/ (unused images) * Move conversion-util to helpers/utils/ * Move token-util to helpers/utils/ * Move /helpers/*.js inside /helpers/utils/ * Move util tests inside /helpers/utils/ * Renameand move confirm-transaction/util.js to helpers/utils/ * Move higher-order-components to helpers/higher-order-components/ * Move infura-conversion.json to helpers/constants/ * Move all utility functions to helpers/utils/ * Move pages directory to top-level * Move all constants to helpers/constants/ * Move metametrics inside helpers/ * Move app and root inside pages/ * Move routes inside helpers/ * Re-organize ducks/ * Move reducers to ducks/ * Move selectors inside selectors/ * Move test out of test folder * Move action, reducer, store inside store/ * Move ui components inside ui/ * Move UI components inside ui/ * Move connected components inside components/app/ * Move i18n-helper inside helpers/ * Fix unit tests * Fix unit test * Move pages components * Rename routes component * Move reducers to ducks/index * Fix bad path in unit test
Diffstat (limited to 'ui/app/components/modal/tests')
-rw-r--r--ui/app/components/modal/tests/modal.component.test.js133
1 files changed, 0 insertions, 133 deletions
diff --git a/ui/app/components/modal/tests/modal.component.test.js b/ui/app/components/modal/tests/modal.component.test.js
deleted file mode 100644
index 2ced3f32d..000000000
--- a/ui/app/components/modal/tests/modal.component.test.js
+++ /dev/null
@@ -1,133 +0,0 @@
-import React from 'react'
-import assert from 'assert'
-import { mount, shallow } from 'enzyme'
-import sinon from 'sinon'
-import Modal from '../modal.component'
-import Button from '../../button'
-
-describe('Modal Component', () => {
- it('should render a modal with a submit button', () => {
- const wrapper = shallow(<Modal />)
-
- assert.equal(wrapper.find('.modal-container').length, 1)
- const buttons = wrapper.find(Button)
- assert.equal(buttons.length, 1)
- assert.equal(buttons.at(0).props().type, 'primary')
- })
-
- it('should render a modal with a cancel and a submit button', () => {
- const handleCancel = sinon.spy()
- const handleSubmit = sinon.spy()
- const wrapper = shallow(
- <Modal
- onCancel={handleCancel}
- cancelText="Cancel"
- onSubmit={handleSubmit}
- submitText="Submit"
- />
- )
-
- const buttons = wrapper.find(Button)
- assert.equal(buttons.length, 2)
- const cancelButton = buttons.at(0)
- const submitButton = buttons.at(1)
-
- assert.equal(cancelButton.props().type, 'default')
- assert.equal(cancelButton.props().children, 'Cancel')
- assert.equal(handleCancel.callCount, 0)
- cancelButton.simulate('click')
- assert.equal(handleCancel.callCount, 1)
-
- assert.equal(submitButton.props().type, 'primary')
- assert.equal(submitButton.props().children, 'Submit')
- assert.equal(handleSubmit.callCount, 0)
- submitButton.simulate('click')
- assert.equal(handleSubmit.callCount, 1)
- })
-
- it('should render a modal with different button types', () => {
- const wrapper = shallow(
- <Modal
- onCancel={() => {}}
- cancelText="Cancel"
- cancelType="secondary"
- onSubmit={() => {}}
- submitText="Submit"
- submitType="confirm"
- />
- )
-
- const buttons = wrapper.find(Button)
- assert.equal(buttons.length, 2)
- assert.equal(buttons.at(0).props().type, 'secondary')
- assert.equal(buttons.at(1).props().type, 'confirm')
- })
-
- it('should render a modal with children', () => {
- const wrapper = shallow(
- <Modal
- onCancel={() => {}}
- cancelText="Cancel"
- onSubmit={() => {}}
- submitText="Submit"
- >
- <div className="test-child" />
- </Modal>
- )
-
- assert.ok(wrapper.find('.test-class'))
- })
-
- it('should render a modal with a header', () => {
- const handleCancel = sinon.spy()
- const handleSubmit = sinon.spy()
- const wrapper = shallow(
- <Modal
- onCancel={handleCancel}
- cancelText="Cancel"
- onSubmit={handleSubmit}
- submitText="Submit"
- headerText="My Header"
- onClose={handleCancel}
- />
- )
-
- assert.ok(wrapper.find('.modal-container__header'))
- assert.equal(wrapper.find('.modal-container__header-text').text(), 'My Header')
- assert.equal(handleCancel.callCount, 0)
- assert.equal(handleSubmit.callCount, 0)
- wrapper.find('.modal-container__header-close').simulate('click')
- assert.equal(handleCancel.callCount, 1)
- assert.equal(handleSubmit.callCount, 0)
- })
-
- it('should disable the submit button if submitDisabled is true', () => {
- const handleCancel = sinon.spy()
- const handleSubmit = sinon.spy()
- const wrapper = mount(
- <Modal
- onCancel={handleCancel}
- cancelText="Cancel"
- onSubmit={handleSubmit}
- submitText="Submit"
- submitDisabled={true}
- headerText="My Header"
- onClose={handleCancel}
- />
- )
-
- const buttons = wrapper.find(Button)
- assert.equal(buttons.length, 2)
- const cancelButton = buttons.at(0)
- const submitButton = buttons.at(1)
-
- assert.equal(handleCancel.callCount, 0)
- cancelButton.simulate('click')
- assert.equal(handleCancel.callCount, 1)
-
- assert.equal(submitButton.props().disabled, true)
- assert.equal(handleSubmit.callCount, 0)
- submitButton.simulate('click')
- assert.equal(handleSubmit.callCount, 0)
- })
-})