Sha256: e59a067811d1b7c14bb01c6b0c385196b92272786bf7d301a55d5787af12d337

Contents?: true

Size: 1.32 KB

Versions: 6

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

describe Arbre::HTML::Element, "Finder Methods" do
  include Arbre::HTML
  let(:assigns){ {} }

  describe "finding elements by tag name" do

    it "should return 0 when no elements exist" do
      div.get_elements_by_tag_name("li").size.should == 0
    end

    it "should return a child element" do
      html = div do
        ul
        li
        ul
      end
      elements = html.get_elements_by_tag_name("li")
      elements.size.should == 1
      elements[0].should be_instance_of(Arbre::HTML::Li)
    end

    it "should return multple child elements" do
      html = div do
        ul
        li
        ul
        li
      end
      elements = html.get_elements_by_tag_name("li")
      elements.size.should == 2
      elements[0].should be_instance_of(Arbre::HTML::Li)
      elements[1].should be_instance_of(Arbre::HTML::Li)
    end

    it "should return children's child elements" do
      html = div do
        ul
        li do
          li
        end
      end
      elements = html.get_elements_by_tag_name("li")
      elements.size.should == 2
      elements[0].should be_instance_of(Arbre::HTML::Li)
      elements[1].should be_instance_of(Arbre::HTML::Li)
      elements[1].parent.should == elements[0]
    end
  end

  describe "finding an element by id"
  describe "finding an element by a class name"
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
nsm-activeadmin-0.2.2 spec/unit/arbre/html/element_finder_methods_spec.rb
saulolso-activeadmin-0.2.2.1 spec/unit/arbre/html/element_finder_methods_spec.rb
saulolso-activeadmin-0.2.2 spec/unit/arbre/html/element_finder_methods_spec.rb
activeadmin-0.2.2 spec/unit/arbre/html/element_finder_methods_spec.rb
activeadmin-0.2.1 spec/unit/arbre/html/element_finder_methods_spec.rb
activeadmin-0.2.0 spec/unit/arbre/html/element_finder_methods_spec.rb