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:
parent
4243ab5ea1
commit
4ac0b74aa5
3 changed files with 4 additions and 1 deletions
|
@ -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('_'),
|
||||
|
|
|
@ -48,7 +48,7 @@ class TemplateTest < Haml::TestCase
|
|||
#'whitespace_handling',
|
||||
'original_engine',
|
||||
'list',
|
||||
#'helpful',
|
||||
'helpful',
|
||||
'silent_script',
|
||||
'tag_parsing',
|
||||
#'just_stuff',
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue