require 'abstract_unit' class JavaScriptHelperTest < ActionView::TestCase tests ActionView::Helpers::JavaScriptHelper def _evaluate_assigns_and_ivars() end attr_accessor :formats, :output_buffer def update_details(details) @details = details yield if block_given? end def setup super ActiveSupport.escape_html_entities_in_json = true @template = self end def teardown ActiveSupport.escape_html_entities_in_json = false end def _evaluate_assigns_and_ivars() end def test_escape_javascript assert_equal '', escape_javascript(nil) assert_equal %(This \\"thing\\" is really\\n netos\\'), escape_javascript(%(This "thing" is really\n netos')) assert_equal %(backslash\\\\test), escape_javascript( %(backslash\\test) ) assert_equal %(dont <\\/close> tags), escape_javascript(%(dont tags)) end def test_button_to_function assert_dom_equal %(), button_to_function("Greeting", "alert('Hello world!')") end def test_button_to_function_with_rjs_block html = button_to_function( "Greet me!" ) do |page| page.replace_html 'header', "