forked from cypress-io/cypress-react-unit-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdropdown-spec.js
37 lines (33 loc) · 901 Bytes
/
dropdown-spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React from 'react'
import { Dropdown } from 'react-bootstrap'
import { mount } from 'cypress-react-unit-test'
class UserControls extends React.Component {
constructor(props) {
super(props)
this.state = {}
}
render() {
return (
<Dropdown>
<Dropdown.Toggle>Top Toggle</Dropdown.Toggle>
<Dropdown.Menu>
<li>First</li>
<li>Second</li>
<li>Third</li>
</Dropdown.Menu>
</Dropdown>
)
}
}
UserControls.displayName = 'UserControls'
// https://github.com/bahmutov/cypress-react-unit-test/issues/99
describe('react-bootstrap Dropdown', () => {
it('works', () => {
mount(<UserControls />, {
cssFile: 'node_modules/bootstrap/dist/css/bootstrap.min.css',
})
cy.contains('Top Toggle').click()
cy.contains('li', 'First').should('be.visible')
cy.get('li').should('have.length', 3)
})
})