Skip to content
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

Font collection pagination: add min height to avoid infinite number #59241

Merged
merged 3 commits into from
Feb 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add min height to avoid infinite number
matiasbenedetto committed Feb 21, 2024
commit afd078ae005177bf8c720fe3091dc4b74700cdce
Original file line number Diff line number Diff line change
@@ -41,6 +41,9 @@ const DEFAULT_CATEGORY = {
slug: 'all',
name: _x( 'All', 'font categories' ),
};

const MIN_WINDOW_HEIGHT = 500;

function FontCollection( { slug } ) {
const requiresPermission = slug === 'google-fonts';

@@ -118,7 +121,11 @@ function FontCollection( { slug } ) {

// NOTE: The height of the font library modal unavailable to use for rendering font family items is roughly 417px
// The height of each font family item is 61px.
const pageSize = Math.floor( ( window.innerHeight - 417 ) / 61 );
const windowHeight =
window.innerHeight <= MIN_WINDOW_HEIGHT
? MIN_WINDOW_HEIGHT
: window.innerHeight;
matiasbenedetto marked this conversation as resolved.
Show resolved Hide resolved
const pageSize = Math.floor( ( windowHeight - 417 ) / 61 );
const totalPages = Math.ceil( fonts.length / pageSize );
const itemsStart = ( page - 1 ) * pageSize;
const itemsLimit = page * pageSize;

Unchanged files with check annotations Beta

} );
// Open the options menu.
await firstItemOptions.click();

Check failure on line 419 in test/e2e/specs/editor/blocks/navigation-list-view.spec.js

GitHub Actions / Playwright - 2

[chromium] › editor/blocks/navigation-list-view.spec.js:385:2 › Navigation block - List view editing › can add submenus

1) [chromium] › editor/blocks/navigation-list-view.spec.js:385:2 › Navigation block - List view editing › can add submenus TimeoutError: locator.click: Timeout 10000ms exceeded. =========================== logs =========================== waiting for getByRole('treegrid', { name: 'Block navigation structure' }).getByRole('gridcell', { name: 'Page Link' }).filter({ hasText: 'Block 1 of 2, Level 1' }).locator('xpath=..').getByRole('button', { name: 'Options for Page Link' }) ============================================================ 417 | 418 | // Open the options menu. > 419 | await firstItemOptions.click(); | ^ 420 | 421 | // Add the submenu. 422 | // usage of `page` is required because the options menu is rendered into a slot at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/navigation-list-view.spec.js:419:26
// Add the submenu.
// usage of `page` is required because the options menu is rendered into a slot
name: 'Block: Page List',
} );
await expect( pageListBlock ).toBeVisible( {

Check failure on line 34 in test/e2e/specs/editor/blocks/navigation.spec.js

GitHub Actions / Playwright - 2

[chromium] › editor/blocks/navigation.spec.js:23:3 › Navigation block › As a user I want the navigation block to fallback to the best possible default › default to a list of pages if there are no menus

2) [chromium] › editor/blocks/navigation.spec.js:23:3 › Navigation block › As a user I want the navigation block to fallback to the best possible default › default to a list of pages if there are no menus Error: Timed out 10000ms waiting for expect(locator).toBeVisible() Locator: frameLocator('[name="editor-canvas"]').getByRole('document', { name: 'Block: Page List' }) Expected: visible Received: hidden Call log: - expect.toBeVisible with timeout 10000ms - waiting for frameLocator('[name="editor-canvas"]').getByRole('document', { name: 'Block: Page List' }) 32 | } ); 33 | > 34 | await expect( pageListBlock ).toBeVisible( { | ^ 35 | // Wait for the Nav and Page List block API requests to resolve. 36 | // Note: avoid waiting on network requests as these are not perceivable 37 | // to the user. at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/navigation.spec.js:34:34

Check failure on line 34 in test/e2e/specs/editor/blocks/navigation.spec.js

GitHub Actions / Playwright - 2

[chromium] › editor/blocks/navigation.spec.js:23:3 › Navigation block › As a user I want the navigation block to fallback to the best possible default › default to a list of pages if there are no menus

2) [chromium] › editor/blocks/navigation.spec.js:23:3 › Navigation block › As a user I want the navigation block to fallback to the best possible default › default to a list of pages if there are no menus Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 10000ms waiting for expect(locator).toBeVisible() Locator: frameLocator('[name="editor-canvas"]').getByRole('document', { name: 'Block: Page List' }) Expected: visible Received: hidden Call log: - expect.toBeVisible with timeout 10000ms - waiting for frameLocator('[name="editor-canvas"]').getByRole('document', { name: 'Block: Page List' }) 32 | } ); 33 | > 34 | await expect( pageListBlock ).toBeVisible( { | ^ 35 | // Wait for the Nav and Page List block API requests to resolve. 36 | // Note: avoid waiting on network requests as these are not perceivable 37 | // to the user. at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/navigation.spec.js:34:34
// Wait for the Nav and Page List block API requests to resolve.
// Note: avoid waiting on network requests as these are not perceivable
// to the user.