Sha256: 51d4ee5e176247cb35a26fe6ce38d121464922e9a39a5fd0b186844f6e8d9e75
Contents?: true
Size: 1.5 KB
Versions: 5
Compression:
Stored size: 1.5 KB
Contents
#!/usr/bin/env ruby require 'test/unit' currentPath = File.dirname(__FILE__) require File.join( currentPath, '../../lib/masterview' ) #require File.join( currentPath, '../../lib/masterview/directives/link_to_function') require File.join( currentPath, '../directive_test_helper' ) DirectiveTestHelpers.load_masterview_directive('link_to_function') class TestLinkToFunction < Test::Unit::TestCase include DirectiveTestHelpers LinkToFunction = MasterView::Directives::LinkToFunction # test subject ELEMENT_TAG = 'a' def test_metadata assert_equal MasterView::ConfigSettings.namespace_prefix, LinkToFunction.namespace_prefix assert_equal 'link_to_function', LinkToFunction.attribute_name end def test_default link_tag = create_template_element ELEMENT_TAG, :content => 'function_name' attr_value = "alert('Hello world!')" create_directive LinkToFunction, attr_value assert_equal '', render_element_event(:stag) expected_content = "<%= link_to_function( 'function_name', \"alert('Hello world!')\" ) %>" assert_equal expected_content, render_element_event(:etag) end def test_default_quoted link_tag = create_template_element ELEMENT_TAG, :content => 'function_name' attr_value = "'dosomething()', :id => 'hw'" create_directive LinkToFunction, attr_value assert_equal '', render_element_event(:stag) expected_content = "<%= link_to_function( 'function_name', 'dosomething()', :id => 'hw' ) %>" assert_equal expected_content, render_element_event(:etag) end end
Version data entries
5 entries across 5 versions & 1 rubygems