Sha256: fd45ae29885ba9558b6b37ac83c5f62782d9b5cbbc131087904fa62921b12cef

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

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


describe Watir::Element do

  describe "#send_keys" do
    it "sends keystrokes to the element" do
      browser.goto("file://" + File.expand_path("html/keylogger.html", File.dirname(__FILE__)))
      browser.div(:id, 'receiver').send_keys("hello world")
      browser.div(:id, 'output').ps.size.should == 11
    end
  end

  describe "#== and #eql?" do
    before { browser.goto(WatirSpec.files + "/definition_lists.html") }

    it "returns true if the two elements point to the same DOM element" do
      a = browser.dl(:id => "experience-list")
      b = browser.dl

      a.should == b
      a.should eql(b)
    end

    it "returns false if the two elements are not the same" do
      a = browser.dls[0]
      b = browser.dls[1]

      a.should_not == b
      a.should_not eql(b)
    end
  end

  describe "data-* attributes" do
    before { browser.goto("file://" + File.expand_path("html/data_attributes.html", File.dirname(__FILE__))) }

    it "finds elements by a data-* attribute" do
      browser.p(:data_type => "ruby-library").should exist
    end

    it "returns the value of a data-* attribute" do
      browser.p.data_type.should == "ruby-library"
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
watir-webdriver-0.0.9 spec/element_spec.rb
watir-webdriver-0.0.8 spec/element_spec.rb