lib/capybara/spec/session/selectors_spec.rb in capybara-3.19.1 vs lib/capybara/spec/session/selectors_spec.rb in capybara-3.20.0
- old
+ new
@@ -12,11 +12,19 @@
it 'finds a label by for attribute string' do
expect(@session.find(:label, for: 'form_other_title')['for']).to eq 'form_other_title'
end
+ it 'finds a label for for attribute regex' do
+ expect(@session.find(:label, for: /_other_title/)['for']).to eq 'form_other_title'
+ end
+
it 'finds a label from nested input using :for filter with id string' do
expect(@session.find(:label, for: 'nested_label').text).to eq 'Nested Label'
+ end
+
+ it 'finds a label from nested input using :for filter with id regexp' do
+ expect(@session.find(:label, for: /nested_lab/).text).to eq 'Nested Label'
end
it 'finds a label from nested input using :for filter with element' do
input = @session.find(:id, 'nested_label')
expect(@session.find(:label, for: input).text).to eq 'Nested Label'