From 9e9fde6195d879defe08af28168bcc07c16f777d Mon Sep 17 00:00:00 2001 From: Will Date: Sun, 13 Sep 2026 12:55:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(web-demo):=20=E6=96=B0=E5=A2=9E=20GitH?= =?UTF-8?q?ub=20=E5=84=B2=E5=AD=98=E5=BA=AB=E9=80=A3=E7=B5=90=E5=9C=96?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在 Browser Lab 頂端列最右側新增 GitHub 圖示,讓使用者能直接回到 MiniExcel.Rust 上游儲存庫,並維持桌面版與行動版的頂端列版面。 實作內容: - 使用原生 anchor 元素連結至 https://github.com/mini-software/MiniExcel-Rust。 - 以內嵌 SVG 呈現 GitHub 標誌,並以 aria-label 提供可存取名稱。 - 使用 target="_blank" 與 rel="noopener noreferrer" 開啟外部儲存庫。 - 新增一般、滑鼠移入與鍵盤 focus 狀態的圖示按鈕樣式。 - 將 GitHub 連結加入 Browser Lab 桌面版與行動版 E2E 覆蓋範圍。 影響範圍: - web-demo/public/index.html:新增右上角 GitHub 連結與可存取的 SVG 圖示。 - web-demo/public/styles.css:新增 GitHub 圖示連結的尺寸、色彩與互動樣式。 - web-demo/tests/browser.spec.mjs:驗證 GitHub 連結的可見名稱與目標網址。 驗證項目: - npm ci - npm run build - npm run test:e2e:14 項通過、4 項依既有桌面/行動版篩選條件跳過。 - 桌面版與 Pixel 7 行動版截圖檢查:圖示位於右上角,且沒有橫向溢位。 --- web-demo/public/index.html | 12 ++++++++++++ web-demo/public/styles.css | 25 +++++++++++++++++++++++++ web-demo/tests/browser.spec.mjs | 6 +++++- 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/web-demo/public/index.html b/web-demo/public/index.html index 40f7312..fe7b340 100644 --- a/web-demo/public/index.html +++ b/web-demo/public/index.html @@ -50,6 +50,18 @@ .NET Rust + + + diff --git a/web-demo/public/styles.css b/web-demo/public/styles.css index 620d13b..5623f22 100644 --- a/web-demo/public/styles.css +++ b/web-demo/public/styles.css @@ -190,6 +190,31 @@ input:disabled { background: var(--ink); } +.github-link { + width: 34px; + height: 34px; + display: inline-grid; + place-items: center; + flex: 0 0 auto; + color: var(--ink); + background: var(--surface); + border: 1px solid var(--line); + border-radius: 6px; + transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease; +} + +.github-link:hover { + color: var(--green); + background: var(--green-soft); + border-color: var(--green); +} + +.github-link svg { + width: 18px; + height: 18px; + fill: currentColor; +} + .workspace { min-height: 0; display: grid; diff --git a/web-demo/tests/browser.spec.mjs b/web-demo/tests/browser.spec.mjs index 8cad3a2..964eb3f 100644 --- a/web-demo/tests/browser.spec.mjs +++ b/web-demo/tests/browser.spec.mjs @@ -12,6 +12,10 @@ for (const project of ["desktop", "mobile"]) { await expect(implementation.getByRole("link", { name: ".NET" })).toHaveAttribute("href", "/MiniExcel/"); await expect(implementation.getByRole("link", { name: "Rust" })).toHaveAttribute("href", "/MiniExcel-Rust/"); await expect(implementation.getByRole("link", { name: "Rust" })).toHaveAttribute("aria-current", "page"); + await expect(page.getByRole("link", { name: "View MiniExcel Rust on GitHub" })).toHaveAttribute( + "href", + "https://github.com/mini-software/MiniExcel-Rust", + ); await expect(page.getByTestId("file-name")).toHaveText("miniexcel-browser-demo.xlsx"); await expect(page.getByRole("cell", { name: "MiniExcel", exact: true })).toBeVisible(); await expect(page.getByRole("cell", { name: "Browser WASM", exact: true })).toBeVisible(); @@ -193,4 +197,4 @@ test("uploaded workbook shows metadata and requires hidden-sheet RAG opt-in", as await expect(page.locator("#previewTitle")).toContainText(visibleSheet); await expect(page.locator("#resultEyebrow")).toHaveText("Markdown conversion"); await expect(page.locator("#downloadMarkdownButton")).toBeEnabled(); -}); \ No newline at end of file +}); From 5e2d04ea465fe5ae7870e2702d7bdec395e8a12e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Will=20=E4=BF=9D=E5=93=A5?= <88981+doggy8088@users.noreply.github.com> Date: Sun, 13 Sep 2026 21:20:24 +0800 Subject: [PATCH 2/2] Refactor GitHub link expectation in tests Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- web-demo/tests/browser.spec.mjs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/web-demo/tests/browser.spec.mjs b/web-demo/tests/browser.spec.mjs index 964eb3f..d963060 100644 --- a/web-demo/tests/browser.spec.mjs +++ b/web-demo/tests/browser.spec.mjs @@ -12,10 +12,13 @@ for (const project of ["desktop", "mobile"]) { await expect(implementation.getByRole("link", { name: ".NET" })).toHaveAttribute("href", "/MiniExcel/"); await expect(implementation.getByRole("link", { name: "Rust" })).toHaveAttribute("href", "/MiniExcel-Rust/"); await expect(implementation.getByRole("link", { name: "Rust" })).toHaveAttribute("aria-current", "page"); - await expect(page.getByRole("link", { name: "View MiniExcel Rust on GitHub" })).toHaveAttribute( + const githubLink = page.getByRole("link", { name: "View MiniExcel Rust on GitHub" }); + await expect(githubLink).toHaveAttribute( "href", "https://github.com/mini-software/MiniExcel-Rust", ); + await expect(githubLink).toHaveAttribute("target", "_blank"); + await expect(githubLink).toHaveAttribute("rel", "noopener noreferrer"); await expect(page.getByTestId("file-name")).toHaveText("miniexcel-browser-demo.xlsx"); await expect(page.getByRole("cell", { name: "MiniExcel", exact: true })).toBeVisible(); await expect(page.getByRole("cell", { name: "Browser WASM", exact: true })).toBeVisible();