mirror of
https://github.com/gradio-app/gradio.git
synced 2025-04-06 12:30:29 +08:00
Allow reselecting the original option in gr.Dropdown
after value has changed programmatically (#6517)
* fix * add changeset --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
parent
c59b87d7b5
commit
901f3eebda
6
.changeset/nine-bats-sin.md
Normal file
6
.changeset/nine-bats-sin.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"@gradio/dropdown": minor
|
||||
"gradio": minor
|
||||
---
|
||||
|
||||
feat:Allow reselecting the original option in `gr.Dropdown` after value has changed programmatically
|
@ -364,5 +364,10 @@ describe("Dropdown", () => {
|
||||
expect(item.value).toBe("");
|
||||
options = getAllByTestId("dropdown-option");
|
||||
expect(options[0]).not.toHaveClass("selected");
|
||||
|
||||
await component.$set({ value: "zebra" });
|
||||
expect(item.value).toBe("zebra");
|
||||
options = getAllByTestId("dropdown-option");
|
||||
expect(options[0]).toHaveClass("selected");
|
||||
});
|
||||
});
|
||||
|
@ -116,6 +116,7 @@
|
||||
input_text = "";
|
||||
selected_index = null;
|
||||
}
|
||||
old_selected_index = selected_index;
|
||||
}
|
||||
|
||||
function handle_option_selected(e: any): void {
|
||||
|
Loading…
x
Reference in New Issue
Block a user