Sha256: 453facef90877926383fad324bd372e41565d87cc1f760b5a43a5a2efc40f4dc

Contents?: true

Size: 1.11 KB

Versions: 13

Compression:

Stored size: 1.11 KB

Contents

require File.expand_path('../watirspec/spec_helper', __FILE__)

describe Watir::Element do
  describe "#click" do
    before {
      browser.goto WatirSpec.url_for('clicks.html', :needs_server => true)
    }

    let(:clicker) { browser.element(:id => "click-logger") }
    let(:log)     { browser.element(:id => "log").ps.map { |e| e.text } }

    # TODO: make guards more flexible, in reality this currently only works on linux with native events
    compliant_on [:webdriver, :firefox, :native_events] do 
      it "should perform a click with no modifier keys" do
        clicker.click
        log.should == ["shift=false alt=false"]
      end

      it "should perform a click with the shift key pressed" do
        clicker.click(:shift)
        log.should == ["shift=true alt=false"]
      end

      it "should perform a click with the alt key pressed" do
        clicker.click(:alt)
        log.should == ["shift=false alt=true"]
      end

      it "should perform a click with the shift and alt keys pressed" do
        clicker.click(:shift, :alt)
        log.should == ["shift=true alt=true"]
      end
    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
watir-webdriver-0.6.4 spec/click_spec.rb
watir-webdriver-0.6.3 spec/click_spec.rb
watir-webdriver-0.6.2 spec/click_spec.rb
watir-webdriver-0.6.1 spec/click_spec.rb
watir-webdriver-0.6.0 spec/click_spec.rb
watir-webdriver-0.5.8 spec/click_spec.rb
watir-webdriver-0.5.7 spec/click_spec.rb
watir-webdriver-0.5.6 spec/click_spec.rb
watir-webdriver-0.5.5 spec/click_spec.rb
watir-webdriver-0.5.4 spec/click_spec.rb
watir-webdriver-0.5.3 spec/click_spec.rb
watir-webdriver-0.5.2 spec/click_spec.rb
watir-webdriver-0.5.1 spec/click_spec.rb