accessible/tests/mochitest/treeupdate/test_gencontent.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>Elements with CSS generated content</title>
     6   <link rel="stylesheet" type="text/css"
     7         href="chrome://mochikit/content/tests/SimpleTest/test.css" />
     9   <style>
    10     .gentext:before {
    11       content: "START"
    12     }
    13     .gentext:after {
    14       content: "END"
    15     }
    16   </style>
    18   <script type="application/javascript"
    19           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    21   <script type="application/javascript"
    22           src="../common.js"></script>
    23   <script type="application/javascript"
    24           src="../role.js"></script>
    25   <script type="application/javascript"
    26           src="../events.js"></script>
    28   <script type="application/javascript">
    30     ////////////////////////////////////////////////////////////////////////////
    31     // Invokers
    32     ////////////////////////////////////////////////////////////////////////////
    34     /**
    35      * Insert new node with CSS generated content style applied to container.
    36      */
    37     function insertNodeHavingGenContent(aContainerID)
    38     {
    39       this.containerNode = getNode(aContainerID);
    40       this.container = getAccessible(this.containerNode);
    42       this.eventSeq = [
    43         new invokerChecker(EVENT_SHOW, getFirstChild, this.container),
    44         new invokerChecker(EVENT_REORDER, this.container)
    45       ];
    47       this.invoke = function insertNodeHavingGenContent_invoke()
    48       {
    49         var node = document.createElement("div");
    50         node.textContent = "text";
    51         node.setAttribute("class", "gentext");
    52         this.containerNode.appendChild(node);
    53       }
    55       this.finalCheck = function insertNodeHavingGenContent_finalCheck()
    56       {
    57         var accTree =
    58           { SECTION: [ // container
    59             { SECTION: [ // inserted node
    60               { STATICTEXT: [] }, // :before
    61               { TEXT_LEAF: [] }, // primary text
    62               { STATICTEXT: [] } // :after
    63             ] }
    64           ] };
    65         testAccessibleTree(this.container, accTree);
    66       }
    68       this.getID = function insertNodeHavingGenContent_getID()
    69       {
    70         return "insert node having generated content to " + prettyName(aContainerID);
    71       }
    72     }
    74     /**
    75      * Add CSS generated content to the given node contained by container node.
    76      */
    77     function addGenContent(aContainerID, aNodeID)
    78     {
    79       this.container = getAccessible(aContainerID);
    80       this.node = getNode(aNodeID);
    82       this.eventSeq = [
    83         new invokerChecker(EVENT_HIDE, this.container.firstChild),
    84         new invokerChecker(EVENT_SHOW, getFirstChild, this.container),
    85         new invokerChecker(EVENT_REORDER, this.container)
    86       ];
    88       this.invoke = function addGenContent_invoke()
    89       {
    90         this.node.setAttribute("class", "gentext");
    91       }
    93       this.finalCheck = function insertNodeHavingGenContent_finalCheck()
    94       {
    95         var accTree =
    96           { SECTION: [ // container
    97             { SECTION: [ // inserted node
    98               { STATICTEXT: [] }, // :before
    99               { TEXT_LEAF: [] }, // primary text
   100               { STATICTEXT: [] } // :after
   101             ] }
   102           ] };
   103         testAccessibleTree(this.container, accTree);
   104       }
   106       this.getID = function addGenContent_getID()
   107       {
   108         return "add generated content to" + prettyName(aNodeID);
   109       }
   110     }
   112     /**
   113      * Target getters.
   114      */
   115     function getFirstChild(aAcc)
   116     {
   117       try { return aAcc.getChildAt(0); }
   118       catch (e) { return null; }
   119     }
   121     ////////////////////////////////////////////////////////////////////////////
   122     // Do tests
   123     ////////////////////////////////////////////////////////////////////////////
   125     var gQueue = null;
   126     //gA11yEventDumpID = "eventdump"; // debug stuff
   127     //gA11yEventDumpToConsole = true;
   129     function doTests()
   130     {
   131       gQueue = new eventQueue();
   133       gQueue.push(new insertNodeHavingGenContent("container1"));
   134       gQueue.push(new addGenContent("container2", "container2_child"));
   136       gQueue.invoke(); // Will call SimpleTest.finish();
   137     }
   139     SimpleTest.waitForExplicitFinish();
   140     addA11yLoadEvent(doTests);
   141   </script>
   142 </head>
   144 <body>
   146   <a target="_blank"
   147      href="https://bugzilla.mozilla.org/show_bug.cgi?id=646350"
   148      title="Add a test for dynamic chnages of CSS generated content">
   149     Mozilla Bug 646350</a>
   151   <p id="display"></p>
   152   <div id="content" style="display: none"></div>
   153   <pre id="test">
   154   </pre>
   155   <div id="eventdump"></div>
   157   <div id="container1"></div>
   158   <div id="container2"><div id="container2_child">text</div></div>
   159 </body>
   160 </html>

mercurial