+
+ Bug #2333: Dropdown Reset Test
+
+
+
+ This test demonstrates the dropdown reset issue. When dropdown items are dynamically
+ removed, the dropdown should properly sync its internal state to reflect the updated
+ list of options.
+
+
+
+ Test Scenario
+
+
+
+ 1. Select a color from the dropdown below
+
+
+ 2. Click one of the buttons to reduce the number of available options
+
+
+ 3. Open the dropdown again - it should only show the remaining options
+
+
+ 4. The bug occurred when the filtered options weren't synced after items were destroyed
+
+
+
+ Currently showing {colors.length} color(s): {colors.join(", ")}
+
+
+
+ Selected value: {selectedColor || "None"}
+
+
+
+ {colors.map((color) => (
+
+ ))}
+
+
+
+
+ Reduce to 1 item (blue)
+
+
+ Reduce to 2 items (green, yellow)
+
+
+ Reset to all items
+
+
+
+
+ Expected behavior: After clicking a reduction button, opening the
+ dropdown should only display the items that remain in the list.
+
+
+ Bug behavior (before fix): The dropdown would still show all original
+ items even after they were removed, because syncFilteredOptions() wasn't called when
+ child items were destroyed.
+
+
+ );
+}
diff --git a/libs/react-components/specs/dropdown.browser.spec.tsx b/libs/react-components/specs/dropdown.browser.spec.tsx
index 23483cf82..c7d5b0dd5 100644
--- a/libs/react-components/specs/dropdown.browser.spec.tsx
+++ b/libs/react-components/specs/dropdown.browser.spec.tsx
@@ -585,4 +585,48 @@ describe("Dropdown", () => {
});
})
})
+
+ describe("Dropdown reset", () => {
+ it("should reduce the number of element displayed within the dropdown", async () => {
+ let values: string[] = ["red", "blue", "green"]
+
+ const Component = () => {
+ return (
+