1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Support nil object reference

This commit is contained in:
Takashi Kokubun 2015-11-18 11:04:50 -06:00
parent 4243ab5ea1
commit 4ac0b74aa5
3 changed files with 4 additions and 1 deletions

View file

@ -3,6 +3,8 @@ module Hamlit
class << self
def parse(args)
object, prefix = args
return {} unless object
suffix = underscore(object.class)
{
'class' => [prefix, suffix].compact.join('_'),

View file

@ -48,7 +48,7 @@ class TemplateTest < Haml::TestCase
#'whitespace_handling',
'original_engine',
'list',
#'helpful',
'helpful',
'silent_script',
'tag_parsing',
#'just_stuff',

View file

@ -193,6 +193,7 @@ describe Hamlit::Engine do
- dynamic = 'dynamic'
%a.static#static[foo, 'pre']{ id: dynamic, class: dynamic }
HAML
assert_render(%q|.static#static[nil]|, %Q|<div class='static' id='static'></div>\n|)
end
describe 'engine options' do