require 'test_helper'
class RenderTest < ActionView::TestCase
include Apotomo::TestCaseMethods::TestController
context "#render" do
setup do
@mum = mouse('mum')
end
should "per default display the state content framed in a div" do
assert_equal '
squeak!<\\/div>\");", @mum.invoke(:squeak)
end
end
context "#replace" do
should "wrap the :text in a replace statement" do
@mum.instance_eval do
def squeak
replace :text => '
squeak!
'
end
end
assert_equal "$(\"#mum\").replaceWith(\"
squeak!<\\/div>\");", @mum.invoke(:squeak)
end
should "accept a selector" do
@mum.instance_eval do
def squeak
replace "div#mouse", :text => '
squeak!
'
end
end
assert_equal "$(\"div#mouse\").replaceWith(\"
squeak!<\\/div>\");", @mum.invoke(:squeak)
end
end
context "#escape_js" do
should "escape the string" do
assert_equal "
squeak!<\\/div>", @mum.escape_js('
squeak!
')
end
end
end
end