Tests coverage

This commit is contained in:
Francisco Hodge 2019-11-13 07:34:57 -05:00
parent ec1be1a988
commit 6b7844b9f4

View File

@ -1,6 +1,8 @@
import TestUtility from '../../utils/TestUtility';
import MultipleKeyboardsDestroyDemo from '../MultipleKeyboardsDestroyDemo';
jest.useFakeTimers();
let testUtil = new TestUtility();
it('Demo will load', () => {
@ -65,3 +67,18 @@ it('Demo handleShiftButton will work', () => {
demo.keyboard.getButtonElement("{shift}")[0].onclick();
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");
});