mirror of
https://github.com/hodgef/simple-keyboard.git
synced 2025-05-01 02:36:12 +08:00
Tests coverage
This commit is contained in:
parent
ec1be1a988
commit
6b7844b9f4
@ -1,6 +1,8 @@
|
|||||||
import TestUtility from '../../utils/TestUtility';
|
import TestUtility from '../../utils/TestUtility';
|
||||||
import MultipleKeyboardsDestroyDemo from '../MultipleKeyboardsDestroyDemo';
|
import MultipleKeyboardsDestroyDemo from '../MultipleKeyboardsDestroyDemo';
|
||||||
|
|
||||||
|
jest.useFakeTimers();
|
||||||
|
|
||||||
let testUtil = new TestUtility();
|
let testUtil = new TestUtility();
|
||||||
|
|
||||||
it('Demo will load', () => {
|
it('Demo will load', () => {
|
||||||
@ -65,3 +67,18 @@ it('Demo handleShiftButton will work', () => {
|
|||||||
demo.keyboard.getButtonElement("{shift}")[0].onclick();
|
demo.keyboard.getButtonElement("{shift}")[0].onclick();
|
||||||
expect(demo.keyboard.options.layoutName).toBe("default");
|
expect(demo.keyboard.options.layoutName).toBe("default");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('MultipleKeyboardsDestroyDemo will run all timers', () => {
|
||||||
|
testUtil.setDOM();
|
||||||
|
|
||||||
|
let demo = new MultipleKeyboardsDestroyDemo();
|
||||||
|
jest.runAllTimers();
|
||||||
|
|
||||||
|
expect(demo.keyboard.options.theme).toBe("hg-theme-default myTheme");
|
||||||
|
|
||||||
|
demo.keyboard.getButtonElement("{shift}")[0].onclick();
|
||||||
|
expect(demo.keyboard.options.layoutName).toBe("shift");
|
||||||
|
|
||||||
|
demo.keyboard.getButtonElement("A").onclick();
|
||||||
|
expect(demo.keyboard.input.default).toBe("A");
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user