browser/metro/base/tests/mochitest/browser_inputsource.js

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 // -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 "use strict";
michael@0 7
michael@0 8 /*=============================================================================
michael@0 9 Test cases
michael@0 10 =============================================================================*/
michael@0 11
michael@0 12 function test() {
michael@0 13 runTests();
michael@0 14 }
michael@0 15
michael@0 16 function setUp() {
michael@0 17 yield addTab("about:blank");
michael@0 18 }
michael@0 19
michael@0 20 function testState(aState) {
michael@0 21 let bcastValue = document.getElementById("bcast_preciseInput").getAttribute("input");
michael@0 22 is(bcastValue, aState, "bcast attribute is " + aState);
michael@0 23
michael@0 24 if (aState == "precise") {
michael@0 25 ok(InputSourceHelper.isPrecise, "InputSourceHelper");
michael@0 26 let uri = Util.makeURI("chrome://browser/content/cursor.css");
michael@0 27 ok(!StyleSheetSvc.sheetRegistered(uri, Ci.nsIStyleSheetService.AGENT_SHEET), "cursor stylesheet registered");
michael@0 28 } else {
michael@0 29 ok(!InputSourceHelper.isPrecise, "InputSourceHelper");
michael@0 30 let uri = Util.makeURI("chrome://browser/content/cursor.css");
michael@0 31 ok(StyleSheetSvc.sheetRegistered(uri, Ci.nsIStyleSheetService.AGENT_SHEET), "cursor stylesheet registered");
michael@0 32 }
michael@0 33 }
michael@0 34
michael@0 35
michael@0 36 gTests.push({
michael@0 37 desc: "precise/imprecise input switcher",
michael@0 38 setUp: setUp,
michael@0 39 run: function () {
michael@0 40 notifyPrecise();
michael@0 41 testState("precise");
michael@0 42 notifyImprecise();
michael@0 43 testState("imprecise");
michael@0 44 notifyPrecise();
michael@0 45 testState("precise");
michael@0 46 notifyImprecise();
michael@0 47 testState("imprecise");
michael@0 48 }
michael@0 49 });
michael@0 50

mercurial