class TestWabisabiBasic
Public Instance Methods
test_all()
click to toggle source
# File vendor/qwik/lib/qwik/wabisabi-basic.rb, line 110 def test_all # test_attr w = [:a, {:href=>'t1', :class=>'t2'}, 't3'] assert_equal({:href=>'t1', :class=>'t2'}, w.attr) # test_set_attr w = [:a] assert_equal [:a, {:href=>'u'}], w.set_attr(:href=>'u') assert_equal [:a, {:href=>'u', :class=>'c'}], w.set_attr(:class=>'c') w = [:a, {:href=>'t.html'}, 't', [:b, 'b']] # test_element_name assert_equal nil, [].element_name assert_equal nil, ['t'].element_name assert_equal :b, [:b, 't'].element_name assert_equal :a, w.element_name # test_inside assert_equal ['t', [:b, 'b']], w.inside # test_each_child w.each_child {|e| assert(e == "t" || e == [:b, "b"]) } # test_children assert_equal ['t', [:b, 'b']], w.children # test_each_child_with_index w.each_child_with_index {|e, i| case i when 0; assert_equal "t", e when 1; assert_equal [:b, "b"], e end } # test_text assert_equal 't', [:a, 't'].text assert_equal 't', [:a, ['t']].text assert_equal 'tb', w.text # test_get_single assert_equal [:a], [:a].get_single assert_equal [:a], [[:a]].get_single assert_equal [[:a], [:b]], [[:a], [:b]].get_single # test_each_element w.each_element(:b) {|e| assert_equal [:b, "b"], e } end