-
Notifications
You must be signed in to change notification settings - Fork 4.1k
/
Copy pathevents.spec.ts
50 lines (44 loc) · 1.52 KB
/
events.spec.ts
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
38
39
40
41
42
43
44
45
46
47
48
49
50
import selector from '../fixtures/selectors.json';
import cypressJson from '../../cypress.json';
describe('event propagation', () => {
before(() => {
cy.visit(cypressJson.baseUrl);
cy.title().should('equal', 'React-Select');
cy.get('h1').should('contain', 'Test Page for Cypress');
});
beforeEach(() => {
cy.reload();
});
it('should open select via value container after a parent prevent defaulted the event', () => {
cy.get(selector.preventDefaultTest.valueContainer)
.click()
.get(selector.preventDefaultTest.menu)
.should('exist');
});
it('should open select via indicator after a parent prevent defaulted the event', () => {
cy.get(selector.preventDefaultTest.indicator)
.click()
.get(selector.preventDefaultTest.menu)
.should('exist');
});
it('should close react calendar when interacting with the select indicator', () => {
cy.get(selector.bubblingTest.datePickerInput)
.click()
.get(selector.bubblingTest.indicator)
.click()
.get(selector.bubblingTest.menu)
.should('exist')
.get(selector.bubblingTest.datePickerMenu)
.should('not.exist');
});
it('should close react calendar when interacting with the select value container', () => {
cy.get(selector.bubblingTest.datePickerInput)
.click()
.get(selector.bubblingTest.valueContainer)
.click()
.get(selector.bubblingTest.menu)
.should('exist')
.get(selector.bubblingTest.datePickerMenu)
.should('not.exist');
});
});