diff options
author | tmashuang <thomas.b.huang@gmail.com> | 2018-09-25 00:28:04 +0800 |
---|---|---|
committer | tmashuang <thomas.b.huang@gmail.com> | 2018-09-25 00:28:04 +0800 |
commit | a0a57c24fd639c4808ed3e083089b9f1fb3373e6 (patch) | |
tree | 5a009cacab793398b1749e0d1e5af17c79af6322 /ui/app/components/page-container/page-container-footer | |
parent | 82ec86d953cb22d36f9b67d35e3d994d7d2d245d (diff) | |
download | tangerine-wallet-browser-a0a57c24fd639c4808ed3e083089b9f1fb3373e6.tar tangerine-wallet-browser-a0a57c24fd639c4808ed3e083089b9f1fb3373e6.tar.gz tangerine-wallet-browser-a0a57c24fd639c4808ed3e083089b9f1fb3373e6.tar.bz2 tangerine-wallet-browser-a0a57c24fd639c4808ed3e083089b9f1fb3373e6.tar.lz tangerine-wallet-browser-a0a57c24fd639c4808ed3e083089b9f1fb3373e6.tar.xz tangerine-wallet-browser-a0a57c24fd639c4808ed3e083089b9f1fb3373e6.tar.zst tangerine-wallet-browser-a0a57c24fd639c4808ed3e083089b9f1fb3373e6.zip |
Some Ui tests
Diffstat (limited to 'ui/app/components/page-container/page-container-footer')
-rw-r--r-- | ui/app/components/page-container/page-container-footer/tests/page-container-footer.component.test.js | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/ui/app/components/page-container/page-container-footer/tests/page-container-footer.component.test.js b/ui/app/components/page-container/page-container-footer/tests/page-container-footer.component.test.js index e69de29bb..5e5dbf00b 100644 --- a/ui/app/components/page-container/page-container-footer/tests/page-container-footer.component.test.js +++ b/ui/app/components/page-container/page-container-footer/tests/page-container-footer.component.test.js @@ -0,0 +1,69 @@ +import React from 'react' +import assert from 'assert' +import { shallow } from 'enzyme' +import sinon from 'sinon' +import Button from '../../../button' +import PageFooter from '../page-container-footer.component' + +describe('Page Footer', () => { + let wrapper + const onCancel = sinon.spy() + const onSubmit = sinon.spy() + + beforeEach(() => { + wrapper = shallow(<PageFooter + onCancel = {onCancel} + onSubmit = {onSubmit} + cancelText = {'Cancel'} + submitText = {'Submit'} + disabled = {false} + submitButtonType = {'Test Type'} + />) + }) + + it('renders page container footer', () => { + assert.equal(wrapper.find('.page-container__footer').length, 1) + }) + + it('renders two button components', () => { + assert.equal(wrapper.find(Button).length, 2) + }) + + describe('Cancel Button', () => { + + it('has button type of default', () => { + assert.equal(wrapper.find('.page-container__footer-button').first().prop('type'), 'default') + }) + + it('has children text of Cancel', () => { + assert.equal(wrapper.find('.page-container__footer-button').first().prop('children'), 'Cancel') + }) + + it('should call cancel when click is simulated', () => { + wrapper.find('.page-container__footer-button').first().prop('onClick')() + assert.equal(onCancel.callCount, 1) + }) + + }) + + describe('Submit Button', () => { + + it('assigns button type based on props', () => { + assert.equal(wrapper.find('.page-container__footer-button').last().prop('type'), 'Test Type') + }) + + it('has disabled prop', () => { + assert.equal(wrapper.find('.page-container__footer-button').last().prop('disabled'), false) + }) + + it('has children text when submitText prop exists', () => { + assert.equal(wrapper.find('.page-container__footer-button').last().prop('children'), 'Submit') + }) + + it('should call submit when click is simulated', () => { + wrapper.find('.page-container__footer-button').last().prop('onClick')() + assert.equal(onSubmit.callCount, 1) + }) + }) + +}) |