accessible/tests/mochitest/events/test_valuechange.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 <html>
     3 <head>
     4   <title>Accessible value change events testing</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>
    19   <script type="application/javascript"
    20           src="../value.js"></script>
    22   <script type="application/javascript">
    25     /**
    26      * Do tests.
    27      */
    28     var gQueue = null;
    30     // Value change invoker
    31     function changeARIAValue(aNodeOrID, aValuenow, aValuetext)
    32     {
    33       this.DOMNode = getNode(aNodeOrID);
    35       this.invoke = function changeARIAValue_invoke() {
    37         // Note: this should not fire an EVENT_VALUE_CHANGE when aria-valuetext
    38         // is not empty
    39         if (aValuenow != undefined)
    40           this.DOMNode.setAttribute("aria-valuenow", aValuenow);
    42         // Note: this should always fire an EVENT_VALUE_CHANGE
    43         if (aValuetext != undefined)
    44           this.DOMNode.setAttribute("aria-valuetext", aValuetext);
    45       }
    47       this.check = function changeARIAValue_check() {
    48         var acc = getAccessible(aNodeOrID, [nsIAccessibleValue]);
    49         if (!acc)
    50           return;
    52         // Note: always test against valuetext first because the existence of 
    53         // aria-valuetext takes precedence over aria-valuenow in gecko.
    54         is(acc.value, (aValuetext != undefined)? aValuetext : aValuenow,
    55             "Wrong value of " + prettyName(aNodeOrID));
    56       }
    58       this.getID = function changeARIAValue_getID() {
    59         return prettyName(aNodeOrID) + " value changed";
    60       }
    61     }
    63     function changeValue(aID, aValue)
    64     {
    65       this.DOMNode = getNode(aID);
    67       this.invoke = function changeValue_invoke()
    68       {
    69         this.DOMNode.value = aValue;
    70       }
    72       this.check = function changeValue_check()
    73       {
    74         var acc = getAccessible(this.DOMNode);
    75         is(acc.value, aValue, "Wrong value for " + prettyName(aID));
    76       }
    78       this.getID = function changeValue_getID()
    79       {
    80         return prettyName(aID) + " value changed";
    81       }
    82     }
    84     function changeProgressValue(aID, aValue)
    85     {
    86       this.DOMNode = getNode(aID);
    88       this.invoke = function changeProgressValue_invoke()
    89       {
    90          this.DOMNode.value = aValue;
    91       }
    93       this.check = function changeProgressValue_check()
    94       {
    95         var acc = getAccessible(this.DOMNode);
    96         is(acc.value, aValue+"%", "Wrong value for " + prettyName(aID));
    97       }
    99       this.getID = function changeProgressValue_getID()
   100       {
   101         return prettyName(aID) + " value changed";
   102       }
   103     }
   105     function changeRangeValue(aID)
   106     {
   107       this.DOMNode = getNode(aID);
   109       this.invoke = function changeRangeValue_invoke()
   110       {
   111         synthesizeMouse(getNode(aID), 5, 5, { });
   112       }
   114       this.finalCheck = function changeRangeValue_finalCheck()
   115       {
   116         var acc = getAccessible(this.DOMNode);
   117         is(acc.value, "0", "Wrong value for " + prettyName(aID));
   118       }
   120       this.getID = function changeRangeValue_getID()
   121       {
   122         return prettyName(aID) + " range value changed";
   123       }
   124     }
   126     function doTests()
   127     {
   128       // Test initial values
   129       testValue("slider_vn", "5", 5, 0, 1000, 0);
   130       testValue("slider_vnvt", "plain", 0, 0, 5, 0);
   131       testValue("slider_vt", "hi", 0, 0, 3, 0);
   132       testValue("scrollbar", "5", 5, 0, 1000, 0);
   133       testValue("progress", "22%", 22, 0, 100, 0);
   134       testValue("range", "6", 6, 0, 10, 1);
   136       // Test value change events
   137       gQueue = new eventQueue(nsIAccessibleEvent.EVENT_VALUE_CHANGE);
   139       gQueue.push(new changeARIAValue("slider_vn", "6", undefined));
   140       gQueue.push(new changeARIAValue("slider_vt", undefined, "hey!"));
   141       gQueue.push(new changeARIAValue("slider_vnvt", "3", "sweet"));
   142       gQueue.push(new changeARIAValue("scrollbar", "6", undefined));
   144       gQueue.push(new changeValue("combobox", "hello"));
   146       gQueue.push(new changeProgressValue("progress", "50"));
   147       gQueue.push(new changeRangeValue("range"));
   149       gQueue.invoke(); // Will call SimpleTest.finish();
   150     }
   152     SimpleTest.waitForExplicitFinish();
   153     addA11yLoadEvent(doTests);
   154   </script>
   155 </head>
   157 <body>
   159   <a target="_blank"
   160      href="https://bugzilla.mozilla.org/show_bug.cgi?id=478032"
   161      title=" Fire delayed value changed event for aria-valuetext changes">
   162     Mozilla Bug 478032
   163   </a>
   164   <a target="_blank"
   165     href="https://bugzilla.mozilla.org/show_bug.cgi?id=529289"
   166     title="We dont expose new aria role 'scrollbar' and property aria-orientation">
   167    Mozilla Bug 529289
   168   </a>
   169   <a target="_blank"
   170     href="https://bugzilla.mozilla.org/show_bug.cgi?id=559764"
   171     title="Make HTML5 input@type=range element accessible">
   172    Mozilla Bug 559764
   173   </a>
   174   <a target="_blank"
   175     href="https://bugzilla.mozilla.org/show_bug.cgi?id=703202"
   176     title="ARIA comboboxes don't fire value change events">
   177    Mozilla Bug 703202
   178   </a>
   179   <a target="_blank"
   180     href="https://bugzilla.mozilla.org/show_bug.cgi?id=761901"
   181     title=" HTML5 progress accessible should fire value change event">
   182    Mozilla Bug 761901
   183   </a>
   186   <p id="display"></p>
   187   <div id="content" style="display: none"></div>
   188   <pre id="test">
   189   </pre>
   190   <div id="eventdump"></div>
   192   <!-- ARIA sliders -->
   193   <div id="slider_vn" role="slider" aria-valuenow="5"
   194        aria-valuemin="0" aria-valuemax="1000">slider</div>
   196   <div id="slider_vt" role="slider" aria-valuetext="hi"
   197        aria-valuemin="0" aria-valuemax="3">greeting slider</div>
   199   <div id="slider_vnvt" role="slider" aria-valuenow="0" aria-valuetext="plain"
   200        aria-valuemin="0" aria-valuemax="5">sweetness slider</div>
   202   <!-- ARIA scrollbar -->
   203   <div id="scrollbar" role="scrollbar" aria-valuenow="5"
   204        aria-valuemin="0" aria-valuemax="1000">slider</div>
   206   <!-- ARIA combobox -->
   207   <input id="combobox" role="combobox" aria-autocomplete="inline">
   209   <!-- progress bar -->
   210   <progress id="progress" value="22" max="100"></progress>
   212   <!-- input@type="range" -->
   213   <input type="range" id="range" min="0" max="10" value="6">
   215 </body>
   216 </html>

mercurial