Sha256: ba2b0d93e0d3142d5d8123b6a2313edb1103f708a35d0ae4326289af19119d96

Contents?: true

Size: 1.12 KB

Versions: 8

Compression:

Stored size: 1.12 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
        expect(log).to eq ["shift=false alt=false"]
      end

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

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

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

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
watir-webdriver-0.7.0 spec/click_spec.rb
watir-webdriver-0.6.11 spec/click_spec.rb
watir-webdriver-0.6.10 spec/click_spec.rb
watir-webdriver-0.6.9 spec/click_spec.rb
watir-webdriver-0.6.8 spec/click_spec.rb
watir-webdriver-0.6.7 spec/click_spec.rb
watir-webdriver-0.6.6 spec/click_spec.rb
watir-webdriver-0.6.5 spec/click_spec.rb