Sha256: e52efcad424f876281debee81341c56d3f3c3a8bcdc91ef4b7f8e536a4b31a33

Contents?: true

Size: 1.69 KB

Versions: 5

Compression:

Stored size: 1.69 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/block')
require File.join( currentPath, '../directive_test_helper' )
DirectiveTestHelpers.load_masterview_directive('block')

class TestBlock < Test::Unit::TestCase
  include DirectiveTestHelpers

  Block = MasterView::Directives::Block  # test subject
  DirectiveAttrName = Block.attribute_qname

  ELEMENT_TAG = 'div'

  def setup
    create_template_element ELEMENT_TAG
  end

  def test_metadata
    assert_equal MasterView::ConfigSettings.namespace_prefix, Block.namespace_prefix
  end

  def test_block_do_end_notation
    attr_value = 'if true do'
    create_directive Block, attr_value
    assert_equal "<% #{attr_value} -%>", render_element_event(:stag)
    assert_equal "<% end -%>", render_element_event(:etag)

  end

  def test_block_braces_notation
    attr_value = 'if true {'
    create_directive Block, attr_value
    assert_equal "<% #{attr_value} -%>", render_element_event(:stag)
    assert_equal "<% } -%>", render_element_event(:etag)
  end

  def test_brack2
    attr_value = 'if true { :foo => :bar } {'
    create_directive Block, attr_value
    assert_equal "<% #{attr_value} -%>", render_element_event(:stag)
    assert_equal "<% } -%>", render_element_event(:etag)
  end

  def test_do2
    attr_value = 'if true { :foo => :bar } do'
    create_directive Block, attr_value
    assert_equal 1, element_directives.size  #??why are we checking this?? [deb 05-Oct-2006]
    assert_equal "<% #{attr_value} -%>", render_element_event(:stag)
    assert_equal "<% end -%>", render_element_event(:etag)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
masterview-0.3.4 test/unit/directive_block_test.rb
masterview-0.3.0 test/unit/directive_block_test.rb
masterview-0.3.1 test/unit/directive_block_test.rb
masterview-0.3.2 test/unit/directive_block_test.rb
masterview-0.3.3 test/unit/directive_block_test.rb