mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-30 08:40:52 +08:00
Use Raw button to navigate to raw file
For toggling Markdown view, we add a button that either shows `Plain` or `Markdown`. Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
@@ -118,7 +118,7 @@
|
||||
margin-right: 0.25rem;
|
||||
}
|
||||
|
||||
.markdown-toggle {
|
||||
.toggle {
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
|
||||
@@ -228,15 +228,15 @@
|
||||
</span>
|
||||
<div class="right">
|
||||
{#if isMarkdown}
|
||||
<div class="markdown-toggle">
|
||||
<SquareButton
|
||||
active={!showMarkdown}
|
||||
clickable
|
||||
on:click={toggleMarkdown}>
|
||||
Raw
|
||||
<div class="toggle">
|
||||
<SquareButton clickable on:click={toggleMarkdown}>
|
||||
{showMarkdown ? "Plain" : "Markdown"}
|
||||
</SquareButton>
|
||||
</div>
|
||||
{/if}
|
||||
<a href="{rawPath}/{blob.path}" class="toggle">
|
||||
<SquareButton clickable>Raw</SquareButton>
|
||||
</a>
|
||||
<div class="last-commit" title={lastCommit.author.name} use:twemoji>
|
||||
<span class="hash">
|
||||
{lastCommit.id.slice(0, 7)}
|
||||
|
||||
@@ -96,7 +96,7 @@ test("source file highlighting", async ({ page }) => {
|
||||
|
||||
test("navigate line numbers", async ({ page }) => {
|
||||
await page.goto(`${projectFixtureUrl}/tree/main/markdown/cheatsheet.md`);
|
||||
await page.locator(".markdown-toggle").click();
|
||||
await page.locator('text="Plain"').click();
|
||||
|
||||
await page.locator('[href="#L5"]').click();
|
||||
await expect(page.locator("#L5")).toHaveClass("line highlight");
|
||||
@@ -231,14 +231,12 @@ test("markdown files", async ({ page }) => {
|
||||
|
||||
// Switch between raw and rendered modes.
|
||||
{
|
||||
const rawButton = page.locator(".markdown-toggle .square-button");
|
||||
|
||||
await rawButton.click();
|
||||
await expect(rawButton).toHaveClass(/active/);
|
||||
const plainButton = page.locator('text="Plain"');
|
||||
await plainButton.click();
|
||||
await expect(page.locator("text=##### Table of Contents")).toBeVisible();
|
||||
|
||||
await rawButton.click();
|
||||
await expect(rawButton).not.toHaveClass("active");
|
||||
const markdownButton = page.locator('text="Markdown"');
|
||||
await markdownButton.click();
|
||||
}
|
||||
|
||||
// Internal links go to anchor.
|
||||
|
||||
Reference in New Issue
Block a user