spec/watirspec/elements/span_spec.rb in watir-6.14.0 vs spec/watirspec/elements/span_spec.rb in watir-6.15.0
- old
+ new
@@ -9,17 +9,20 @@
describe '#exist?' do
it "returns true if the 'span' exists" do
expect(browser.span(id: 'lead')).to exist
expect(browser.span(id: /lead/)).to exist
expect(browser.span(text: 'Dubito, ergo cogito, ergo sum.')).to exist
- expect(browser.span(text: /Dubito, ergo cogito, ergo sum/)).to exist
expect(browser.span(class: 'lead')).to exist
expect(browser.span(class: /lead/)).to exist
expect(browser.span(index: 0)).to exist
expect(browser.span(xpath: "//span[@id='lead']")).to exist
end
+ it 'visible text is found by regular expression with text locator' do
+ expect(browser.span(text: /Dubito, ergo cogito, ergo sum/)).to exist
+ end
+
it 'returns the first span if given no args' do
expect(browser.span).to exist
end
it "returns false if the element doesn't exist" do
@@ -37,23 +40,9 @@
expect { browser.span(id: 3.14).exists? }.to raise_error(TypeError)
end
end
# Attribute methods
- describe '#class_name' do
- it 'returns the class attribute' do
- expect(browser.span(index: 0).class_name).to eq 'lead'
- end
-
- it "returns an empty string if the element exists and the attribute doesn't" do
- expect(browser.span(index: 2).class_name).to eq ''
- end
-
- it "raises UnknownObjectException if the span doesn't exist" do
- expect { browser.span(id: 'no_such_id').class_name }.to raise_unknown_object_exception
- end
- end
-
describe '#id' do
it 'returns the id attribute' do
expect(browser.span(index: 0).id).to eq 'lead'
end