VulpesOS/gaia/apps/settings/test/marionette/app/regions/keyboard.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

62 lines
1.6 KiB
JavaScript
Executable file

'use strict';
var Base = require('../base');
/**
* Abstraction around settings keyboard panel
* @constructor
* @param {Marionette.Client} client for operations.
*/
function KeyboardPanel(client) {
// Call the Base constructor to initiate base class.
Base.call(this, client, null, KeyboardPanel.Selectors);
}
module.exports = KeyboardPanel;
KeyboardPanel.Selectors = {
keyboardList: '.allKeyboardList li',
header: '#keyboard gaia-header',
panel: '#keyboard',
selectKeyboards: '#keyboard a[href="#keyboard-selection-addMore"]',
builtinKeyboardList: '#keyboard-selection-addMore .keyboardAppContainer ul',
backButton: '#keyboard-selection-addMore gaia-header'
};
KeyboardPanel.prototype = {
__proto__: Base.prototype,
get header() {
return this.findElement('header');
},
tapBuiltInKeyboardItem: function() {
this.waitForElement('keyboardList').tap();
},
tapSelectKeyboards: function() {
this.waitForElement('selectKeyboards').tap();
},
selectLayout: function(layoutLabel) {
var builtinKeyboardList = this.waitForElement('builtinKeyboardList');
var layout = builtinKeyboardList.scriptWith(function(list, layoutLabel) {
var langs = list.querySelectorAll('bdi');
return [].filter.call(langs, function(lang) {
return (lang.innerHTML === layoutLabel);
})[0];
}, [layoutLabel]);
layout.tap();
},
tapBackButton: function() {
var header = this.waitForElement('backButton');
header.tap(25, 25);
},
isDialog: function() {
var dialogAttribute =
this.findElement('panel').getAttribute('data-dialog');
return dialogAttribute === 'true';
}
};