| <!DOCTYPE HTML> |
| <html> |
| <script src='test.js'></script> |
| <script src='is_option_element_toggleable.js'></script> |
| <script> |
| |
| function testNonoptionElement() { |
| try { |
| isOptionElementToggleable(document.getElementById("s")); |
| assert(false); |
| } catch (error) { |
| assert(error.message); |
| assertEquals('element is not an option', error.message); |
| } |
| } |
| |
| function testOptionNotInSelect() { |
| try { |
| isOptionElementToggleable(document.getElementById("b")); |
| assert(false); |
| } catch (error) { |
| assert(error.message); |
| assertEquals('option element is not in a select', error.message); |
| } |
| } |
| |
| function testTogglable() { |
| document.getElementById("s").multiple = 'multiple'; |
| assert(isOptionElementToggleable(document.getElementById("a"))); |
| } |
| |
| function testNotTogglable() { |
| document.getElementById("s").multiple = ''; |
| assert(!isOptionElementToggleable(document.getElementById("a"))); |
| } |
| |
| </script> |
| <body> |
| <select id="s"> |
| <option id="a">a</option> |
| </select> |
| <option id = "b">b</option> |
| </body> |
| </html> |