-
Notifications
You must be signed in to change notification settings - Fork 426
/
Copy pathexample-autotooltips.cy.ts
55 lines (44 loc) · 2.56 KB
/
example-autotooltips.cy.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
51
52
53
54
55
describe('Example AutoTooltips Plugin', () => {
const GRID_ROW_HEIGHT = 25;
const originalTitles = ['Title', 'Duration', '% Complete', 'Start', 'Finish', 'Effort Driven'];
beforeEach(() => {
cy.restoreLocalStorage();
});
afterEach(() => {
cy.saveLocalStorage();
});
it('should display Example title', () => {
cy.visit(`${Cypress.config('baseUrl')}/examples/example-autotooltips.html`);
cy.get('ul > li').should('contain', 'AutoTooltips plugin');
});
it('should have exact Column Titles in the grid', () => {
cy.get('.slick-header-columns')
.children()
.each(($child, index) => expect($child.text()).to.eq(originalTitles[index]));
});
it('should resize "Start" date column and make it smaller than text length and hover over cell to see tooltip', () => {
cy.get('.slick-header-columns')
.children('.slick-header-column:nth(3)')
.should('contain', 'Start');
cy.get('.slick-resizable-handle:nth(3)')
.trigger('mousedown', { which: 1, force: true })
.trigger('mousemove', 'bottomRight');
cy.get('.slick-header-column:nth(2)')
.trigger('mousemove', 'bottomRight')
.trigger('mouseup', 'bottomRight', { which: 1, force: true });
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell.l3.r3`).should('contain', '01/01/2009');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell.l3.r3`).trigger('mouseover');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell.l3.r3`).should('have.attr', 'title', '01/01/2009');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"] > .slick-cell.l3.r3`).should('contain', '01/01/2009');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"] > .slick-cell.l3.r3`).trigger('mouseover');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 1}px;"] > .slick-cell.l3.r3`).should('have.attr', 'title', '01/01/2009');
});
it('should hover over "Finish" cell to see tooltip', () => {
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell.l4.r4`).should('contain', '01/05/2009');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell.l4.r4`).trigger('mouseover');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell.l4.r4`).should('not.have.attr', 'title', '01/05/2009');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell.l4.r4`).should('contain', '01/05/2009');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell.l4.r4`).trigger('mouseover');
cy.get(`[style="top: ${GRID_ROW_HEIGHT * 0}px;"] > .slick-cell.l4.r4`).should('not.have.attr', 'title', '01/05/2009');
});
});