mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Allow other icon prefixes than mdi: (#19872)
This commit is contained in:
parent
c29bffc8d8
commit
f73bda1218
@ -200,10 +200,10 @@ def icon(value):
|
|||||||
"""Validate icon."""
|
"""Validate icon."""
|
||||||
value = str(value)
|
value = str(value)
|
||||||
|
|
||||||
if value.startswith('mdi:'):
|
if ':' in value:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
raise vol.Invalid('Icons should start with prefix "mdi:"')
|
raise vol.Invalid('Icons should be specifed on the form "prefix:name"')
|
||||||
|
|
||||||
|
|
||||||
time_period_dict = vol.All(
|
time_period_dict = vol.All(
|
||||||
|
@ -258,11 +258,12 @@ def test_icon():
|
|||||||
"""Test icon validation."""
|
"""Test icon validation."""
|
||||||
schema = vol.Schema(cv.icon)
|
schema = vol.Schema(cv.icon)
|
||||||
|
|
||||||
for value in (False, 'work', 'icon:work'):
|
for value in (False, 'work'):
|
||||||
with pytest.raises(vol.MultipleInvalid):
|
with pytest.raises(vol.MultipleInvalid):
|
||||||
schema(value)
|
schema(value)
|
||||||
|
|
||||||
schema('mdi:work')
|
schema('mdi:work')
|
||||||
|
schema('custom:prefix')
|
||||||
|
|
||||||
|
|
||||||
def test_time_period():
|
def test_time_period():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user