-
-
Notifications
You must be signed in to change notification settings - Fork 645
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support close with ESC, focus tooltip on
show
(#407)
- Loading branch information
1 parent
79f6ab0
commit de53012
Showing
4 changed files
with
108 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import setupTour from '../utils/setup-tour'; | ||
import tippy from 'tippy.js'; | ||
|
||
describe('a11y', () => { | ||
let Shepherd; | ||
|
||
beforeEach(() => { | ||
Shepherd = null; | ||
tippy.setDefaults({ duration: 0, delay: 0 }); | ||
|
||
cy.visit('/test/dummy/', { | ||
onLoad(contentWindow) { | ||
if (contentWindow.Shepherd) { | ||
return Shepherd = contentWindow.Shepherd; | ||
} | ||
} | ||
}); | ||
}); | ||
|
||
describe('focus', () => { | ||
let tour; | ||
|
||
beforeEach(() => { | ||
tour = setupTour(Shepherd); | ||
}); | ||
|
||
afterEach(() => { | ||
tour.complete(); | ||
}); | ||
|
||
it('shepherd-element should have focus on tour start', () => { | ||
tour.start(); | ||
|
||
cy.get('.shepherd-element').should('have.focus'); | ||
}); | ||
}); | ||
|
||
describe('keydown events', () => { | ||
let tour; | ||
|
||
beforeEach(() => { | ||
tour = setupTour(Shepherd); | ||
}); | ||
|
||
afterEach(() => { | ||
tour.complete(); | ||
}); | ||
|
||
it('ESC cancels the tour', () => { | ||
tour.start(); | ||
|
||
cy.get('body').should('have.class', 'shepherd-active'); | ||
cy.get('.shepherd-element').trigger('keydown', { keyCode: 27 }); | ||
cy.get('body').should('not.have.class', 'shepherd-active'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters