Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #33132 from raylin/1219678-test-number-keyboard-gi…
Browse files Browse the repository at this point in the history
…j-r2

Bug 1219678 - Impl number keyboard test suite in gij for keyboard app…
  • Loading branch information
raylin committed Nov 30, 2015
2 parents a79edcb + e358d82 commit ddceb5a
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions apps/keyboard/test/marionette/number_keyboard_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/* global suite */

'use strict';

var KeyboardTestApp = require('./lib/keyboard_test_app'),
Keyboard = require('./lib/keyboard'),
assert = require('assert');

marionette('Number keyboard input tests', function() {
var apps = {};
var keyboardTestApp = null;
var keyboard = null;
var client = null;

apps[KeyboardTestApp.ORIGIN] = __dirname + '/keyboardtestapp';

client = marionette.client({
profile: {
apps: apps,
prefs: {
'focusmanager.testmode': true
},
settings: {
'lockscreen.enabled': false,
'ftu.manifestURL': null
}
}
});

setup(function() {
keyboard = new Keyboard(client);

// create a keyboard test app
keyboardTestApp = new KeyboardTestApp(client);
keyboardTestApp.launch();
});

suite('<input type="number"> tests', function() {
setup(function() {
// Switch to test app frame.
keyboardTestApp.switchTo();
keyboardTestApp.numberInput.tap();
// Wait for the keyboard pop up and switch to it
keyboard.switchTo();
});

test('switch to number layout', function() {
client.switchToFrame();

assert.equal(
keyboard.getCurrentKeyboard(), Keyboard.TypeGroupMap.number);
});

test('alphabet should not present on keyboard', function() {
var testAlphabetKey = 'a';

assert.equal(keyboard.isKeyPresent(testAlphabetKey), false);
});

test('Type 1', function() {
var inputString = '1';
keyboard.type(inputString);
keyboardTestApp.switchTo();

assert.equal(
inputString, keyboardTestApp.numberInput.getAttribute('value'));
});
});
});

0 comments on commit ddceb5a

Please sign in to comment.