Sha256: cf2b94bb6e993b54b8042118e1caa7fe764b01fc22f9a5701754e0746dcd26c0

Contents?: true

Size: 1.11 KB

Versions: 1

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('file://' + File.expand_path('../html/clicks.html', __FILE__))
    }

    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

1 entries across 1 versions & 1 rubygems

Version Path
watir-webdriver-0.5.0 spec/click_spec.rb