-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Internal: add Masonry
parent-sizing
integration test
- Loading branch information
1 parent
ce9eac7
commit 663b32e
Showing
3 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// @flow strict | ||
import { expect, test } from '@playwright/test'; | ||
import getGridItems from './utils/getGridItems.mjs'; | ||
import getServerURL from './utils/getServerURL.mjs'; | ||
|
||
// Hard-coded in docs/integration-test-helpers/masonry/MasonryContainer.js | ||
const EXPECTED_LEFT_MARGIN = 200; | ||
|
||
test.describe('Masonry: Parent Sizing', () => { | ||
test('starts the grid from the left bounding box of the parent', async ({ | ||
page, | ||
}) => { | ||
await page.goto( | ||
getServerURL({ virtualize: true, finiteLength: true, constrained: true }) | ||
); | ||
|
||
// Assert that all items follow the indentation of the grid. | ||
const gridItems = await getGridItems(page); | ||
|
||
for (let i = 0; i < gridItems.length; i += 1) { | ||
const itemRect = await gridItems[i].boundingBox(); | ||
expect(itemRect.x).toBeGreaterThanOrEqual(EXPECTED_LEFT_MARGIN); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters