spec/page-object/elements/button_spec.rb in page-object-1.0.3 vs spec/page-object/elements/button_spec.rb in page-object-1.1.0

- old
+ new

@@ -42,9 +42,23 @@ context "for selenium" do it "should return error when asked for its' text" do button = PageObject::Elements::Button.new(button_element, :platform => :selenium_webdriver) expect(lambda { button.text }).to raise_error end + + it "should return text for a button tag button" do + allow(button_element).to receive(:tag_name).and_return('button') + allow(button_element).to receive(:text).and_return('button?') + button = PageObject::Elements::Button.new(button_element, :platform => :selenium_webdriver) + expect(button.text).to eq 'button?' + end + + it "should return text for an input tag button" do + allow(button_element).to receive(:tag_name).and_return('input') + allow(button_element).to receive(:attribute).with('value').and_return('button!') + button = PageObject::Elements::Button.new(button_element, :platform => :selenium_webdriver) + expect(button.text).to eq 'button!' + end end end end