Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
michael@0 | 3 | <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> |
michael@0 | 4 | <!-- |
michael@0 | 5 | XUL Widget Test for deck |
michael@0 | 6 | --> |
michael@0 | 7 | <window title="Deck Test" |
michael@0 | 8 | onload="setTimeout(test_deck, 0);" |
michael@0 | 9 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 10 | <script type="application/javascript" |
michael@0 | 11 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 12 | <script type="application/javascript" |
michael@0 | 13 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
michael@0 | 14 | |
michael@0 | 15 | <deck id="deck1" style="padding-top: 5px; padding-bottom: 12px;"> |
michael@0 | 16 | <button id="d1b1" label="Button One"/> |
michael@0 | 17 | <button id="d1b2" label="Button Two is larger" height="80" style="margin: 1px;"/> |
michael@0 | 18 | </deck> |
michael@0 | 19 | <deck id="deck2" selectedIndex="1"> |
michael@0 | 20 | <button id="d2b1" label="Button One"/> |
michael@0 | 21 | <button id="d2b2" label="Button Two"/> |
michael@0 | 22 | </deck> |
michael@0 | 23 | |
michael@0 | 24 | <!-- test results are displayed in the html:body --> |
michael@0 | 25 | <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/> |
michael@0 | 26 | |
michael@0 | 27 | <!-- test code goes here --> |
michael@0 | 28 | <script type="application/javascript"><![CDATA[ |
michael@0 | 29 | |
michael@0 | 30 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 31 | |
michael@0 | 32 | function test_deck() |
michael@0 | 33 | { |
michael@0 | 34 | var deck = $("deck1"); |
michael@0 | 35 | ok(deck.selectedIndex === '0', "deck one selectedIndex"); |
michael@0 | 36 | // this size is the button height, 80, plus the button padding of 1px on each side, |
michael@0 | 37 | // plus the deck's 5px top padding and the 12px bottom padding. |
michael@0 | 38 | var rect = deck.getBoundingClientRect(); |
michael@0 | 39 | is(Math.round(rect.bottom) - Math.round(rect.top), 99, "deck size of largest child"); |
michael@0 | 40 | synthesizeMouseExpectEvent(deck, 12, 12, { }, $("d1b1"), "click", "mouse on deck one"); |
michael@0 | 41 | |
michael@0 | 42 | // change the selected page of the deck and ensure that the mouse click goes |
michael@0 | 43 | // to the button on that page |
michael@0 | 44 | deck.selectedIndex = 1; |
michael@0 | 45 | ok(deck.selectedIndex === '1', "deck one selectedIndex after change"); |
michael@0 | 46 | synthesizeMouseExpectEvent(deck, 9, 9, { }, $("d1b2"), "click", "mouse on deck one after change"); |
michael@0 | 47 | |
michael@0 | 48 | deck = $("deck2"); |
michael@0 | 49 | ok(deck.selectedIndex === '1', "deck two selectedIndex"); |
michael@0 | 50 | synthesizeMouseExpectEvent(deck, 9, 9, { }, $("d2b2"), "click", "mouse on deck two"); |
michael@0 | 51 | |
michael@0 | 52 | SimpleTest.finish(); |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | ]]> |
michael@0 | 56 | </script> |
michael@0 | 57 | |
michael@0 | 58 | </window> |