Remove extra_options from PromptOptionPicker
This commit is contained in:
@@ -34,15 +34,6 @@ class PromptOptionPicker:
|
||||
},
|
||||
),
|
||||
},
|
||||
"optional": {
|
||||
"extra_options": (
|
||||
"STRING",
|
||||
{
|
||||
"forceInput": True,
|
||||
"tooltip": "External options prepended to the options field.",
|
||||
},
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING",)
|
||||
@@ -55,18 +46,9 @@ class PromptOptionPicker:
|
||||
return "options cannot be empty"
|
||||
return True
|
||||
|
||||
def process(self, options, selected, extra_options=None):
|
||||
combined = ""
|
||||
if extra_options and extra_options.strip():
|
||||
combined = extra_options.strip() + "\n" + options
|
||||
else:
|
||||
combined = options
|
||||
|
||||
if not combined.strip():
|
||||
raise ValueError("PromptOptionPicker: options cannot be empty.")
|
||||
|
||||
def process(self, options, selected):
|
||||
# Validate only, JS handles the dropdown
|
||||
parse_options(combined)
|
||||
parse_options(options)
|
||||
|
||||
# -- displays an empty string
|
||||
return ("" if selected == "--" else selected,)
|
||||
|
||||
@@ -41,28 +41,6 @@ def test_whitespace_only_lines(node):
|
||||
assert value == ""
|
||||
|
||||
|
||||
# --- Extra options ---
|
||||
|
||||
|
||||
def test_extra_options_prepended(node):
|
||||
# extra_options are handled by JS, process just returns selected
|
||||
(value,) = node.process(
|
||||
options="sitting down\nstanding up",
|
||||
selected="from extra",
|
||||
extra_options="from extra\nother extra",
|
||||
)
|
||||
assert value == "from extra"
|
||||
|
||||
|
||||
def test_extra_options_none(node):
|
||||
(value,) = node.process(
|
||||
options="sitting down",
|
||||
selected="sitting down",
|
||||
extra_options=None,
|
||||
)
|
||||
assert value == "sitting down"
|
||||
|
||||
|
||||
# --- VALIDATE_INPUTS ---
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user