Skip to content

Instantly share code, notes, and snippets.

@johnreilly
Created February 20, 2010 20:44
Show Gist options
  • Select an option

  • Save johnreilly/309897 to your computer and use it in GitHub Desktop.

Select an option

Save johnreilly/309897 to your computer and use it in GitHub Desktop.
# HTML5 style data-* attributes in haml
def test_html5_data_attributes
assert_equal("<div data-author_id='123' data-biz='baz' data-foo='bar'></div>\n",
render("%div{:data => {:author_id => 123, :foo => 'bar', :biz => 'baz'}}"))
assert_equal("<div data-one_plus_one='2'></div>\n",
render("%div{:data => {:one_plus_one => 1+1}}"))
assert_equal("<div data-foo='Here&apos;s a \"quoteful\" string.'></div>\n",
render(%{%div{:data => {:foo => %{Here's a "quoteful" string.}}}}))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment