Logo
doctype [?]
[strict] [loose] [none]

Selectbox Utility Functions


These test cases setup select elements in one state, then use calls to the Selectbox object to modify their state, then verify that those changes were done successfully. Successful tests will be green, unsuccessful tests will be red.

Selectbox.hasOptions

Test Case #1 [test alone]

Test #1 : Selectbox.hasOptions(document.forms['tests'].elements['hasOptions2'])

Selectbox.selectOptions

Test Case #2 [test alone]

Test #2 : document.forms['tests'].elements['selectOptions1'].selectedIndex==2 Test Case #3 [test alone]

Test #3 : document.forms['tests'].elements['selectOptions2'].selectedIndex==4 Test Case #4 [test alone]

Test #4 : document.forms['tests'].elements['selectOptions3'].options[0].selected==false Test #5 : document.forms['tests'].elements['selectOptions3'].options[1].selected==true Test #6 : document.forms['tests'].elements['selectOptions3'].options[2].selected==true Test #7 : document.forms['tests'].elements['selectOptions3'].options[3].selected==true Test #8 : document.forms['tests'].elements['selectOptions3'].options[4].selected==false

Selectbox.selectOnlyOptions

Test Case #5 [test alone]

Test #9 : document.forms['tests'].elements['selectOnlyOptions1'].options[0].selected==false Test #10 : document.forms['tests'].elements['selectOnlyOptions1'].options[1].selected==false Test #11 : document.forms['tests'].elements['selectOnlyOptions1'].options[2].selected==true Test #12 : document.forms['tests'].elements['selectOnlyOptions1'].options[3].selected==false Test #13 : document.forms['tests'].elements['selectOnlyOptions1'].options[4].selected==false Test Case #6 [test alone]

Test #14 : document.forms['tests'].elements['selectOnlyOptions2'].options[0].selected==false Test #15 : document.forms['tests'].elements['selectOnlyOptions2'].options[1].selected==false Test #16 : document.forms['tests'].elements['selectOnlyOptions2'].options[2].selected==false Test #17 : document.forms['tests'].elements['selectOnlyOptions2'].options[3].selected==false Test #18 : document.forms['tests'].elements['selectOnlyOptions2'].options[4].selected==true Test Case #7 [test alone]

Test #19 : document.forms['tests'].elements['selectOnlyOptions3'].options[0].selected==false Test #20 : document.forms['tests'].elements['selectOnlyOptions3'].options[1].selected==true Test #21 : document.forms['tests'].elements['selectOnlyOptions3'].options[2].selected==true Test #22 : document.forms['tests'].elements['selectOnlyOptions3'].options[3].selected==true Test #23 : document.forms['tests'].elements['selectOnlyOptions3'].options[4].selected==false

Selectbox.unselectOptions

Test Case #8 [test alone]

Test #24 : document.forms['tests'].elements['unselectOptions1'].options[0].selected==false Test #25 : document.forms['tests'].elements['unselectOptions1'].options[1].selected==false Test #26 : document.forms['tests'].elements['unselectOptions1'].options[2].selected==false Test #27 : document.forms['tests'].elements['unselectOptions1'].options[3].selected==false Test #28 : document.forms['tests'].elements['unselectOptions1'].options[4].selected==false Test Case #9 [test alone]

Test #29 : document.forms['tests'].elements['unselectOptions2'].options[0].selected==false Test #30 : document.forms['tests'].elements['unselectOptions2'].options[1].selected==true Test #31 : document.forms['tests'].elements['unselectOptions2'].options[2].selected==false Test #32 : document.forms['tests'].elements['unselectOptions2'].options[3].selected==true Test #33 : document.forms['tests'].elements['unselectOptions2'].options[4].selected==false Test Case #10 [test alone]

Test #34 : document.forms['tests'].elements['unselectOptions3'].options[0].selected==true Test #35 : document.forms['tests'].elements['unselectOptions3'].options[1].selected==false Test #36 : document.forms['tests'].elements['unselectOptions3'].options[2].selected==false Test #37 : document.forms['tests'].elements['unselectOptions3'].options[3].selected==false Test #38 : document.forms['tests'].elements['unselectOptions3'].options[4].selected==true

Selectbox.sort

Test Case #11 [test alone]

Test #39 : document.forms['tests'].elements['sort1'].options[0].value=='a1' Test #40 : document.forms['tests'].elements['sort1'].options[1].value=='a2' Test #41 : document.forms['tests'].elements['sort1'].options[2].value=='a3' Test #42 : document.forms['tests'].elements['sort1'].options[3].value=='a4' Test #43 : document.forms['tests'].elements['sort1'].options[4].value=='a5' Test Case #12 [test alone]

Test #44 : document.forms['tests'].elements['sort2'].options[0].value=='Adam' Test #45 : document.forms['tests'].elements['sort2'].options[1].value=='Brian' Test #46 : document.forms['tests'].elements['sort2'].options[2].value=='Chad' Test #47 : document.forms['tests'].elements['sort2'].options[3].value=='David' Test #48 : document.forms['tests'].elements['sort2'].options[4].value=='Ethan'

Selectbox.selectAllOptions

Test Case #13 [test alone]

Test #49 : document.forms['tests'].elements['selectAllOptions1'].options[0].selected==true Test #50 : document.forms['tests'].elements['selectAllOptions1'].options[1].selected==true Test #51 : document.forms['tests'].elements['selectAllOptions1'].options[2].selected==true Test #52 : document.forms['tests'].elements['selectAllOptions1'].options[3].selected==true Test #53 : document.forms['tests'].elements['selectAllOptions1'].options[4].selected==true

Selectbox.moveSelectedOptions

Test Case #14 [test alone]

Test #54 : document.forms['tests'].elements['moveSelectedOptions1'].options.length==2 Test #55 : document.forms['tests'].elements['moveSelectedOptions1'].options[0].value=='option1' Test #56 : document.forms['tests'].elements['moveSelectedOptions1'].options[1].value=='option3' Test #57 : document.forms['tests'].elements['moveSelectedOptions12'].options.length==2 Test #58 : document.forms['tests'].elements['moveSelectedOptions12'].options[0].value=='option2' Test #59 : document.forms['tests'].elements['moveSelectedOptions12'].options[1].value=='option3' Test Case #15 [test alone]

Test #60 : document.forms['tests'].elements['moveSelectedOptions2'].options.length==2 Test #61 : document.forms['tests'].elements['moveSelectedOptions2'].options[0].value=='option3' Test #62 : document.forms['tests'].elements['moveSelectedOptions2'].options[1].value=='option1' Test #63 : document.forms['tests'].elements['moveSelectedOptions22'].options.length==2 Test #64 : document.forms['tests'].elements['moveSelectedOptions22'].options[0].value=='option3' Test #65 : document.forms['tests'].elements['moveSelectedOptions22'].options[1].value=='option2' Test Case #16 [test alone]

Test #66 : document.forms['tests'].elements['moveSelectedOptions3'].options.length==2 Test #67 : document.forms['tests'].elements['moveSelectedOptions3'].options[0].value=='option3' Test #68 : document.forms['tests'].elements['moveSelectedOptions3'].options[1].value=='option1' Test #69 : document.forms['tests'].elements['moveSelectedOptions32'].options.length==2 Test #70 : document.forms['tests'].elements['moveSelectedOptions32'].options[0].value=='option3' Test #71 : document.forms['tests'].elements['moveSelectedOptions32'].options[1].value=='option2'

Selectbox.copySelectedOptions

Test Case #17 [test alone]

Test #72 : document.forms['tests'].elements['copySelectedOptions1'].options.length==3 Test #73 : document.forms['tests'].elements['copySelectedOptions12'].options.length==2 Test #74 : document.forms['tests'].elements['copySelectedOptions12'].options[0].value=='option2' Test #75 : document.forms['tests'].elements['copySelectedOptions12'].options[1].value=='option3' Test Case #18 [test alone]

Test #76 : document.forms['tests'].elements['copySelectedOptions2'].options.length==3 Test #77 : document.forms['tests'].elements['copySelectedOptions22'].options.length==2 Test #78 : document.forms['tests'].elements['copySelectedOptions22'].options[0].value=='option3' Test #79 : document.forms['tests'].elements['copySelectedOptions22'].options[1].value=='option2' Test Case #19 [test alone]

Test #80 : document.forms['tests'].elements['copySelectedOptions3'].options.length==3 Test #81 : document.forms['tests'].elements['copySelectedOptions32'].options.length==3 Test #82 : document.forms['tests'].elements['copySelectedOptions32'].options[0].value=='option3' Test #83 : document.forms['tests'].elements['copySelectedOptions32'].options[1].value=='option2' Test #84 : document.forms['tests'].elements['copySelectedOptions32'].options[2].value=='option1'

Selectbox.moveAllOptions

Test Case #20 [test alone]

Test #85 : document.forms['tests'].elements['moveAllOptions1'].options.length==0 Test #86 : document.forms['tests'].elements['moveAllOptions12'].options.length==4 Test #87 : document.forms['tests'].elements['moveAllOptions12'].options[0].value=='option1' Test #88 : document.forms['tests'].elements['moveAllOptions12'].options[1].value=='option2' Test #89 : document.forms['tests'].elements['moveAllOptions12'].options[2].value=='option3' Test #90 : document.forms['tests'].elements['moveAllOptions12'].options[3].value=='option3' Test Case #21 [test alone]

Test #91 : document.forms['tests'].elements['moveAllOptions2'].options.length==0 Test #92 : document.forms['tests'].elements['moveAllOptions22'].options.length==4 Test #93 : document.forms['tests'].elements['moveAllOptions22'].options[0].value=='option3' Test #94 : document.forms['tests'].elements['moveAllOptions22'].options[1].value=='option3' Test #95 : document.forms['tests'].elements['moveAllOptions22'].options[2].value=='option2' Test #96 : document.forms['tests'].elements['moveAllOptions22'].options[3].value=='option1' Test Case #22 [test alone]

Test #97 : document.forms['tests'].elements['moveAllOptions3'].options.length==1 Test #98 : document.forms['tests'].elements['moveAllOptions32'].options.length==3 Test #99 : document.forms['tests'].elements['moveAllOptions3'].options[0].value=='option1' Test #100 : document.forms['tests'].elements['moveAllOptions32'].options[0].value=='option2' Test #101 : document.forms['tests'].elements['moveAllOptions32'].options[1].value=='option3' Test #102 : document.forms['tests'].elements['moveAllOptions32'].options[2].value=='option3'

Selectbox.copyAllOptions

Test Case #23 [test alone]

Test #103 : document.forms['tests'].elements['copyAllOptions1'].options.length==3 Test #104 : document.forms['tests'].elements['copyAllOptions12'].options.length==3 Test #105 : document.forms['tests'].elements['copyAllOptions1'].options[0].value=='option3' Test #106 : document.forms['tests'].elements['copyAllOptions12'].options[0].value=='option1' Test #107 : document.forms['tests'].elements['copyAllOptions12'].options[1].value=='option2' Test #108 : document.forms['tests'].elements['copyAllOptions12'].options[2].value=='option3' Test Case #24 [test alone]

Test #109 : document.forms['tests'].elements['copyAllOptions2'].options.length==3 Test #110 : document.forms['tests'].elements['copyAllOptions22'].options.length==3 Test #111 : document.forms['tests'].elements['copyAllOptions2'].options[0].value=='option3' Test #112 : document.forms['tests'].elements['copyAllOptions22'].options[0].value=='option3' Test #113 : document.forms['tests'].elements['copyAllOptions22'].options[1].value=='option2' Test #114 : document.forms['tests'].elements['copyAllOptions22'].options[2].value=='option1'

Selectbox.swapOptions

Test Case #25 [test alone]

Test #115 : !Selectbox.swapOptions(document.forms['tests'].elements['swapOptions1'],-1,1) Test #116 : !Selectbox.swapOptions(document.forms['tests'].elements['swapOptions1'],0,5) Test #117 : document.forms['tests'].elements['swapOptions1'].options[0].value=='option2' Test #118 : document.forms['tests'].elements['swapOptions1'].options[1].value=='option3' Test #119 : document.forms['tests'].elements['swapOptions1'].options[0].value=='option1' Test #120 : document.forms['tests'].elements['swapOptions1'].options[1].value=='option3'

Selectbox.moveOptionUp

Test Case #26 [test alone]

Test #121 : document.forms['tests'].elements['moveOptionUp1'].options[1].value=='option1' Test #122 : document.forms['tests'].elements['moveOptionUp1'].options[2].value=='option2' Test #123 : document.forms['tests'].elements['moveOptionUp1'].options[0].value=='option1' Test #124 : document.forms['tests'].elements['moveOptionUp1'].options[1].value=='option3' Test Case #27 [test alone]

Test #125 : document.forms['tests'].elements['moveOptionUp2'].options[0].value=='option2' Test #126 : document.forms['tests'].elements['moveOptionUp2'].options[1].value=='option3' Test #127 : document.forms['tests'].elements['moveOptionUp2'].options[2].value=='option1' Test #128 : document.forms['tests'].elements['moveOptionUp2'].options[3].value=='option5' Test #129 : document.forms['tests'].elements['moveOptionUp2'].options[4].value=='option4' Test #130 : document.forms['tests'].elements['moveOptionUp2'].options[0].value=='option2' Test #131 : document.forms['tests'].elements['moveOptionUp2'].options[1].value=='option3' Test #132 : document.forms['tests'].elements['moveOptionUp2'].options[2].value=='option5' Test #133 : document.forms['tests'].elements['moveOptionUp2'].options[3].value=='option1' Test #134 : document.forms['tests'].elements['moveOptionUp2'].options[4].value=='option4'

Selectbox.moveOptionDown

Test Case #28 [test alone]

Test #135 : document.forms['tests'].elements['moveOptionDown1'].options[0].value=='option2' Test #136 : document.forms['tests'].elements['moveOptionDown1'].options[1].value=='option3' Test #137 : document.forms['tests'].elements['moveOptionDown1'].options[1].value=='option1' Test #138 : document.forms['tests'].elements['moveOptionDown1'].options[2].value=='option3' Test Case #29 [test alone]

Test #139 : document.forms['tests'].elements['moveOptionDown2'].options[0].value=='option1' Test #140 : document.forms['tests'].elements['moveOptionDown2'].options[1].value=='option4' Test #141 : document.forms['tests'].elements['moveOptionDown2'].options[2].value=='option2' Test #142 : document.forms['tests'].elements['moveOptionDown2'].options[3].value=='option3' Test #143 : document.forms['tests'].elements['moveOptionDown2'].options[4].value=='option5'

Selectbox.removeSelectedOptions

Test Case #30 [test alone]

Test #144 : document.forms['tests'].elements['removeSelectedOptions1'].options.length==2 Test #145 : document.forms['tests'].elements['removeSelectedOptions1'].options[0].value=='option2' Test #146 : document.forms['tests'].elements['removeSelectedOptions1'].options[1].value=='option3' Test Case #31 [test alone]

Test #147 : document.forms['tests'].elements['removeSelectedOptions2'].options.length==2 Test #148 : document.forms['tests'].elements['removeSelectedOptions2'].options[0].value=='option1' Test #149 : document.forms['tests'].elements['removeSelectedOptions2'].options[1].value=='option4' Test Case #32 [test alone]

Test #150 : !Selectbox.removeSelectedOptions(document.forms['tests'].elements['removeSelectedOptions3'])

Selectbox.removeAllOptions

Test Case #33 [test alone]

Test #151 : document.forms['tests'].elements['removeAllOptions1'].options.length==0