Sha256: a72b3d8d60d1fb036f78dca1aaaa9991b427c7c631b87cb41f616d49aee40099
Contents?: true
Size: 1.94 KB
Versions: 21
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
21 entries across 21 versions & 2 rubygems