mirror of
https://github.com/openharmony/third_party_jsframework.git
synced 2026-07-19 14:33:33 -04:00
äFill in the missing mocks
Signed-off-by: hungry_feiwei <huxiao31@huawei.com> Change-Id: Ie2a97c7f09577622a3613ea4c91322e87d8112c8
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user