Add selectors for text and arbitrary objects (#45112)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
parent
6800f4b6fd
commit
06ade6129c
2 changed files with 32 additions and 0 deletions
|
@ -162,3 +162,17 @@ class ActionSelector(Selector):
|
||||||
"""Selector of an action sequence (script syntax)."""
|
"""Selector of an action sequence (script syntax)."""
|
||||||
|
|
||||||
CONFIG_SCHEMA = vol.Schema({})
|
CONFIG_SCHEMA = vol.Schema({})
|
||||||
|
|
||||||
|
|
||||||
|
@SELECTORS.register("object")
|
||||||
|
class ObjectSelector(Selector):
|
||||||
|
"""Selector for an arbitrary object."""
|
||||||
|
|
||||||
|
CONFIG_SCHEMA = vol.Schema({})
|
||||||
|
|
||||||
|
|
||||||
|
@SELECTORS.register("text")
|
||||||
|
class StringSelector(Selector):
|
||||||
|
"""Selector for a multi-line text string."""
|
||||||
|
|
||||||
|
CONFIG_SCHEMA = vol.Schema({vol.Optional("multiline", default=False): bool})
|
||||||
|
|
|
@ -169,3 +169,21 @@ def test_target_selector_schema(schema):
|
||||||
def test_action_selector_schema(schema):
|
def test_action_selector_schema(schema):
|
||||||
"""Test action sequence selector."""
|
"""Test action sequence selector."""
|
||||||
selector.validate_selector({"action": schema})
|
selector.validate_selector({"action": schema})
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"schema",
|
||||||
|
({},),
|
||||||
|
)
|
||||||
|
def test_object_selector_schema(schema):
|
||||||
|
"""Test object selector."""
|
||||||
|
selector.validate_selector({"object": schema})
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"schema",
|
||||||
|
({}, {"multiline": True}, {"multiline": False}),
|
||||||
|
)
|
||||||
|
def test_text_selector_schema(schema):
|
||||||
|
"""Test text selector."""
|
||||||
|
selector.validate_selector({"text": schema})
|
||||||
|
|
Loading…
Add table
Reference in a new issue