-
Notifications
You must be signed in to change notification settings - Fork 460
refactor(desktop): rebuild the About page as labeled settings groups #4571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
c5327a3
fix(desktop): label the About build pill by update channel, not build…
Astro-Han 1504655
refactor(desktop): rebuild the About page on the Astryx settings-temp…
Astro-Han 9b75da3
feat(desktop): name the update channel in the diagnostics report
Astro-Han 77199c8
refactor(desktop): rebuild the About page as labeled settings groups
Astro-Han fa1b575
refactor(desktop): cut the About page to what only it can tell you
Astro-Han 1540a13
refactor(desktop): drop the About icon plate and its stylesheet
Astro-Han b942c6f
fix(desktop): drop About's duplicate dev-build sentence and name its …
Astro-Han File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { ensureSidebarExpanded, expect, test } from './fixtures'; | ||
|
|
||
| test('About renders channel facts, support, and privacy on a dev checkout', async ({ window: page }) => { | ||
| await ensureSidebarExpanded(page); | ||
| await page.getByRole('button', { name: '设置' }).click(); | ||
| await page.getByRole('button', { name: '关于', exact: true }).click(); | ||
|
|
||
| // The channel token must agree with the version string: the fixture app is a | ||
| // dev checkout, so it reads 本地开发版. | ||
| await expect(page.getByText('本地开发版', { exact: true })).toBeVisible(); | ||
| await expect(page.getByText('本地开发构建,不检查更新。')).toBeVisible(); | ||
|
|
||
| // A dev checkout follows no feed, so the whole update row is absent — it is | ||
| // not a disabled button next to a sentence repeating the line above it. | ||
| await expect(page.getByRole('button', { name: '检查更新' })).toHaveCount(0); | ||
|
|
||
| // Support lives outside the info conditional: usable even when `app.info` | ||
| // fails, which is exactly when a user reaches for it. Each row-end control is | ||
| // named by its row, not by the verb on its face. | ||
| await expect(page.getByRole('heading', { name: '支持', exact: true })).toBeVisible(); | ||
| await expect(page.getByRole('button', { name: '复制诊断信息' })).toBeEnabled(); | ||
| await expect(page.getByRole('link', { name: '报告问题' })).toBeVisible(); | ||
| await expect(page.getByRole('button', { name: '键盘快捷键' })).toBeEnabled(); | ||
|
|
||
| // Three commitments, not the old wall of five bullets. | ||
| const privacyList = page.getByRole('list', { name: '隐私承诺' }); | ||
| await expect(privacyList.getByRole('listitem')).toHaveCount(3); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
apps/desktop/src/main/__tests__/about-update-status.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import assert from 'node:assert/strict'; | ||
| import { test } from 'node:test'; | ||
| import { | ||
| aboutChannelFacts, | ||
| aboutUpdateStatusDetail, | ||
| } from '../../renderer/settings/about-update-status.js'; | ||
| import { getSettingsPreferencesCopy } from '../../renderer/locales/settings-preferences-copy.js'; | ||
|
|
||
| const copy = getSettingsPreferencesCopy('zh').about; | ||
|
|
||
| test('a packaged nightly is tokened Nightly, never 正式版', () => { | ||
| const facts = aboutChannelFacts({ buildMode: 'packaged', updateChannel: 'nightly' }, copy); | ||
| assert.deepEqual(facts.token, { label: 'Nightly', color: 'orange' }); | ||
| assert.match(facts.summary, /会覆盖正式版安装/); | ||
| }); | ||
|
|
||
| test('a packaged release wears no token — it is the default state', () => { | ||
| const facts = aboutChannelFacts({ buildMode: 'packaged', updateChannel: 'release' }, copy); | ||
| assert.equal(facts.token, null); | ||
| assert.equal(facts.summary, '正式发布版,自动接收稳定更新。'); | ||
| }); | ||
|
|
||
| test('buildMode decides before updateChannel, whose dev value is a placeholder', () => { | ||
| const facts = aboutChannelFacts({ buildMode: 'dev', updateChannel: 'nightly' }, copy); | ||
| assert.deepEqual(facts.token, { label: '本地开发版', color: 'gray' }); | ||
| assert.equal(facts.summary, '本地开发构建,不检查更新。'); | ||
| }); | ||
|
|
||
| test('the nightly steady states each read as themselves', () => { | ||
| const detail = (status: Parameters<typeof aboutUpdateStatusDetail>[0]) => | ||
| aboutUpdateStatusDetail(status, copy); | ||
|
|
||
| assert.equal( | ||
| detail({ | ||
| state: 'downloading', | ||
| currentVersion: '0.2.0-dev.11.20260831', | ||
| latestVersion: '0.2.0-dev.12.20260901', | ||
| progress: { percent: 42.4, bytesPerSecond: 1, transferred: 1, total: 2 }, | ||
| }), | ||
| '正在下载 v0.2.0-dev.12.20260901(42%)…', | ||
| ); | ||
| assert.equal( | ||
| detail({ | ||
| state: 'verifying', | ||
| currentVersion: '0.2.0-dev.11.20260831', | ||
| latestVersion: '0.2.0-dev.12.20260901', | ||
| }), | ||
| '正在验证 v0.2.0-dev.12.20260901 的发布来源…', | ||
| ); | ||
| assert.equal( | ||
| detail({ | ||
| state: 'downloaded', | ||
| currentVersion: '0.2.0-dev.11.20260831', | ||
| latestVersion: '0.2.0-dev.12.20260901', | ||
| }), | ||
| 'v0.2.0-dev.12.20260901 已下载,可在侧栏选择重启安装。', | ||
| ); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.