Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dyve committed Dec 16, 2024
1 parent c2dd052 commit 469f794
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_bootstrap_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,16 @@ def test_button_hyphenate_attributes(self):
self.render("{% bootstrap_button 'button' href='#' data_foo='bar' hx_xyz='abc' %}"),
'<a class="btn btn-primary" href="#" role="button" data_foo="bar" hx_xyz="abc">button</a>',
)

# Custom: None
with self.settings(BOOTSTRAP5={"hyphenate_attribute_prefixes": None}):
self.assertHTMLEqual(
self.render("{% bootstrap_button 'button' href='#' data_foo='bar' hx_xyz='abc' %}"),
'<a class="btn btn-primary" href="#" role="button" data_foo="bar" hx_xyz="abc">button</a>',
)

# Edge case: attribute name starts with prefix but prefix is not followed by underscore
self.assertHTMLEqual(
self.render("{% bootstrap_button 'button' href='#' databar_foo='bar' %}"),
'<a class="btn btn-primary" href="#" role="button" databar_foo="bar">button</a>',
)

0 comments on commit 469f794

Please sign in to comment.