mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Clarify duration selector (#68731)
This commit is contained in:
@@ -277,6 +277,8 @@ class DurationSelector(Selector):
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema(
|
||||
{
|
||||
# Enable day field in frontend. A selection with `days` set is allowed
|
||||
# even if `enable_day` is not set
|
||||
vol.Optional("enable_day"): cv.boolean,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -406,12 +406,15 @@ def test_attribute_selector_schema(schema, valid_selections, invalid_selections)
|
||||
(
|
||||
(
|
||||
{},
|
||||
({"seconds": 10},),
|
||||
(
|
||||
{"seconds": 10},
|
||||
{"days": 10}, # Days is allowed also if `enable_day` is not set
|
||||
),
|
||||
(None, {}),
|
||||
),
|
||||
(
|
||||
{"enable_day": True},
|
||||
({"seconds": 10},),
|
||||
({"seconds": 10}, {"days": 10}),
|
||||
(None, {}),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user