1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/tests/mochitest/chrome/test_focus_switchbinding.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,57 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> 1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> 1.7 + 1.8 +<window title="Focus Switch Binding Test" 1.9 + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 1.10 + 1.11 + <script type="application/javascript" 1.12 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> 1.13 + 1.14 +<script> 1.15 +SimpleTest.waitForExplicitFinish(); 1.16 + 1.17 +function switchBinding() 1.18 +{ 1.19 + $("box").style.MozBinding = "url(#second)"; 1.20 +} 1.21 +</script> 1.22 + 1.23 +<xbl:bindings xmlns:xbl="http://www.mozilla.org/xbl" 1.24 + xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 1.25 + <xbl:binding id="first"> 1.26 + <xbl:content> 1.27 + <xul:button label="First"/> 1.28 + </xbl:content> 1.29 + <xbl:implementation> 1.30 + <xbl:constructor> 1.31 + document.getAnonymousNodes(this)[0].focus(); 1.32 + setTimeout(switchBinding, 0); 1.33 + </xbl:constructor> 1.34 + </xbl:implementation> 1.35 + </xbl:binding> 1.36 + <xbl:binding id="second"> 1.37 + <xbl:content> 1.38 + <xul:button label="Second"/> 1.39 + </xbl:content> 1.40 + <xbl:implementation> 1.41 + <xbl:constructor> 1.42 + $("after").focus(); 1.43 + </xbl:constructor> 1.44 + </xbl:implementation> 1.45 + </xbl:binding> 1.46 +</xbl:bindings> 1.47 + 1.48 +<box id="box" style="-moz-binding: url(#first)"/> 1.49 +<button id="after" label="After" onfocus="is(document.activeElement, $('after'), 'focus set'); SimpleTest.finish()"/> 1.50 + 1.51 +<body xmlns="http://www.w3.org/1999/xhtml"> 1.52 +<p id="display"> 1.53 +</p> 1.54 +<div id="content" style="display: none"> 1.55 +</div> 1.56 +<pre id="test"> 1.57 +</pre> 1.58 +</body> 1.59 + 1.60 +</window>