forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
slider.spec.ts
45 lines (41 loc) · 1.51 KB
/
slider.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
describe('Slider Demo Test', () => {
it('Navigate to Slider section', () => {
cy.visit('http://localhost:3000/slider-demo-nav-link');
});
it('renders the discrete slider', () => {
cy.get('#discrete-slider').should('exist');
cy.get('#discrete-slider').should(
'have.attr',
'style',
'--pf-c-slider--value:62.5%; --pf-c-slider__value--c-form-control--width-chars:1;'
);
});
it('changes discrete slider value when clicked on', () => {
cy.get('#discrete-slider > .pf-c-slider__main > .pf-c-slider__thumb')
.trigger('mousedown', { which: 1 })
.trigger('mousemove', { clientX: 300, clientY: 300 })
.trigger('mouseup', { force: true });
});
it('renders the slider with input', () => {
cy.get('#discrete-slider-input-label').should('exist');
cy.get('#discrete-slider-input-label > .pf-c-slider__value > .pf-c-input-group > .pf-c-form-control').should(
'exist'
);
cy.get('#discrete-slider-input-label > .pf-c-slider__value > .pf-c-input-group > .pf-c-input-group__text').should(
'exist'
);
cy.get('#discrete-slider-input-label').should(
'have.attr',
'style',
'--pf-c-slider--value:50%; --pf-c-slider__value--c-form-control--width-chars:2;'
);
});
it('renders the continuous slider', () => {
cy.get('#continuous-slider').should('exist');
cy.get('#continuous-slider').should(
'have.attr',
'style',
'--pf-c-slider--value:50%; --pf-c-slider__value--c-form-control--width-chars:2;'
);
});
});