Simulating keyboard events

Last updated 6 months ago
it('should toggle the content when pressing "Enter"', () => {
host = createHost(`<zippy title="Zippy title"></zippy>`);
host.keyboard.pressEnter(".zippy__title");
expect(host.query(".zippy__content")).toExist();
host.keyboard.pressEnter(".zippy__title");
expect(".zippy__content").not.toExist();
});
it('should toggle the content when pressing "Escape"', () => {
host = createHost(`<zippy title="Zippy title"></zippy>`);
host.keyboard.pressEscape(".zippy__title");
expect(host.query(".zippy__content")).toExist();
host.keyboard.pressEscape(".zippy__title");
// host.keyboard.pressTab(".zippy__title");
// host.keyboard.pressBackspace(".zippy__title");
expect(".zippy__content").not.toExist();
});