mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-03-25 12:13:54 -04:00
Some checks are pending
/ release (push) Waiting to run
testing-integration / test-unit (push) Waiting to run
testing-integration / test-sqlite (push) Waiting to run
testing-integration / test-mariadb (v10.6) (push) Waiting to run
testing-integration / test-mariadb (v11.8) (push) Waiting to run
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-e2e (push) Blocked by required conditions
testing / test-remote-cacher (redis) (push) Blocked by required conditions
testing / test-remote-cacher (valkey) (push) Blocked by required conditions
testing / test-remote-cacher (garnet) (push) Blocked by required conditions
testing / test-remote-cacher (redict) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions
When new content is added via JS and htmx is not used for this change, htmx need to be informed that DOM changes happened and that it needs to reprocess the DOM (or at least the changed parts). When a diff is really large, it is hidden by default. The user can press a button to load the diff, which then will be added via JS. The diff contains buttons to expand it, which are using htmx behind the scenes. Therefore a reprocessing via htmx needs to be triggered after adding the large diff. Fixes #10570 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10572 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Beowulf <beowulf@beocode.eu> Co-committed-by: Beowulf <beowulf@beocode.eu>
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
// Copyright 2025 The Forgejo Authors. All rights reserved.
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
// @watch start
|
|
// templates/repo/diff/**
|
|
// web_src/css/review.css
|
|
// web_src/js/features/repo-diff.js
|
|
// @watch end
|
|
|
|
import {expect} from '@playwright/test';
|
|
import {test} from './utils_e2e.ts';
|
|
|
|
test.use({user: 'user2'});
|
|
|
|
test('Expand Large diff', async ({page}) => {
|
|
let response = await page.goto('/user2/huge-diff-test/src/branch/main-2', {waitUntil: 'domcontentloaded'});
|
|
expect(response?.status()).toBe(200);
|
|
|
|
const commitUrl = await page.locator('.commit-summary a').getAttribute('href');
|
|
|
|
response = await page.goto(commitUrl, {waitUntil: 'domcontentloaded'});
|
|
expect(response?.status()).toBe(200);
|
|
|
|
const loadDiff = page.locator('.diff-load-button');
|
|
const expandDiff = page.locator('.code-expander-button');
|
|
const diffLines = page.locator('.file-body tbody > tr');
|
|
|
|
await expect(loadDiff).toBeVisible();
|
|
|
|
loadDiff.click();
|
|
await page.waitForLoadState('load');
|
|
|
|
await expect(expandDiff).toHaveCount(167);
|
|
await expect(diffLines).toHaveCount(1495);
|
|
|
|
await expandDiff.first().click();
|
|
await page.waitForLoadState('load');
|
|
|
|
await expect(expandDiff).toHaveCount(166);
|
|
await expect(diffLines).toHaveCount(1502);
|
|
});
|