Flowdock

Notes posted by jim

RSS feed
October 11, 2008 - (<= v2.0.3)
1 thank

Assert tag children

Code

#<div id="example">
#  <ul>
#    <li class="btn_1"><a href="#">link1</a></li>
#    <li class="btn_2"><a href="#">link2</a></li>
#  </ul>
#</div>

assert_tag :tag => 'div',
  :attributes => {:id => "example"},
  :child => {
    :tag => 'ul',
    :child => {
      :tag => 'li',
      :attributes => {:class => 'btn_1'},
      :child => {
        :tag => 'a',
        :attributes => {:href => '#'},
        :content => 'link1'
      },
      :sibling => {
        :tag => 'li',
        :attributes => {:class => 'btn_2'},
        :child => {
          :tag => 'a',
          :attributes => {:href => '#'},
          :content => /link/
        }
      }
    }
  }