mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 07:08:10 +00:00
[web] Add tests for js/components/Modal/ModalSpec.js
This commit is contained in:
parent
daec9854e2
commit
7a50301af3
30
web/src/js/__tests__/components/Modal/ModalSpec.js
Normal file
30
web/src/js/__tests__/components/Modal/ModalSpec.js
Normal file
@ -0,0 +1,30 @@
|
||||
import React from 'react'
|
||||
import renderer from 'react-test-renderer'
|
||||
import Modal from '../../../components/Modal/Modal'
|
||||
import { Provider } from 'react-redux'
|
||||
import { TStore } from '../../ducks/tutils'
|
||||
|
||||
describe('Modal Component', () => {
|
||||
let store = TStore()
|
||||
|
||||
it('should render correctly', () => {
|
||||
// hide modal by default
|
||||
let provider = renderer.create(
|
||||
<Provider store={store}>
|
||||
<Modal/>
|
||||
</Provider>
|
||||
),
|
||||
tree = provider.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
|
||||
// option modal show up
|
||||
store.getState().ui.modal.activeModal = 'OptionModal'
|
||||
provider = renderer.create(
|
||||
<Provider store={store}>
|
||||
<Modal/>
|
||||
</Provider>
|
||||
)
|
||||
tree = provider.toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
})
|
@ -0,0 +1,62 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Modal Component should render correctly 1`] = `<div />`;
|
||||
|
||||
exports[`Modal Component should render correctly 2`] = `
|
||||
<div>
|
||||
<div
|
||||
className="modal-backdrop fade in"
|
||||
/>
|
||||
<div
|
||||
aria-labelledby="options"
|
||||
className="modal modal-visible"
|
||||
id="optionsModal"
|
||||
role="dialog"
|
||||
tabIndex="-1"
|
||||
>
|
||||
<div
|
||||
className="modal-dialog modal-lg"
|
||||
role="document"
|
||||
>
|
||||
<div
|
||||
className="modal-content"
|
||||
>
|
||||
<div
|
||||
className="modal-header"
|
||||
>
|
||||
<button
|
||||
className="close"
|
||||
data-dismiss="modal"
|
||||
onClick={[Function]}
|
||||
type="button"
|
||||
>
|
||||
<i
|
||||
className="fa fa-fw fa-times"
|
||||
/>
|
||||
</button>
|
||||
<div
|
||||
className="modal-title"
|
||||
>
|
||||
<h4>
|
||||
Options
|
||||
</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="modal-body"
|
||||
/>
|
||||
<div
|
||||
className="modal-footer"
|
||||
>
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
type="button"
|
||||
>
|
||||
Save Changes
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
Loading…
Reference in New Issue
Block a user