Sha256: 6f95b5e015d921829e1db453e1a40ad907c10b229d7c4b505c62df5f5eaae883
Contents?: true
Size: 1.94 KB
Versions: 6
Compression:
Stored size: 1.94 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/submit') class TestSubmitTag < Test::Unit::TestCase include MasterView::Directives def setup @directives = MasterView::DirectiveSet.new end def test_submit submit_text = 'foobar' tag = MasterView::Tag.new(@directives, 'input', { 'type' => 'submit', 'value' => submit_text }, :normal, nil) @directives.directives = [] attr_value = "baz" @directives << Submit.new(attr_value) assert_equal nil, @directives.determine_dcs(:stag).render dcs = @directives.determine_dcs(:etag) dcs.context = tag.create_context dcs.context[:tag].content = "hello world" assert_equal "<%= submit_tag '#{submit_text}' %>", dcs.render end def test_submit_with_hash submit_text = 'foobar' tag = MasterView::Tag.new(@directives, 'input', { 'type' => 'submit', 'value' => submit_text }, :normal, nil) @directives.directives = [] attr_value = "{:foo => 'bar' }" @directives << Submit.new(attr_value) assert_equal nil, @directives.determine_dcs(:stag).render dcs = @directives.determine_dcs(:etag) dcs.context = tag.create_context dcs.context[:tag].content = "hello world" assert_equal "<%= submit_tag '#{submit_text}', #{attr_value} %>", dcs.render end def test_submit_with_hash_no_brack submit_text = 'foobar' tag = MasterView::Tag.new(@directives, 'input', { 'type' => 'submit', 'value' => submit_text }, :normal, nil) @directives.directives = [] attr_value = ":foo => 'bar'" @directives << Submit.new(attr_value) assert_equal nil, @directives.determine_dcs(:stag).render dcs = @directives.determine_dcs(:etag) dcs.context = tag.create_context dcs.context[:tag].content = "hello world" assert_equal "<%= submit_tag '#{submit_text}', #{attr_value} %>", dcs.render end end
Version data entries
6 entries across 6 versions & 1 rubygems