mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
Add to html button in markdown type="button" (#10520)
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>
This commit is contained in:
parent
e04ae29d0d
commit
d436de90b1
5 changed files with 97 additions and 1 deletions
34
tests/e2e/issue-comment-file-preview.test.e2e.ts
Normal file
34
tests/e2e/issue-comment-file-preview.test.e2e.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
// 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();
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue