Skip to content

Commit

Permalink
Format tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dyve committed Dec 16, 2024
1 parent 469f794 commit 8ed9f4e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tests/test_bootstrap_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,36 +73,41 @@ def test_button_hyphenate_attributes(self):
self.render("{% bootstrap_button 'button' href='#' %}"),
'<a class="btn btn-primary" href="#" role="button">button</a>',
)
# Default: data prefix

# Default prefix: data
self.assertHTMLEqual(
self.render("{% bootstrap_button 'button' href='#' data_foo='bar' %}"),
'<a class="btn btn-primary" href="#" role="button" data-foo="bar">button</a>',
)
# Default: no hx prefix

# Default prefix: no hx
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>',
)
# Custom: data and hx

# Custom prefix: data and hx
with self.settings(BOOTSTRAP5={"hyphenate_attribute_prefixes": ["data", "hx"]}):
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>',
)
# Custom: hx only

# Custom prefix: hx only
with self.settings(BOOTSTRAP5={"hyphenate_attribute_prefixes": ["hx"]}):
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>',
)
# Custom: empty list

# Custom prefix: empty list
with self.settings(BOOTSTRAP5={"hyphenate_attribute_prefixes": []}):
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>',
)

# Custom: None
# Custom prefix: None
with self.settings(BOOTSTRAP5={"hyphenate_attribute_prefixes": None}):
self.assertHTMLEqual(
self.render("{% bootstrap_button 'button' href='#' data_foo='bar' hx_xyz='abc' %}"),
Expand Down

0 comments on commit 8ed9f4e

Please sign in to comment.