-
Notifications
You must be signed in to change notification settings - Fork 355
/
label.spec.ts
45 lines (42 loc) · 1.45 KB
/
label.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('Label Demo Test', () => {
it('Navigate to demo section', () => {
cy.visit('http://localhost:3000/label-demo-nav-link');
});
it('Verify isTruncated label and no tooltip on short text', () => {
cy.get('#truncated-no-tooltip .pf-c-label__content span')
.last()
.should('have.class', 'pf-c-label__text')
.then((noTooltipLink: JQuery<HTMLDivElement>) => {
cy.wrap(noTooltipLink)
.trigger('mouseenter')
.get('.pf-c-tooltip')
.should('not.exist');
cy.wrap(noTooltipLink).trigger('mouseleave');
});
});
it('Verify isTruncated label and tooltip', () => {
cy.get('#truncated-label .pf-c-label__content span')
.last()
.should('have.class', 'pf-c-label__text')
.then((tooltipLink: JQuery<HTMLDivElement>) => {
cy.get('.pf-c-tooltip').should('not.exist');
cy.wrap(tooltipLink)
.trigger('mouseenter')
.get('.pf-c-tooltip')
.should('exist');
cy.wrap(tooltipLink).trigger('mouseleave');
});
});
it('Verify router link label', () => {
cy.get('#router-link > .pf-c-label__content').then((routerTooltipLink: JQuery<HTMLDivElement>) => {
cy.get('.pf-c-tooltip').should('not.exist');
cy.wrap(routerTooltipLink)
.trigger('mouseenter')
.get('.pf-c-tooltip')
.should('exist');
});
cy.get('#router-link > a')
.invoke('attr', 'href')
.should('eq', '/');
});
});