Sha256: 168b5535b92f29ed49d6613940ca886c1cdffaf4695d1360bd675c472e98f798

Contents?: true

Size: 1.2 KB

Versions: 31

Compression:

Stored size: 1.2 KB

Contents

require 'spec_helper'
require 'page-object/elements'

describe PageObject::Elements::Canvas do
  let(:area) { PageObject::Elements::Canvas }

  context "when mapping how to find an element" do
    it "should map watir types to same" do
      [:class, :id, :index, :name, :xpath].each do |t|
        identifier = area.watir_identifier_for t => 'value'
        identifier.keys.first.should == t
      end
    end

    it "should map selenium types to same" do
      [:class, :id, :index, :name, :xpath].each do |t|
        key, value = area.selenium_identifier_for t => 'value'
        key.should == t
      end
    end
  end

  context "implementation" do
    let(:canvas_element) { double('canvas_element') }

    context "when using selenium" do
      let(:selenium_canvas) { PageObject::Elements::Canvas.new(canvas_element, :platform => :selenium_webdriver) }

      it "should know its width" do
        canvas_element.should_receive(:attribute).with(:width).and_return("400")
        selenium_canvas.width.should == 400
      end

      it "should know its height" do
        canvas_element.should_receive(:attribute).with(:height).and_return("100")
        selenium_canvas.height.should == 100
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
meeane-page-object-0.1.11 spec/page-object/elements/canvas_spec.rb
page-object-1.0.2 spec/page-object/elements/canvas_spec.rb
page-object-1.0.1 spec/page-object/elements/canvas_spec.rb
page-object-1.0 spec/page-object/elements/canvas_spec.rb
page-object-0.9.8 spec/page-object/elements/canvas_spec.rb
page-object-0.9.7 spec/page-object/elements/canvas_spec.rb
page-object-0.9.6 spec/page-object/elements/canvas_spec.rb
page-object-0.9.5 spec/page-object/elements/canvas_spec.rb
page-object-0.9.4 spec/page-object/elements/canvas_spec.rb
page-object-0.9.3 spec/page-object/elements/canvas_spec.rb
page-object-0.9.2 spec/page-object/elements/canvas_spec.rb
page-object-0.9.1 spec/page-object/elements/canvas_spec.rb
page-object-0.9.0 spec/page-object/elements/canvas_spec.rb
page-object-0.8.10 spec/page-object/elements/canvas_spec.rb
page-object-0.8.9 spec/page-object/elements/canvas_spec.rb
page-object-0.8.8 spec/page-object/elements/canvas_spec.rb
page-object-0.8.7 spec/page-object/elements/canvas_spec.rb
page-object-0.8.6.1 spec/page-object/elements/canvas_spec.rb
page-object-0.8.6 spec/page-object/elements/canvas_spec.rb
page-object-0.8.5 spec/page-object/elements/canvas_spec.rb