From cc6ffae0a4e50a2f1d359434b053b427f7dd09a9 Mon Sep 17 00:00:00 2001 From: ma-shaoyin Date: Mon, 15 Aug 2022 15:47:59 +0800 Subject: [PATCH] Signed-off-by: ma-shaoyin Changes to be committed: --- .../systemplugin/napi/ohos_inputmethod.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/runtime/main/extend/systemplugin/napi/ohos_inputmethod.js b/runtime/main/extend/systemplugin/napi/ohos_inputmethod.js index 4596334c..3de5a2de 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_inputmethod.js +++ b/runtime/main/extend/systemplugin/napi/ohos_inputmethod.js @@ -66,6 +66,30 @@ export function mockInputMethod() { resolve(paramMock.paramBooleanMock); }) } + }, + showSoftKeyboard: function (...args) { + console.warn("InputMethodController.showSoftKeyboard interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } + }, + hideSoftKeyboard: function (...args) { + console.warn("InputMethodController.hideSoftKeyboard interface mocked in the Previewer. How this interface works on" + + " the Previewer may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramBooleanMock); + } else { + return new Promise((resolve, reject) => { + resolve(paramMock.paramBooleanMock); + }) + } } } const InputMethodSettingMock = {