mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
feat(ui): add switch between formats when previewing CITATION.{cff,bib} files (#9103)
See #8222 for context (loosely related to #4595). ## Implemented changes The conversion logic is kept in the frontend and the related npm libraries are lazy-loaded (unchanged). ### Show some tabs on the preview of the `CITATION.*` file to switch between the formats:   ### Convert the "Cite repository" to a simple link to the citation file So that this change can be considered non-breaking ## Current state (before this PR) The last non-test call of `git.Blob.GetBlobContent` is made to retrieve the content of an eventual CITATION file. This is available in the `...` menu near the clone URL:  And is displayed as a popup:  Co-authored-by: 0ko <0ko@noreply.codeberg.org> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9103 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: oliverpool <git@olivier.pfad.fr> Co-committed-by: oliverpool <git@olivier.pfad.fr>
This commit is contained in:
parent
0737196842
commit
8f28cdefe0
23 changed files with 225 additions and 195 deletions
47
tests/e2e/repo-viewer.test.e2e.ts
Normal file
47
tests/e2e/repo-viewer.test.e2e.ts
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
// Copyright 2025 The Forgejo Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// @watch start
|
||||
// web_src/js/webcomponents/citation-information.js
|
||||
// @watch end
|
||||
|
||||
import {expect} from '@playwright/test';
|
||||
import {test} from './utils_e2e.ts';
|
||||
|
||||
test('CITATION.cff switch', async ({page}) => {
|
||||
const previewPath = '/user2/rendering-test/src/branch/master/CITATION.cff';
|
||||
|
||||
const response = await page.goto(previewPath);
|
||||
expect(response?.status()).toBe(200);
|
||||
|
||||
await expect(page.getByText('cff-version: 1.2.0')).toBeVisible();
|
||||
|
||||
await page.getByRole('button', {name: 'BibTeX'}).click();
|
||||
await expect(page.getByText('cff-version: 1.2.0')).toBeHidden();
|
||||
await expect(
|
||||
page.getByText('howpublished = {https://forgejo.org/},'),
|
||||
).toBeVisible();
|
||||
|
||||
await page.getByRole('button', {name: 'Citation File Format'}).click();
|
||||
await expect(page.getByText('cff-version: 1.2.0')).toBeVisible();
|
||||
});
|
||||
|
||||
test('glb file with 3D rendering', async ({page}, workerInfo) => {
|
||||
test.skip(
|
||||
workerInfo.project.name !== 'chromium',
|
||||
'needs some investigation to run on other platforms',
|
||||
// https://codeberg.org/forgejo/forgejo/actions/runs/113344/jobs/3/attempt/1
|
||||
);
|
||||
|
||||
const previewPath =
|
||||
'/user2/rendering-test/src/branch/master/Unicode❤♻Test.glb';
|
||||
|
||||
const response = await page.goto(previewPath);
|
||||
expect(response?.status()).toBe(200);
|
||||
|
||||
await page
|
||||
.getByRole('img', {
|
||||
name: '3D model. Use mouse, touch or arrow keys to move.',
|
||||
})
|
||||
.click();
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue