-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: create a common resource to store debounce consts #9829
Changes from 18 commits
bacbd2e
f97ca1f
9c06117
b1a72d9
c1c8025
28c8891
3273579
3e73d6f
de19329
27e8ea9
54d5aa2
5b52a5c
2efff3a
d3eb8bd
953159b
287a968
e150d77
93a3080
2c02b04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ import { CSS as ComboboxItemCSS } from "../combobox-item/resources"; | |
import { CSS as XButtonCSS } from "../functional/XButton"; | ||
import { getElementXY, newProgrammaticE2EPage, skipAnimations } from "../../tests/utils"; | ||
import { assertCaretPosition } from "../../tests/utils"; | ||
import { DEBOUNCE } from "../../utils/resources"; | ||
import { CSS } from "./resources"; | ||
|
||
const selectionModes = ["single", "single-persist", "ancestors", "multiple"]; | ||
|
@@ -201,6 +202,7 @@ describe("calcite-combobox", () => { | |
|
||
await combobox.type(text); | ||
await page.waitForChanges(); | ||
await page.waitForTimeout(DEBOUNCE.filter); | ||
|
||
expect(await combobox.getProperty("open")).toBe(true); | ||
|
||
|
@@ -209,6 +211,7 @@ describe("calcite-combobox", () => { | |
} | ||
|
||
await page.waitForChanges(); | ||
await page.waitForTimeout(DEBOUNCE.filter); | ||
expect(await combobox.getProperty("open")).toBe(false); | ||
}); | ||
|
||
|
@@ -256,6 +259,7 @@ describe("calcite-combobox", () => { | |
await page.waitForChanges(); | ||
|
||
await input.type("undefined"); | ||
await page.waitForTimeout(DEBOUNCE.filter); | ||
await page.waitForChanges(); | ||
|
||
expect(await items[0].isVisible()).toBe(false); | ||
|
@@ -287,6 +291,7 @@ describe("calcite-combobox", () => { | |
|
||
await combobox.press("s"); | ||
await page.waitForChanges(); | ||
await page.waitForTimeout(DEBOUNCE.filter); | ||
expect(filterEventSpy).toHaveReceivedEventTimes(1); | ||
|
||
expect(await items[0].isVisible()).toBe(true); | ||
|
@@ -299,6 +304,7 @@ describe("calcite-combobox", () => { | |
|
||
await combobox.press("i"); | ||
await page.waitForChanges(); | ||
await page.waitForTimeout(DEBOUNCE.filter); | ||
expect(filterEventSpy).toHaveReceivedEventTimes(2); | ||
|
||
expect(await items[0].isVisible()).toBe(true); | ||
|
@@ -311,6 +317,7 @@ describe("calcite-combobox", () => { | |
|
||
await combobox.press("n"); | ||
await page.waitForChanges(); | ||
await page.waitForTimeout(DEBOUNCE.filter); | ||
expect(filterEventSpy).toHaveReceivedEventTimes(3); | ||
|
||
expect(await items[0].isVisible()).toBe(true); | ||
|
@@ -342,6 +349,7 @@ describe("calcite-combobox", () => { | |
await page.waitForChanges(); | ||
await combobox.type("Algeria"); | ||
await page.waitForChanges(); | ||
await page.waitForTimeout(DEBOUNCE.filter); | ||
|
||
const [lastItemX, lastItemY] = await getElementXY(page, "#item-4"); | ||
|
||
|
@@ -369,6 +377,7 @@ describe("calcite-combobox", () => { | |
await page.waitForChanges(); | ||
await combobox.type("two"); | ||
await page.waitForChanges(); | ||
await page.waitForTimeout(DEBOUNCE.filter); | ||
const one = await (await page.find("#one")).isVisible(); | ||
const two = await (await page.find("#two")).isVisible(); | ||
const three = await (await page.find("#three")).isVisible(); | ||
|
@@ -407,6 +416,7 @@ describe("calcite-combobox", () => { | |
const page = await newE2EPage(); | ||
await page.setContent(html` <calcite-combobox filter-text="1.2"> ${nestedComboboxChildren} </calcite-combobox> `); | ||
await page.waitForChanges(); | ||
await page.waitForTimeout(DEBOUNCE.filter); | ||
|
||
const visibleItemsAndGroups = await page.findAll( | ||
"calcite-combobox-item:not([hidden]), calcite-combobox-item-group:not([hidden])", | ||
|
@@ -434,6 +444,7 @@ describe("calcite-combobox", () => { | |
const combobox = await page.find("calcite-combobox"); | ||
combobox.setProperty("filterText", "1.2"); | ||
await page.waitForChanges(); | ||
await page.waitForTimeout(DEBOUNCE.filter); | ||
|
||
const filteredItemsAndGroups = await page.findAll( | ||
"calcite-combobox-item:not([hidden]), calcite-combobox-item-group:not([hidden])", | ||
|
@@ -454,6 +465,7 @@ describe("calcite-combobox", () => { | |
|
||
combobox.setProperty("filterText", ""); | ||
await page.waitForChanges(); | ||
await page.waitForTimeout(DEBOUNCE.filter); | ||
|
||
const allVisibleItemAndGroups = await page.findAll( | ||
"calcite-combobox-item:not([hidden]), calcite-combobox-item-group:not([hidden])", | ||
|
@@ -500,10 +512,13 @@ describe("calcite-combobox", () => { | |
}); | ||
|
||
await page.waitForChanges(); | ||
await page.waitForTimeout(DEBOUNCE.filter); | ||
|
||
const combobox = await page.find("calcite-combobox"); | ||
combobox.setProperty("filterText", "foo"); | ||
|
||
await page.waitForChanges(); | ||
await page.waitForTimeout(DEBOUNCE.filter); | ||
|
||
const visibleItems = await page.findAll("calcite-combobox-item:not([hidden])"); | ||
|
||
|
@@ -1733,11 +1748,30 @@ describe("calcite-combobox", () => { | |
const button = await page.find("button"); | ||
await input.click(); | ||
await input.press("o"); | ||
|
||
await page.waitForChanges(); | ||
await page.waitForTimeout(DEBOUNCE.filter); | ||
|
||
await input.press("Tab"); | ||
|
||
await page.waitForChanges(); | ||
await page.waitForTimeout(DEBOUNCE.filter); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a follow-up, let's see if this extra pair of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good, I'm removing that waitForX double, seem so to pass without it. |
||
|
||
await page.waitForChanges(); | ||
await page.waitForTimeout(DEBOUNCE.filter); | ||
|
||
let chips = await page.findAll("calcite-combobox >>> calcite-chip"); | ||
expect(chips.length).toBe(1); | ||
await input.press("j"); | ||
|
||
await page.waitForChanges(); | ||
await page.waitForTimeout(DEBOUNCE.filter); | ||
|
||
await button.click(); | ||
|
||
await page.waitForChanges(); | ||
await page.waitForTimeout(DEBOUNCE.filter); | ||
|
||
chips = await page.findAll("calcite-combobox >>> calcite-chip"); | ||
expect(chips.length).toBe(2); | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,3 @@ export const ICONS = { | |
search: "search", | ||
close: "x", | ||
} as const; | ||
|
||
export const DEBOUNCE_TIMEOUT = 250; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨🧹✨