', source
end
def test_ternary_operation_in_attribute_2
source = %q{
p id=(false ? 'notshown' : 'shown') = output_number
}
assert_html '
1337
', source
end
def test_class_attribute_merging
source = %{
.alpha class="beta" Test it
}
assert_html '
Test it
', source
end
def test_class_attribute_merging_with_nil
source = %{
.alpha class="beta" class=nil class="gamma" Test it
}
assert_html '
Test it
', source
end
def test_class_attribute_merging_with_empty_static
source = %{
.alpha class="beta" class="" class="gamma" Test it
}
assert_html '
Test it
', source
end
def test_id_attribute_merging
source = %{
#alpha id="beta" Test it
}
assert_html '
Test it
', source, :attr_delimiter => {'class' => ' ', 'id' => '_' }
end
def test_id_attribute_merging2
source = %{
#alpha id="beta" Test it
}
assert_html '
Test it
', source, :attr_delimiter => {'class' => ' ', 'id' => '-' }
end
def test_boolean_attribute_false
source = %{
- cond=false
option selected=false Text
option selected=cond Text2
}
assert_html '', source
end
def test_boolean_attribute_true
source = %{
- cond=true
option selected=true Text
option selected=cond Text2
}
assert_html '', source
end
def test_boolean_attribute_nil
source = %{
- cond=nil
option selected=nil Text
option selected=cond Text2
}
assert_html '', source
end
def test_boolean_attribute_string2
source = %{
option selected="selected" Text
}
assert_html '', source
end
def test_boolean_attribute_shortcut
source = %{
option(class="clazz" selected) Text
option(selected class="clazz") Text
}
assert_html '', source
end
def test_array_attribute
source = %{
.alpha class="beta" class=[:gamma, nil, :delta, [true, false]]
}
assert_html '', source
end
def test_shortcut_splat
source = %q{
*hash This is my title
}
assert_html '
This is my title
', source
end
def test_splat
source = %q{
h1 *hash This is my title
}
assert_html '
This is my title
', source
end
def test_splat_tag_name
source = %q{
*{:tag => 'h1', :id => 'title'} This is my title
}
assert_html '
This is my title
', source
end
def test_splat_empty_tag_name
source = %q{
*{:tag => '', :id => 'test'} This is my title
}
assert_html '
This is my title
', source
end
def test_closed_splat_tag
source = %q{
*hash / This is my title
}
assert_html '', source
end
def test_splat_with_id_shortcut
source = %q{
#myid*hash This is my title
}
assert_html '
This is my title
', source
end
def test_splat_with_class_shortcut
source = %q{
.myclass*hash This is my title
}
assert_html '
This is my title
', source
end
def test_splat_with_id_and_class_shortcuts
source = %q{
#myid.myclass*hash This is my title
}
assert_html '
This is my title
', source
end
def test_splat_with_class_merging
source = %q{
#myid.myclass *{:class => [:secondclass, %w(x y z)]} *hash This is my title
}
assert_html '
This is my title
', source
end
def test_splat_with_boolean_attribute
source = %q{
*{:disabled => true, :empty1 => false, :nonempty => '', :empty2 => nil} This is my title
}
assert_html '
This is my title
', source
end
def test_splat_merging_with_arrays
source = %q{
*{:a => 1, :b => 2} *[[:c, 3], [:d, 4]] *[[:e, 5], [:f, 6]] This is my title
}
assert_html '
This is my title
', source
end
def test_splat_with_other_attributes
source = %q{
h1 data-id="123" *hash This is my title
}
assert_html '
This is my title
', source
end
def test_attribute_merging
source = %q{
a class=true class=false
a class=false *{:class=>true}
a class=true
a class=false
}
assert_html '', source
end
end