Add slugify as a template filter (#58724)
This commit is contained in:
parent
e0ef066022
commit
26dc526234
2 changed files with 33 additions and 1 deletions
|
@ -865,6 +865,26 @@ def test_base64_decode(hass):
|
|||
)
|
||||
|
||||
|
||||
def test_slugify(hass):
|
||||
"""Test the slugify filter."""
|
||||
assert (
|
||||
template.Template('{{ slugify("Home Assistant") }}', hass).async_render()
|
||||
== "home_assistant"
|
||||
)
|
||||
assert (
|
||||
template.Template('{{ "Home Assistant" | slugify }}', hass).async_render()
|
||||
== "home_assistant"
|
||||
)
|
||||
assert (
|
||||
template.Template('{{ slugify("Home Assistant", "-") }}', hass).async_render()
|
||||
== "home-assistant"
|
||||
)
|
||||
assert (
|
||||
template.Template('{{ "Home Assistant" | slugify("-") }}', hass).async_render()
|
||||
== "home-assistant"
|
||||
)
|
||||
|
||||
|
||||
def test_ordinal(hass):
|
||||
"""Test the ordinal filter."""
|
||||
tests = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue