test/unit/bbq_widget_test.rb in bbq-widget-0.0.1 vs test/unit/bbq_widget_test.rb in bbq-widget-0.0.2
- old
+ new
@@ -3,19 +3,35 @@
require 'bbq/test'
require 'bbq-widget'
class BbqWidgetTest < Test::Unit::TestCase
+ def test_css_id
+ user = Bbq::TestUser.new
+ w = Bbq::Widget::WithinCssId.new(user, "abc")
+ assert_equal "#abc", w.css_id
+ end
+
def test_responsivnes
w = Bbq::Widget::WithinCssId.new(Bbq::TestUser.new, nil)
assert w.respond_to?(:see?)
assert w.respond_to?(:see!)
assert w.respond_to?(:has_content?)
assert w.respond_to?(:click_button)
assert w.respond_to?(:save_page)
end
- def test_explicit_user_eyes
+ def test_widgets_search_in_widget_scope
+ user = Bbq::TestUser.new
+ user.visit "/"
+ w = Bbq::Widget::WithinCssId.new(user, "ul2li1")
+ assert w.has?("ul2li1")
+ assert w.lacks?("ul1li1")
+ assert_raise(FAILED_ASSERTION) { w.has!("ul1li1") }
+ assert_raise(FAILED_ASSERTION) { w.lacks!("ul2li1") }
+ end
+
+ def test_widgets_are_properly_nesting_capybara_search_scope
user = Bbq::TestUser.new
user.visit "/"
l1 = Bbq::Widget::WithinCssId.new(user, nil)
def l1.css_id; ".second" end