mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Add prefix support to text selector (#96830)
This commit is contained in:
parent
4ceba01ab7
commit
b9f92b526b
@ -1137,6 +1137,7 @@ class TextSelectorConfig(TypedDict, total=False):
|
||||
"""Class to represent a text selector config."""
|
||||
|
||||
multiline: bool
|
||||
prefix: str
|
||||
suffix: str
|
||||
type: TextSelectorType
|
||||
autocomplete: str
|
||||
@ -1169,6 +1170,7 @@ class TextSelector(Selector[TextSelectorConfig]):
|
||||
CONFIG_SCHEMA = vol.Schema(
|
||||
{
|
||||
vol.Optional("multiline", default=False): bool,
|
||||
vol.Optional("prefix"): str,
|
||||
vol.Optional("suffix"): str,
|
||||
# The "type" controls the input field in the browser, the resulting
|
||||
# data can be any string so we don't validate it.
|
||||
|
@ -581,6 +581,7 @@ def test_object_selector_schema(schema, valid_selections, invalid_selections) ->
|
||||
({}, ("abc123",), (None,)),
|
||||
({"multiline": True}, (), ()),
|
||||
({"multiline": False, "type": "email"}, (), ()),
|
||||
({"prefix": "before", "suffix": "after"}, (), ()),
|
||||
),
|
||||
)
|
||||
def test_text_selector_schema(schema, valid_selections, invalid_selections) -> None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user