mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 23:33:15 -05:00
4fbdd1fc8c
Port ofd11f8d24b0
. Followup to187e10d8c9
. * removed `aria-label` in the diff template * changed `Copy to clipboard` to `Copy path` * left `copy_generic` for now, but it's unused * ported the addition of this button to the file view template Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6079 Reviewed-by: Otto <otto@codeberg.org> Co-authored-by: silverwind <me@silverwind.io>
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
// Copyright 2024 The Forgejo Authors. All rights reserved.
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
// @watch start
|
|
// templates/repo/home.tmpl
|
|
// templates/repo/diff/box.tmpl
|
|
// web_src/js/features/clipboard.js
|
|
// @watch end
|
|
|
|
import {expect} from '@playwright/test';
|
|
import {test} from './utils_e2e.ts';
|
|
|
|
test.use({
|
|
permissions: ['clipboard-write'],
|
|
});
|
|
|
|
test('copy src file path to clipboard', async ({page}) => {
|
|
const response = await page.goto('/user2/repo1/src/branch/master/README.md');
|
|
expect(response?.status()).toBe(200);
|
|
|
|
await page.click('[data-clipboard-text]');
|
|
const clipboardText = await page.evaluate(() => navigator.clipboard.readText());
|
|
expect(clipboardText).toContain('README.md');
|
|
});
|
|
|
|
test('copy diff file path to clipboard', async ({page}) => {
|
|
const response = await page.goto('/user2/repo1/src/commit/65f1bf27bc3bf70f64657658635e66094edbcb4d/README.md');
|
|
expect(response?.status()).toBe(200);
|
|
|
|
await page.click('[data-clipboard-text]');
|
|
const clipboardText = await page.evaluate(() => navigator.clipboard.readText());
|
|
expect(clipboardText).toContain('README.md');
|
|
});
|