require 'helper' require 'slim/logic_less' class TestSlimLogicLess < TestSlim class Scope def initialize @hash = { :person => [ { :name => 'Joe', :age => 1, :selected => true }, { :name => 'Jack', :age => 2 } ] } end end def test_symbol_access source = %q{ p - person .name = name } hash = { :person => [ { :name => 'Joe', }, { :name => 'Jack', } ] } assert_html '
No person No person 2
', source, :scope => hash end def test_output_with_content source = %{ p = method_with_block do block } assert_runtime_error 'Output statements with content are forbidden in logic less mode', source end def test_escaped_interpolation source = %q{ p text with \#{123} test } assert_html 'text with #{123} test
', source end def test_ruby_attributes source = %q{ p - person b name=name Person a id=name = age span class=name Person } assert_html '', source, :scope => Scope.new, :dictionary => '@hash', :dictionary_access => :symbol end def test_boolean_attributes source = %q{ p - person input checked=selected = name } assert_html 'JoeJack
', source, :scope => Scope.new, :dictionary => '@hash', :dictionary_access => :symbol end end