1import { paramMock } from "./utils" 2 3export function mockInputmethod() { 4 const InputMethodControllerMock = { 5 stopInput: function (...args) { 6 console.warn("InputMethodController.stopInput interface mocked in the Previewer. How this interface works on" + 7 " the Previewer may be different from that on a real device.") 8 const len = args.length 9 if (typeof args[len - 1] === 'function') { 10 args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); 11 } else { 12 return new Promise((resolve, reject) => { 13 resolve(paramMock.paramBooleanMock); 14 }) 15 } 16 } 17 } 18 global.systemplugin.inputmethod = { 19 getInputMethodController: function () { 20 console.warn("inputmethod.getInputMethodController interface mocked in the Previewer. How this interface works" + 21 " on the Previewer may be different from that on a real device.") 22 return InputMethodControllerMock; 23 } 24 } 25}