1<!DOCTYPE HTML> 2<html> 3<script src='test.js'></script> 4<script src='is_option_element_toggleable.js'></script> 5<script> 6 7function testNonoptionElement() { 8 try { 9 isOptionElementToggleable(document.getElementById("s")); 10 assert(false); 11 } catch (error) { 12 assert(error.message); 13 assertEquals('element is not an option', error.message); 14 } 15} 16 17function testOptionNotInSelect() { 18 try { 19 isOptionElementToggleable(document.getElementById("b")); 20 assert(false); 21 } catch (error) { 22 assert(error.message); 23 assertEquals('option element is not in a select', error.message); 24 } 25} 26 27function testTogglable() { 28 document.getElementById("s").multiple = 'multiple'; 29 assert(isOptionElementToggleable(document.getElementById("a"))); 30} 31 32function testNotTogglable() { 33 document.getElementById("s").multiple = ''; 34 assert(!isOptionElementToggleable(document.getElementById("a"))); 35} 36 37</script> 38<body> 39 <select id="s"> 40 <option id="a">a</option> 41 </select> 42 <option id = "b">b</option> 43</body> 44</html> 45