fix: Improve Dropdown component handling of custom values and add regression test (#7486)
* ✨ (frontend): Add handleOnNewValue prop to Dropdown component to allow selecting a value not in the list 🔧 (frontend): Remove TODO comment and keep handleOnNewValue prop in DropdownComponent ✅ (frontend): Add test for selecting a value not in the list in Dropdown component * 🐛 (dropdownComponent/index.tsx): fix issue where custom value was not being added to validOptions and filteredOptions when pressing Enter ✨ (dropdownComponent/index.tsx): improve functionality to reset filtered options and custom value input when opening the dropdown * 🔧 (dropdownComponent/index.tsx): improve styling and layout of dropdown component for better user experience * ♻️ (dropdownComponent/index.tsx): remove unnecessary comments and improve code readability by removing redundant comments and separating render helper functions from logic blocks. * 📝 (dropdownComponent/index.tsx): add 'no-focus-visible' class to dropdown component to remove focus outline for better accessibility 📝 (applies.css): add styles for 'no-focus-visible' class to remove focus outline for better accessibility
This commit is contained in:
parent
7dd75a658c
commit
92bd92b1eb
4 changed files with 108 additions and 26 deletions
|
|
@ -0,0 +1,44 @@
|
|||
import { expect, test } from "@playwright/test";
|
||||
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
|
||||
|
||||
test(
|
||||
"user must be able to select a value from dropdown that is not in the list",
|
||||
{ tag: ["@release", "@components"] },
|
||||
async ({ page }) => {
|
||||
await awaitBootstrapTest(page);
|
||||
|
||||
await page.waitForSelector('[data-testid="blank-flow"]', {
|
||||
timeout: 30000,
|
||||
});
|
||||
await page.getByTestId("blank-flow").click();
|
||||
await page.getByTestId("sidebar-search-input").click();
|
||||
await page.getByTestId("sidebar-search-input").fill("openai");
|
||||
|
||||
await page.waitForSelector('[data-testid="modelsOpenAI"]', {
|
||||
timeout: 1000,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByTestId("modelsOpenAI")
|
||||
.hover()
|
||||
.then(async () => {
|
||||
await page.getByTestId("add-component-button-openai").last().click();
|
||||
});
|
||||
|
||||
await page.getByTestId("fit_view").click();
|
||||
|
||||
await page.getByTestId("dropdown_str_model_name").click();
|
||||
await page.getByTestId("dropdown_search_input").click();
|
||||
await page
|
||||
.getByTestId("dropdown_search_input")
|
||||
.fill("this is a test langflow");
|
||||
await page.keyboard.press("Enter");
|
||||
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
const value = await page
|
||||
.getByTestId("value-dropdown-dropdown_str_model_name")
|
||||
.textContent();
|
||||
expect(value?.trim()).toBe("this is a test langflow");
|
||||
},
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue