Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
jperals committed Sep 20, 2023
1 parent 14d2dbc commit b2ca3ff
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/internal/components/dropdown/__integ__/width.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe('Dropdown width', () => {
expect(dropdownBox.left + dropdownBox.width).toBeLessThanOrEqual(pageWidth);
});
});
describe('updates between re-renders', () => {
describe('keeps not overflowing the viewport after re-rendering wider', () => {
const pageWidth = 500;
testForAllCases(
{ pageWidth, triggerWidth, asyncLoading: true },
Expand All @@ -145,13 +145,13 @@ describe('Dropdown width', () => {
page,
expandToViewport,
});
const oldWidth = dropdownBox.width;
expect(dropdownBox.left + dropdownBox.width).toBeLessThanOrEqual(pageWidth);
await expect(page.getText(dropdownSelector)).resolves.toContain('Loading');

Check warning on line 149 in src/internal/components/dropdown/__integ__/width.test.ts

View workflow job for this annotation

GitHub Actions / dry-run / Components integration tests

RETRY 1: Dropdown width › keeps not overflowing the viewport after re-rendering wider › expandToViewport: false › with multiselect

expect(received).resolves.toContain(expected) // indexOf Expected substring: "Loading" Received string: "A very very very very very very very very very very very very very very very very very very very very very very very very very very long text Short text" at Object.toContain (node_modules/expect/build/index.js:194:22) at src/internal/components/dropdown/__integ__/width.test.ts:149:63 at runMicrotasks (<anonymous>) at src/internal/components/dropdown/__integ__/width.test.ts:61:5 at node_modules/@cloudscape-design/browser-test-tools/dist/use-browser.js:28:13
await page.waitUntil(async () => (await page.getText(dropdownSelector)).includes('A very'), {
timeout: 1000,
});
const newWidth = (await page.getBoundingBox(dropdownSelector)).width;
expect(newWidth).toBeGreaterThan(oldWidth);
const newBox = await page.getBoundingBox(dropdownSelector);
expect(newBox.left + newBox.width).toBeLessThanOrEqual(pageWidth);
}
);
});
Expand Down

0 comments on commit b2ca3ff

Please sign in to comment.