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

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

mercurial