Sha256: ef82b506bac8aeca0d3421904ad275fc179b34dcff359fb4d9f50dbfedb8a014

Contents?: true

Size: 1.23 KB

Versions: 6

Compression:

Stored size: 1.23 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'
        expect(identifier.keys.first).to eql 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'
        expect(key).to eql 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
        expect(canvas_element).to receive(:attribute).with(:width).and_return("400")
        expect(selenium_canvas.width).to eql 400
      end

      it "should know its height" do
        expect(canvas_element).to receive(:attribute).with(:height).and_return("100")
        expect(selenium_canvas.height).to eql 100
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
page-object-1.1.1 spec/page-object/elements/canvas_spec.rb
page_object-1.1.3 spec/page-object/elements/canvas_spec.rb
page_object-1.1.2 spec/page-object/elements/canvas_spec.rb
page_object-1.1.1 spec/page-object/elements/canvas_spec.rb
page-object-1.1.0 spec/page-object/elements/canvas_spec.rb
page-object-1.0.3 spec/page-object/elements/canvas_spec.rb