File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,33 @@ module Ferrum
118
118
end
119
119
120
120
it "picks option in select by match string argument" do
121
- expect ( browser . at_xpath ( "//*[@id='form_title']" ) . select ( "Miss" ) . value ) . to eq ( "Miss" )
121
+ expect ( browser . at_xpath ( "//*[@id='form_title']" ) . select ( "Miss" ) . selected ) . to eq ( [ "Miss" ] )
122
+ end
123
+
124
+ shared_examples "clears selected options with no exception" do |options |
125
+ it "clears selected options with no exception" do
126
+ expect ( browser . at_xpath ( "//*[@id='form_title']" ) . selected ) . to eq ( [ "Mrs" ] )
127
+ expect ( browser . at_xpath ( "//*[@id='form_title']" ) . select ( options ) . selected ) . to eq ( [ ] )
128
+ end
129
+ end
130
+
131
+ context "when option with provided text does not exist" do
132
+ include_examples "clears selected options with no exception" , "Gotcha"
133
+ end
134
+
135
+ context "when provided empty array" do
136
+ include_examples "clears selected options with no exception" , [ ]
137
+ end
138
+
139
+ context "when provided empty string" do
140
+ include_examples "clears selected options with no exception" , ""
141
+ end
142
+
143
+ context "when one of option with provided texts does not exist" do
144
+ it "picks only existed options with no exception" do
145
+ expect ( browser . at_xpath ( "//*[@id='form_title']" ) . selected ) . to eq ( [ "Mrs" ] )
146
+ expect ( browser . at_xpath ( "//*[@id='form_title']" ) . select ( %w[ Mrs SQL ] ) . selected ) . to eq ( [ "Mrs" ] )
147
+ end
122
148
end
123
149
124
150
context "when select has multiple property" do
You can’t perform that action at this time.
0 commit comments