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-header | |
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-header')
-rw-r--r-- | ui/app/components/page-container/page-container-header/tests/page-container-header.component.test.js | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/ui/app/components/page-container/page-container-header/tests/page-container-header.component.test.js b/ui/app/components/page-container/page-container-header/tests/page-container-header.component.test.js index e69de29bb..59304b2bd 100644 --- a/ui/app/components/page-container/page-container-header/tests/page-container-header.component.test.js +++ b/ui/app/components/page-container/page-container-header/tests/page-container-header.component.test.js @@ -0,0 +1,82 @@ +import React from 'react' +import assert from 'assert' +import { shallow } from 'enzyme' +import sinon from 'sinon' +import PageContainerHeader from '../page-container-header.component' + +describe('Page Container Header', () => { + let wrapper, style, onBackButtonClick, onClose + + beforeEach(() => { + style = {test: 'style'} + onBackButtonClick = sinon.spy() + onClose = sinon.spy() + + wrapper = shallow(<PageContainerHeader + showBackButton = {true} + onBackButtonClick = {onBackButtonClick} + backButtonStyles = {style} + title = {'Test Title'} + subtitle = {'Test Subtitle'} + tabs = {'Test Tab'} + onClose = {onClose} + />) + }) + + describe('Render Header Row', () => { + + it('renders back button', () => { + assert.equal(wrapper.find('.page-container__back-button').length, 1) + assert.equal(wrapper.find('.page-container__back-button').text(), 'Back') + }) + + it('ensures style prop', () => { + assert.equal(wrapper.find('.page-container__back-button').props().style, style) + }) + + it('should call back button when click is simulated', () => { + wrapper.find('.page-container__back-button').prop('onClick')() + assert.equal(onBackButtonClick.callCount, 1) + }) + }) + + describe('Render', () => { + let header, headerRow, pageTitle, pageSubtitle, pageClose, pageTab + + beforeEach(() => { + header = wrapper.find('.page-container__header--no-padding-bottom') + headerRow = wrapper.find('.page-container__header-row') + pageTitle = wrapper.find('.page-container__title') + pageSubtitle = wrapper.find('.page-container__subtitle') + pageClose = wrapper.find('.page-container__header-close') + pageTab = wrapper.find('.page-container__tabs') + }) + + it('renders page container', () => { + assert.equal(header.length, 1) + assert.equal(headerRow.length, 1) + assert.equal(pageTitle.length, 1) + assert.equal(pageSubtitle.length, 1) + assert.equal(pageClose.length, 1) + assert.equal(pageTab.length, 1) + }) + + it('renders title', () => { + assert.equal(pageTitle.text(), 'Test Title') + }) + + it('renders subtitle', () => { + assert.equal(pageSubtitle.text(), 'Test Subtitle') + }) + + it('renders tabs', () => { + assert.equal(pageTab.text(), 'Test Tab') + }) + + it('should call close when click is simulated', () => { + pageClose.prop('onClick')() + assert.equal(onClose.callCount, 1) + }) + }) + +}) |