This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33132 from raylin/1219678-test-number-keyboard-gi…
…j-r2 Bug 1219678 - Impl number keyboard test suite in gij for keyboard app…
- Loading branch information
Showing
1 changed file
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')); | ||
}); | ||
}); | ||
}); |