1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/content/tests/chrome/test_bug365773.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,67 @@ 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 +https://bugzilla.mozilla.org/show_bug.cgi?id=365773 1.9 +--> 1.10 +<window title="Mozilla Bug 365773" 1.11 + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 1.12 + 1.13 + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.14 + 1.15 +<body xmlns="http://www.w3.org/1999/xhtml"> 1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=365773">Mozilla Bug 365773</a> 1.17 +<p id="display"> 1.18 + <radiogroup id="group" collapsed="true" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 1.19 + <radio id="item" label="Item"/> 1.20 + </radiogroup> 1.21 +</p> 1.22 +<div id="content" style="display: none"> 1.23 +</div> 1.24 +<pre id="test"> 1.25 +</pre> 1.26 +</body> 1.27 + 1.28 +<script class="testbody" type="application/javascript"> 1.29 +<![CDATA[ 1.30 + 1.31 +/** Test for Bug 365773 **/ 1.32 + 1.33 +function selectItem(item, isIndex, testName) { 1.34 + var exception = null; 1.35 + try { 1.36 + if (isIndex) 1.37 + document.getElementById("group").selectedIndex = item; 1.38 + else 1.39 + document.getElementById("group").selectedItem = item; 1.40 + } 1.41 + catch(e) { 1.42 + exception = e; 1.43 + } 1.44 + 1.45 + ok(exception == null, testName); 1.46 +} 1.47 + 1.48 +SimpleTest.waitForExplicitFinish(); 1.49 + 1.50 +window.onload = function runTests() { 1.51 + var item = document.getElementById("item"); 1.52 + 1.53 + selectItem(item, false, "Radio button selected with selectedItem (not focused)"); 1.54 + selectItem(null, false, "Radio button deselected with selectedItem (not focused)"); 1.55 + selectItem(0, true, "Radio button selected with selectedIndex (not focused)"); 1.56 + selectItem(-1, true, "Radio button deselected with selectedIndex (not focused)"); 1.57 + 1.58 + document.getElementById("group").focus(); 1.59 + 1.60 + selectItem(item, false, "Radio button selected with selectedItem (focused)"); 1.61 + selectItem(null, false, "Radio button deselected with selectedItem (focused)"); 1.62 + selectItem(0, true, "Radio button selected with selectedIndex (focused)"); 1.63 + selectItem(-1, true, "Radio button deselected with selectedIndex (focused)"); 1.64 + 1.65 + SimpleTest.finish(); 1.66 +}; 1.67 +]]> 1.68 +</script> 1.69 + 1.70 +</window>