Created
September 27, 2011 20:23
-
-
Save chadoh/1246114 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context "widget" do | |
should "have sensible defaults" do | |
widget = widget 'title' do | |
haml_concat('this is my content') | |
end | |
assert_match %r{<section class='widget'><div class='widget'><header><a tabindex='0' title='click to show/hide'><h3>}, widget | |
assert_match %r{<h3>title</h3>}, widget | |
assert_match %r{<div class='widget-content'>this is my content</div>}, widget | |
end | |
should "have an option to be collapsed" do | |
widget = widget 'title', :collapsed do | |
haml_concat('this is my content') | |
end | |
assert_match %r{<section class='collapsed widget'><div class='widget'><header><a tabindex='0' title='click to show/hide'><h3>}, widget | |
end | |
should "be able to be kept open with a cookie" do | |
@request.cookies['widget_wooo'] = 'expanded' | |
widget = widget 'wooo', :< do | |
haml_concat('this is my content') | |
end | |
assert_match %r{<section class='widget'><div class='widget'><header><a tabindex='0' title='click to show/hide'><h3>}, widget | |
end | |
should "be able te be kept closed with a cookie" do | |
@request.cookies['widget_wooo'] = 'collapsed' | |
widget = widget 'wooo' do | |
haml_concat('this is my content') | |
end | |
assert_match %r{<section class='collapsed widget'><div class='widget'><header><a tabindex='0' title='click to show/hide'><h3>}, widget | |
end | |
should "have a setting to be fixed" do | |
widget = widget 'title!', :fixed do | |
haml_concat('content!') | |
end | |
assert_match %r{<section class='fixed widget'><div class='widget'><header><h3>}, widget | |
end | |
should "easily integrate ajax" do | |
widget = widget 'a heading!', ajax: 'device_hostmon_datum_path(124224)' | |
assert_match %r{<section class='collapsed widget'>}, widget | |
assert_match %r{<header><a data-remote='true' href='#{device_hostmon_datum_path(124224)}' tabindex='0' title='click to show/hide'><h3>}, widget | |
assert_match %r{<div class='loading widget-content'></div>}, widget | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment