mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
[web] Add tests for js/components/common/Button.jsx
This commit is contained in:
parent
cafa094f75
commit
f3e5c35b49
26
web/src/js/__tests__/components/common/ButtonSpec.js
Normal file
26
web/src/js/__tests__/components/common/ButtonSpec.js
Normal file
@ -0,0 +1,26 @@
|
||||
import React from 'react'
|
||||
import renderer from 'react-test-renderer'
|
||||
import Button from '../../../components/common/Button'
|
||||
|
||||
describe('Button Component', () => {
|
||||
|
||||
it('should render correctly', () => {
|
||||
let button = renderer.create(
|
||||
<Button className="classname" onClick={() => "onclick"} title="title" icon="icon">
|
||||
<a>foo</a>
|
||||
</Button>
|
||||
),
|
||||
tree = button.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
|
||||
it('should be able to be disabled', () => {
|
||||
let button = renderer.create(
|
||||
<Button className="classname" onClick={() => "onclick"} disabled="true" children="children">
|
||||
<a>foo</a>
|
||||
</Button>
|
||||
),
|
||||
tree = button.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
@ -0,0 +1,30 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Button Component should be able to be disabled 1`] = `
|
||||
<div
|
||||
className="classname btn btn-default"
|
||||
disabled="true"
|
||||
onClick={false}
|
||||
title={undefined}
|
||||
>
|
||||
<a>
|
||||
foo
|
||||
</a>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`Button Component should render correctly 1`] = `
|
||||
<div
|
||||
className="classname btn btn-default"
|
||||
disabled={undefined}
|
||||
onClick={[Function]}
|
||||
title="title"
|
||||
>
|
||||
<i
|
||||
className="fa fa-fw icon"
|
||||
/>
|
||||
<a>
|
||||
foo
|
||||
</a>
|
||||
</div>
|
||||
`;
|
Loading…
Reference in New Issue
Block a user