Skip to content

Commit

Permalink
Add tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertHilb committed Dec 15, 2018
1 parent 5d007f2 commit 08b57e4
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/test-apputils/src/toolbar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,38 @@ describe('@jupyterlab/apputils', () => {
button.dispose();
});
});
describe('keydown', () => {
it('Enter should activate the callback', async () => {
let called = false;
const button = new ToolbarButton({
onClick: () => {
called = true;
}
});
Widget.attach(button, document.body);
await framePromise();
simulate(button.node.firstChild as HTMLElement, 'keydown', {
key: 'Enter'
});
expect(called).to.equal(true);
button.dispose();
});
it('Space should activate the callback', async () => {
let called = false;
const button = new ToolbarButton({
onClick: () => {
called = true;
}
});
Widget.attach(button, document.body);
await framePromise();
simulate(button.node.firstChild as HTMLElement, 'keydown', {
key: ' '
});
expect(called).to.equal(true);
button.dispose();
});
});
});

// describe('#onAfterAttach()', () => {
Expand Down

0 comments on commit 08b57e4

Please sign in to comment.