accessible/tests/mochitest/events/test_attrs.html

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 <html>
     3 <head>
     4   <title>Event object attributes tests</title>
     6   <link rel="stylesheet" type="text/css"
     7         href="chrome://mochikit/content/tests/SimpleTest/test.css" />
     9   <script type="application/javascript"
    10           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    11   <script type="application/javascript"
    12           src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
    14   <script type="application/javascript"
    15           src="../common.js"></script>
    16   <script type="application/javascript"
    17           src="../events.js"></script>
    18   <script type="application/javascript"
    19           src="../attributes.js"></script>
    21   <script type="application/javascript">
    23     /**
    24      * Test "event-from-input" object attribute.
    25      */
    26     function eventFromInputChecker(aEventType, aID, aValue, aNoTargetID)
    27     {
    28       this.type = aEventType;
    29       this.target = getAccessible(aID);
    31       this.noTarget = getNode(aNoTargetID);
    33       this.check = function checker_check(aEvent)
    34       {
    35         testAttrs(aEvent.accessible, { "event-from-input": aValue }, true);
    37         var accessible = getAccessible(this.noTarget);
    38         testAbsentAttrs(accessible, { "event-from-input": "" });
    39       }
    40     }
    42     /**
    43      * Do tests.
    44      */
    45     var gQueue = null;
    47     // gA11yEventDumpID = "eventdump"; // debug stuff
    48     //gA11yEventDumpToConsole = true; // debug stuff
    50     function doTests()
    51     {
    52       gQueue = new eventQueue();
    54       var id = "textbox", noTargetId = "textarea";
    55       var checker =
    56         new eventFromInputChecker(EVENT_FOCUS, id, "false", noTargetId);
    57       gQueue.push(new synthFocus(id, checker));
    59       if (!MAC) { // Mac failure is bug 541093
    60         var checker =
    61           new eventFromInputChecker(EVENT_TEXT_CARET_MOVED, id, "true", noTargetId);
    62         gQueue.push(new synthHomeKey(id, checker));
    63       }
    65       gQueue.invoke(); // Will call SimpleTest.finish();
    66     }
    68     SimpleTest.waitForExplicitFinish();
    69     addA11yLoadEvent(doTests);
    70   </script>
    71 </head>
    73 <body>
    75   <a target="_blank"
    76      href="https://bugzilla.mozilla.org/show_bug.cgi?id=540285"
    77      title="Event object attributes testing">
    78     Mozilla Bug 540285
    79   </a>
    80   <p id="display"></p>
    81   <div id="content" style="display: none"></div>
    82   <pre id="test">
    83   </pre>
    85   <input id="textbox" value="hello">
    86   <textarea id="textarea"></textarea>
    88   <div id="eventdump"></div>
    89 </body>
    90 </html>

mercurial