A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/seleniumhq/selenium/commit/3b691c4fca285c5ca117cb4014e989a6349f4e48 below:

[rb] do not allow Select class to work with disabled selects · SeleniumHQ/selenium@3b691c4 · GitHub

@@ -24,27 +24,27 @@ module WebDriver

24 24

module Support

25 25

describe Select do

26 26

let(:select) do

27 -

select_element = instance_double(Element, tag_name: 'select')

27 +

select_element = instance_double(Element, tag_name: 'select', enabled?: true)

28 28

allow(select_element).to receive(:dom_attribute).with(:multiple)

29 29

select_element

30 30

end

31 31 32 32

let(:multi_select) do

33 -

select_element = instance_double(Element, tag_name: 'select')

33 +

select_element = instance_double(Element, tag_name: 'select', enabled?: true)

34 34

allow(select_element).to receive(:dom_attribute).with(:multiple).and_return 'multiple'

35 35

select_element

36 36

end

37 37 38 38

it 'raises ArgumentError if passed a non-select Element' do

39 -

link = instance_double(Element, tag_name: 'a')

39 +

link = instance_double(Element, tag_name: 'a', enabled?: true)

40 40 41 41

expect {

42 42

Select.new link

43 43

}.to raise_error(ArgumentError)

44 44

end

45 45 46 46

it 'indicates whether a select is multiple correctly' do

47 -

selects = Array.new(4) { instance_double(Element, tag_name: 'select') }

47 +

selects = Array.new(4) { instance_double(Element, tag_name: 'select', enabled?: true) }

48 48 49 49

allow(selects[0]).to receive(:dom_attribute).with(:multiple).and_return('false')

50 50

allow(selects[1]).to receive(:dom_attribute).with(:multiple).and_return(nil)

@@ -69,8 +69,8 @@ module Support

69 69

end

70 70 71 71

it 'returns all selected options' do

72 -

bad_option = instance_double(Element, selected?: false)

73 -

good_option = instance_double(Element, selected?: true)

72 +

bad_option = instance_double(Element, selected?: false, enabled?: true)

73 +

good_option = instance_double(Element, selected?: true, enabled?: true)

74 74 75 75

expect(multi_select).to receive(:find_elements)

76 76

.with(tag_name: 'option')

@@ -84,8 +84,8 @@ module Support

84 84

end

85 85 86 86

it 'returns the first selected option' do

87 -

first_option = instance_double(Element, selected?: true)

88 -

second_option = instance_double(Element, selected?: true)

87 +

first_option = instance_double(Element, selected?: true, enabled?: true)

88 +

second_option = instance_double(Element, selected?: true, enabled?: true)

89 89 90 90

expect(multi_select).to receive(:find_elements)

91 91

.with(tag_name: 'option')

@@ -97,7 +97,7 @@ module Support

97 97

end

98 98 99 99

it 'raises a NoSuchElementError if nothing is selected' do

100 -

option = instance_double(Element, selected?: false)

100 +

option = instance_double(Element, selected?: false, enabled?: true)

101 101 102 102

expect(multi_select).to receive(:find_elements)

103 103

.with(tag_name: 'option')

@@ -110,7 +110,7 @@ module Support

110 110

end

111 111 112 112

it 'allows options to be selected by visible text' do

113 -

option = instance_double(Element, selected?: false)

113 +

option = instance_double(Element, selected?: false, enabled?: true)

114 114 115 115

expect(multi_select).to receive(:find_elements)

116 116

.with(xpath: './/option[normalize-space(.) = "fish"]')

@@ -123,8 +123,8 @@ module Support

123 123

end

124 124 125 125

it 'allows options to be selected by index' do

126 -

first_option = instance_double(Element, selected?: true)

127 -

second_option = instance_double(Element, selected?: false)

126 +

first_option = instance_double(Element, selected?: true, enabled?: true)

127 +

second_option = instance_double(Element, selected?: false, enabled?: true)

128 128 129 129

allow(first_option).to receive(:property).with(:index).and_return 0

130 130

expect(first_option).not_to receive(:click)

@@ -143,7 +143,7 @@ module Support

143 143

end

144 144 145 145

it 'allows options to be selected by returned value' do

146 -

first_option = instance_double(Element, selected?: false)

146 +

first_option = instance_double(Element, selected?: false, enabled?: true)

147 147

allow(multi_select).to receive(:find_elements)

148 148

.with(xpath: './/option[@value = "b"]')

149 149

.and_return([first_option])

@@ -155,8 +155,8 @@ module Support

155 155

end

156 156 157 157

it 'can deselect all when select supports multiple selections' do

158 -

first_option = instance_double(Element, selected?: true)

159 -

second_option = instance_double(Element, selected?: false)

158 +

first_option = instance_double(Element, selected?: true, enabled?: true)

159 +

second_option = instance_double(Element, selected?: false, enabled?: true)

160 160 161 161

expect(multi_select).to receive(:find_elements)

162 162

.with(tag_name: 'option')

@@ -176,8 +176,8 @@ module Support

176 176

end

177 177 178 178

it 'can deselect options by visible text' do

179 -

first_option = instance_double(Element, selected?: true)

180 -

second_option = instance_double(Element, selected?: false)

179 +

first_option = instance_double(Element, selected?: true, enabled?: true)

180 +

second_option = instance_double(Element, selected?: false, enabled?: true)

181 181 182 182

allow(multi_select).to receive(:find_elements)

183 183

.with(xpath: './/option[normalize-space(.) = "b"]')

@@ -191,8 +191,8 @@ module Support

191 191

end

192 192 193 193

it 'can deselect options by index' do

194 -

first_option = instance_double(Element, selected?: true)

195 -

second_option = instance_double(Element)

194 +

first_option = instance_double(Element, selected?: true, enabled?: true)

195 +

second_option = instance_double(Element, enabled?: true)

196 196 197 197

allow(multi_select).to receive(:find_elements)

198 198

.with(tag_name: 'option')

@@ -209,8 +209,8 @@ module Support

209 209

end

210 210 211 211

it 'can deselect options by returned value' do

212 -

first_option = instance_double(Element, selected?: true)

213 -

second_option = instance_double(Element, selected?: false)

212 +

first_option = instance_double(Element, selected?: true, enabled?: true)

213 +

second_option = instance_double(Element, selected?: false, enabled?: true)

214 214 215 215

allow(multi_select).to receive(:find_elements)

216 216

.with(xpath: './/option[@value = "b"]')

@@ -224,7 +224,7 @@ module Support

224 224

end

225 225 226 226

it 'should fall back to slow lookups when "get by visible text fails" and there is a space' do

227 -

first_option = instance_double(Element, selected?: false, text: 'foo bar')

227 +

first_option = instance_double(Element, selected?: false, text: 'foo bar', enabled?: true)

228 228 229 229

xpath1 = './/option[normalize-space(.) = "foo bar"]'

230 230

xpath2 = './/option[contains(., "foo")]'


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4