summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2020-03-24 19:08:35 -0400
committerAndras Timar <andras.timar@collabora.com>2020-03-26 17:57:15 +0100
commitb22c49c555e99f20c377164265b215f57dabbedf (patch)
treed6c743678e30386317a48e7330b14a187e63e09f
parent3c758f5aacaf874e78234e7d3b5d54852946ab6a (diff)
leaflet: shouldAcceptInput -> canAcceptKeyboardInput
Clearer name to differentiate intent from expectation. Change-Id: I74cc4c3bca11782bdd9cf72d6af4534357cefa64 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91016 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Andras Timar <andras.timar@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91128 Tested-by: Andras Timar <andras.timar@collabora.com>
-rw-r--r--cypress_test/integration_tests/common/helper.js4
-rw-r--r--cypress_test/integration_tests/mobile/writer/focus_spec.js2
-rw-r--r--loleaflet/src/control/Control.Toolbar.js2
-rw-r--r--loleaflet/src/layer/marker/TextInput.js2
-rw-r--r--loleaflet/src/map/Map.js8
5 files changed, 10 insertions, 8 deletions
diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js
index 402432bc8..5f9eabdac 100644
--- a/cypress_test/integration_tests/common/helper.js
+++ b/cypress_test/integration_tests/common/helper.js
@@ -63,7 +63,7 @@ function enableEditingMobile() {
// Assert that NO keyboard input is accepted (i.e. keyboard should be HIDDEN).
function assertNoKeyboardInput() {
cy.window().then(win => {
- var acceptInput = win.shouldAcceptInput();
+ var acceptInput = win.canAcceptKeyboardInput();
expect(acceptInput, 'Should accept input').to.equal(false);
});
}
@@ -71,7 +71,7 @@ function assertNoKeyboardInput() {
// Assert that keyboard input is accepted (i.e. keyboard should be VISIBLE).
function assertHaveKeyboardInput() {
cy.window().then(win => {
- var acceptInput = win.shouldAcceptInput();
+ var acceptInput = win.canAcceptKeyboardInput();
expect(acceptInput, 'Should accept input').to.equal(true);
});
}
diff --git a/cypress_test/integration_tests/mobile/writer/focus_spec.js b/cypress_test/integration_tests/mobile/writer/focus_spec.js
index 49fbeae8b..970da0972 100644
--- a/cypress_test/integration_tests/mobile/writer/focus_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/focus_spec.js
@@ -200,7 +200,7 @@ describe('Focus tests', function() {
// .should('be.eq', 'clipboard');
cy.window().then(win => {
- expect(win.shouldAcceptInput(), 'Should accept input').to.equal(true);
+ expect(win.canAcceptKeyboardInput(), 'Should accept input').to.equal(true);
});
});
diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index d6e8ce67d..5a44c8482 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -153,7 +153,7 @@ function onClick(e, id, item, subItem) {
// In the iOS app we don't want clicking on the toolbar to pop up the keyboard.
if (!window.ThisIsTheiOSApp && id !== 'zoomin' && id !== 'zoomout' && id !== 'mobile_wizard' && id !== 'insertion_mobile_wizard') {
- map.focus(map.shouldAcceptInput()); // Maintain same keyboard state.
+ map.focus(map.canAcceptKeyboardInput()); // Maintain same keyboard state.
}
if (item.disabled) {
diff --git a/loleaflet/src/layer/marker/TextInput.js b/loleaflet/src/layer/marker/TextInput.js
index 0495e077c..046a5d808 100644
--- a/loleaflet/src/layer/marker/TextInput.js
+++ b/loleaflet/src/layer/marker/TextInput.js
@@ -189,7 +189,7 @@ L.TextInput = L.Layer.extend({
// Returns true if the last focus was to accept input.
// Used to restore the keyboard.
- shouldAcceptInput: function() {
+ canAcceptKeyboardInput: function() {
return this._acceptInput;
},
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index cc683de13..f8522d1b8 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -333,7 +333,7 @@ L.Map = L.Evented.extend({
// There is no way track the keyboard state
// programmatically, so the next best thing
// is to track what we intended to do.
- window.shouldAcceptInput = function() { return map.shouldAcceptInput(); };
+ window.canAcceptKeyboardInput = function() { return map.canAcceptKeyboardInput(); };
// This is used to extract the text we *intended*
// to put on the clipboard. There is currently
@@ -970,8 +970,10 @@ L.Map = L.Evented.extend({
return document.activeElement === this._textInput.activeElement();
},
- shouldAcceptInput: function() {
- return this._textInput.shouldAcceptInput();
+ // Returns true iff the textarea is enabled and we focused on it.
+ // On mobile, this signifies that the keyboard should be visible.
+ canAcceptKeyboardInput: function() {
+ return this._textInput.canAcceptKeyboardInput();
},
setHelpTarget: function(page) {