mirror of
https://github.com/hodgef/simple-keyboard.git
synced 2025-01-19 16:52:59 +08:00
Tests update
This commit is contained in:
parent
d567b3ac01
commit
cfdf7574ca
@ -706,4 +706,63 @@ it('Keyboard buttonTheme will be ignored if already added', () => {
|
||||
},
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
it('Keyboard can set a module', () => {
|
||||
testUtil.setDOM();
|
||||
|
||||
let keyboard = new Keyboard();
|
||||
|
||||
keyboard.registerModule(
|
||||
"test",
|
||||
(module) => {
|
||||
module.foo = "bar";
|
||||
}
|
||||
);
|
||||
|
||||
expect(keyboard.getModuleProp("test", "foo")).toBe("bar");
|
||||
});
|
||||
|
||||
it('Keyboard can set a module by amending the modules tree', () => {
|
||||
testUtil.setDOM();
|
||||
|
||||
let keyboard = new Keyboard();
|
||||
|
||||
keyboard.modules = {
|
||||
testman: {
|
||||
foo: "baz"
|
||||
}
|
||||
};
|
||||
|
||||
keyboard.registerModule(
|
||||
"test",
|
||||
(module) => {
|
||||
module.foo = "bar";
|
||||
}
|
||||
);
|
||||
|
||||
expect(keyboard.getModuleProp("test", "foo")).toBe("bar");
|
||||
});
|
||||
|
||||
it('Keyboard will not retrieve an option for an inexistent module', () => {
|
||||
testUtil.setDOM();
|
||||
|
||||
let keyboard = new Keyboard();
|
||||
|
||||
expect(keyboard.getModuleProp("test", "foo")).toBeFalsy();
|
||||
});
|
||||
|
||||
it('Keyboard will get a list of modules', () => {
|
||||
testUtil.setDOM();
|
||||
|
||||
let keyboard = new Keyboard();
|
||||
|
||||
keyboard.registerModule(
|
||||
"test",
|
||||
(module) => {
|
||||
module.foo = "bar";
|
||||
}
|
||||
);
|
||||
|
||||
expect(keyboard.getModulesList()).toBe(["test"]);
|
||||
});
|
Loading…
Reference in New Issue
Block a user