Sha256: 5b538325dcc2a1e470d1ecc119ed9441f397116ad040a02c181e13233d82848a

Contents?: true

Size: 1.3 KB

Versions: 6

Compression:

Stored size: 1.3 KB

Contents

require 'spec_helper'

describe Arbre::HTML::Element, "Finder Methods" do

  setup_arbre_context!

  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 & 2 rubygems

Version Path
andrewroth_activeadmin-0.3.4 spec/unit/arbre/html/element_finder_methods_spec.rb
activeadmin-0.3.4 spec/unit/arbre/html/element_finder_methods_spec.rb
activeadmin-0.3.3 spec/unit/arbre/html/element_finder_methods_spec.rb
activeadmin-0.3.2 spec/unit/arbre/html/element_finder_methods_spec.rb
activeadmin-0.3.1 spec/unit/arbre/html/element_finder_methods_spec.rb
activeadmin-0.3.0 spec/unit/arbre/html/element_finder_methods_spec.rb