Skip to content

Commit

Permalink
Internal: add render-height Masonry integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
dangerismycat committed Mar 2, 2023
1 parent abfc2b9 commit 06da91a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions playwright/masonry/render-height.spec.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// @flow strict
import { expect, test } from '@playwright/test';
import getGridItems from './utils/getGridItems.mjs';
import getServerURL from './utils/getServerURL.mjs';
import selectors from './utils/selectors.mjs';

test.describe('Masonry: Render height', () => {
test('allows items to be positioned under the grid', async ({ page }) => {
await page.goto(getServerURL({ virtualize: true, finiteLength: true }));

const gridItems = await getGridItems(page);
expect(gridItems.length).toBeGreaterThan(0);

let bottomItem = 0;
for (let i = 0; i < gridItems.length; i += 1) {
const itemRect = await gridItems[i].boundingBox();
// eslint-disable-next-line playwright/no-conditional-in-test
if (itemRect.y > bottomItem) {
bottomItem = itemRect.y + itemRect.height;
}
}

const afterGrid = await page.locator(selectors.afterGrid);
const afterGridRect = await afterGrid.boundingBox();
expect(afterGridRect.y).toBeGreaterThanOrEqual(bottomItem);
});
});

0 comments on commit 06da91a

Please sign in to comment.