content/base/test/test_bug346485.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=346485
     5 -->
     6 <head>
     7   <title>Test for Bug 346485</title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    10 </head>
    11 <body>
    12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=346485">Mozilla Bug 346485</a>
    13 <p id="display"></p>
    14 <div id="content" style="display: none">
    15   <input id='a'>
    16   <input id='b'>
    17   <output id='o' for='a b'></output>
    18 </div>
    19 <pre id="test">
    20 <script type="application/javascript">
    22 /** Test for Bug 346485 **/
    24 /**
    25  * This test is testing DOMSettableTokenList used by the output element.
    26  */
    28 var o = document.getElementById('o');
    30 is(o.htmlFor, 'a b',
    31   "htmlFor IDL attribute should reflect for content attribute");
    33 is(o.htmlFor.value, 'a b',
    34   "value should return the underlying string");
    36 is(o.htmlFor.length, 2, "Size should be '2'");
    38 ok(o.htmlFor.contains('a'), "It should contain 'a' token'");
    39 ok(!o.htmlFor.contains('c'), "It should not contain 'c' token");
    41 is(o.htmlFor.item(0), 'a', "First item is 'a' token'");
    42 is(o.htmlFor.item(42), null, "Out-of-range should return null");
    44 o.htmlFor.add('c');
    45 is(o.htmlFor, 'a b c', "'c' token should have been added");
    46 is(o.htmlFor.length, 3, "Size should be '3'");
    48 o.htmlFor.add('a');
    49 is(o.htmlFor, 'a b c', "Nothing should have changed");
    50 is(o.htmlFor.length, 3, "Size should be '3'");
    52 o.htmlFor.remove('a');
    53 is(o.htmlFor, 'b c', "'a' token should have been removed");
    54 is(o.htmlFor.length, 2, "Size should be '2'");
    56 o.htmlFor.remove('d');
    57 is(o.htmlFor, 'b c', "Nothing should have been removed");
    58 is(o.htmlFor.length, 2, "Size should be '2'");
    60 o.htmlFor.toggle('a');
    61 is(o.htmlFor, 'b c a', "'a' token should have been added");
    62 is(o.htmlFor.length, 3, "Size should be '3'");
    64 o.htmlFor.toggle('b');
    65 is(o.htmlFor, 'c a', "Nothing should have changed");
    66 is(o.htmlFor.length, 2, "Size should be '2'");
    68 o.htmlFor.value = "foo bar";
    69 is(o.htmlFor, 'foo bar', "The underlying string should have changed");
    70 is(o.htmlFor.length, 2, "Size should be '2'");
    71 ok(o.htmlFor.contains('foo'), "It should contain 'foo'");
    73 </script>
    74 </pre>
    75 </body>
    76 </html>

mercurial