diff options
author | Dan J Miller <danjm.com@gmail.com> | 2018-07-26 09:34:44 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-26 09:34:44 +0800 |
commit | acddb85f2ec1bd8c005377d098d9597d0eba294a (patch) | |
tree | fd94c43e6b1ae5a4d291365364e00aaff27a0eab /ui | |
parent | b5e3aafe2ecaf36a6d6d24aa905f8b9cd9e805b3 (diff) | |
parent | 9934690bd976b74cadd3211ab492022d1ff00a20 (diff) | |
download | tangerine-wallet-browser-acddb85f2ec1bd8c005377d098d9597d0eba294a.tar tangerine-wallet-browser-acddb85f2ec1bd8c005377d098d9597d0eba294a.tar.gz tangerine-wallet-browser-acddb85f2ec1bd8c005377d098d9597d0eba294a.tar.bz2 tangerine-wallet-browser-acddb85f2ec1bd8c005377d098d9597d0eba294a.tar.lz tangerine-wallet-browser-acddb85f2ec1bd8c005377d098d9597d0eba294a.tar.xz tangerine-wallet-browser-acddb85f2ec1bd8c005377d098d9597d0eba294a.tar.zst tangerine-wallet-browser-acddb85f2ec1bd8c005377d098d9597d0eba294a.zip |
Merge pull request #4876 from MetaMask/i4835-unitTestConfirmDetailRow
Add tests for Confirm Detail Row
Diffstat (limited to 'ui')
-rw-r--r-- | ui/app/components/confirm-page-container/confirm-detail-row/tests/confirm-detail-row.component.test.js | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/ui/app/components/confirm-page-container/confirm-detail-row/tests/confirm-detail-row.component.test.js b/ui/app/components/confirm-page-container/confirm-detail-row/tests/confirm-detail-row.component.test.js new file mode 100644 index 000000000..6f2489071 --- /dev/null +++ b/ui/app/components/confirm-page-container/confirm-detail-row/tests/confirm-detail-row.component.test.js @@ -0,0 +1,64 @@ +import React from 'react' +import assert from 'assert' +import { shallow } from 'enzyme' +import ConfirmDetailRow from '../confirm-detail-row.component.js' +import sinon from 'sinon' + +const propsMethodSpies = { + onHeaderClick: sinon.spy(), +} + +describe('Confirm Detail Row Component', function () { + let wrapper + + beforeEach(() => { + wrapper = shallow(<ConfirmDetailRow + errorType={'mockErrorType'} + label={'mockLabel'} + showError={false} + fiatText = {'mockFiatText'} + ethText = {'mockEthText'} + fiatTextColor= {'mockColor'} + onHeaderClick= {propsMethodSpies.onHeaderClick} + headerText = {'mockHeaderText'} + headerTextClassName = {'mockHeaderClass'} + />) + }) + + describe('render', () => { + it('should render a div with a confirm-detail-row class', () => { + assert.equal(wrapper.find('div.confirm-detail-row').length, 1) + }) + + it('should render the label as a child of the confirm-detail-row__label', () => { + assert.equal(wrapper.find('.confirm-detail-row > .confirm-detail-row__label').childAt(0).text(), 'mockLabel') + }) + + it('should render the headerText as a child of the confirm-detail-row__header-text', () => { + assert.equal(wrapper.find('.confirm-detail-row__details > .confirm-detail-row__header-text').childAt(0).text(), 'mockHeaderText') + }) + + it('should render the fiatText as a child of the confirm-detail-row__fiat', () => { + assert.equal(wrapper.find('.confirm-detail-row__details > .confirm-detail-row__fiat').childAt(0).text(), 'mockFiatText') + }) + + it('should render the ethText as a child of the confirm-detail-row__eth', () => { + assert.equal(wrapper.find('.confirm-detail-row__details > .confirm-detail-row__eth').childAt(0).text(), 'mockEthText') + }) + + it('should set the fiatTextColor on confirm-detail-row__fiat', () => { + assert.equal(wrapper.find('.confirm-detail-row__fiat').props().style.color, 'mockColor') + }) + + it('should assure the confirm-detail-row__header-text classname is correct', () => { + assert.equal(wrapper.find('.confirm-detail-row__header-text').props().className, 'confirm-detail-row__header-text mockHeaderClass') + }) + + it('should call onHeaderClick when headerText div gets clicked', () => { + wrapper.find('.confirm-detail-row__header-text').props().onClick() + assert.equal(assert.equal(propsMethodSpies.onHeaderClick.callCount, 1)) + }) + + + }) +}) |