äFill in the missing mocks

Signed-off-by: hungry_feiwei <huxiao31@huawei.com>
Change-Id: Ie2a97c7f09577622a3613ea4c91322e87d8112c8
This commit is contained in:
hungry_feiwei
2022-07-07 17:55:52 +08:00
parent b42a86bb73
commit 682e047748
@@ -82,8 +82,26 @@ export function mockInputMonitor() {
off: function (...args) {
console.warn('multimodalInput.inputMonitor.off interface mocked in the Previewer. How this interface works on the' +
' Previewer may be different from that on a real device.');
clearInterval(this.offInputMonitor);
delete this.offInputMonitor;
const len = args.length;
if (len < 1 || len > 2) {
console.warn("a maximum of two parameters");
return;
}
if (typeof args[0] !== 'string') {
console.warn("the first parameter type must be string");
return;
}
if (len === 1) {
if (args[0] !== 'touch' && args[0] !== 'mouse') {
console.warn("the first param should be touch or mouse");
return;
}
} else {
if (typeof args[1] !== 'function') {
console.warn("the second parameter type must be function");
return;
}
}
}
}
return inputMonitor