mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-03-27 02:13:03 -04:00
This is for preventing that a markdown button is recognized as button for submission in a html form. Buttons can't be stripped from the markdown due to: https://codeberg.org/forgejo/forgejo/pulls/7670#issuecomment-4086608 There is no issue with buttons if they always have `type="button"`, so this should be fine. This is a "follow-up" to !7670. Fixes #7656 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10520 Reviewed-by: Otto <otto@codeberg.org> Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Beowulf <beowulf@beocode.eu> Co-committed-by: Beowulf <beowulf@beocode.eu>
34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
// Copyright 2025 The Forgejo Authors. All rights reserved.
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
// @watch start
|
|
// modules/markup/**
|
|
// web_src/js/features/repo-unicode-escape.js
|
|
// @watch end
|
|
|
|
import {expect} from '@playwright/test';
|
|
import {dynamic_id, test} from './utils_e2e.ts';
|
|
|
|
test.use({user: 'user2'});
|
|
|
|
test('Escape button in file preview', async ({page}) => {
|
|
await page.goto('/user2/unicode-escaping/src/branch/main/a-file');
|
|
|
|
const url = await page.getByRole('link', {name: 'Permalink'}).getAttribute('href');
|
|
|
|
const response = await page.goto('/user2/repo1/issues/new');
|
|
expect(response?.status()).toBe(200);
|
|
|
|
// Create a new issue
|
|
await page.getByPlaceholder('Title').fill(dynamic_id());
|
|
await page.getByPlaceholder('Leave a comment').fill(`http://localhost:3003${url}#L1`);
|
|
await page.getByRole('button', {name: 'Create issue'}).click();
|
|
|
|
await expect(page).toHaveURL(/\/user2\/repo1\/issues\/\d+$/);
|
|
|
|
await expect(page.locator('table.file-preview.unicode-escaped')).toHaveCount(0);
|
|
await expect(async () => {
|
|
await page.locator('button.toggle-escape-button').click();
|
|
await expect(page.locator('table.file-preview.unicode-escaped')).toHaveCount(1);
|
|
}).toPass();
|
|
});
|