-
-
Notifications
You must be signed in to change notification settings - Fork 272
fix(ui): app footer layout and build environment on narrow screens #1032
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,11 @@ | ||
| export type EnvType = 'dev' | 'preview' | 'canary' | 'release' | ||
|
|
||
| export interface BuildInfo { | ||
| version: string | ||
| commit: string | ||
| shortCommit: string | ||
| time: number | ||
| branch: string | ||
| env: 'preview' | 'canary' | 'dev' | 'release' | ||
| env: EnvType | ||
| privacyPolicyDate: string | ||
| } |
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,35 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
| import { mountSuspended } from '@nuxt/test-utils/runtime' | ||
| import AppFooter from '~/components/AppFooter.vue' | ||
|
|
||
| /* check nuxt module at modules/build-env.ts */ | ||
| describe('AppFooter', () => { | ||
| it('BuildEnvironment is properly displayed at settings', async () => { | ||
| const buildInfo = useAppConfig().buildInfo | ||
| const component = await mountSuspended(AppFooter, { | ||
| route: '/settings', | ||
| }) | ||
|
|
||
| const envSpan = component.find('span.tracking-wider') | ||
| expect(envSpan.exists()).toBe(true) | ||
| expect(envSpan.text()).toBe(buildInfo.env) | ||
| const commitLink = component.find(`a[href$="/commit/${buildInfo.commit}"]`) | ||
| expect(commitLink.exists()).toBe(true) | ||
| const tagLink = component.find(`a[href$="/tag/v${buildInfo.version}"]`) | ||
| expect(tagLink.exists()).toBe(false) | ||
| }) | ||
|
|
||
| it('BuildEnvironment is hidden at home', async () => { | ||
| const buildInfo = useAppConfig().buildInfo | ||
| const component = await mountSuspended(AppFooter, { | ||
| route: '/', | ||
| }) | ||
|
|
||
| const envSpan = component.find('span.tracking-wider') | ||
| expect(envSpan.exists()).toBe(false) | ||
| const commitLink = component.find(`a[href$="/commit/${buildInfo.commit}"]`) | ||
| expect(commitLink.exists()).toBe(false) | ||
| const tagLink = component.find(`a[href$="/tag/v${buildInfo.version}"]`) | ||
| expect(tagLink.exists()).toBe(false) | ||
| }) | ||
| }) |
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,58 @@ | ||
| import type { BuildInfo } from '#shared/types' | ||
| import { describe, expect, it } from 'vitest' | ||
| import { mountSuspended } from '@nuxt/test-utils/runtime' | ||
| import BuildEnvironment from '~/components/BuildEnvironment.vue' | ||
|
|
||
| describe('BuildEnvironment', () => { | ||
| it('renders dev environment correctly', async () => { | ||
| const buildInfo: BuildInfo = { | ||
| env: 'dev', | ||
| version: '1.2.3', | ||
| time: 1234567890, | ||
| commit: 'abcdef', | ||
| shortCommit: 'abc', | ||
| branch: 'main', | ||
| privacyPolicyDate: new Date().toISOString(), | ||
| } | ||
| const component = await mountSuspended(BuildEnvironment, { | ||
| props: { | ||
| buildInfo, | ||
| }, | ||
| }) | ||
|
|
||
| // In dev mode, it shows env name, not version link | ||
| const envSpan = component.find('span.tracking-wider') | ||
| expect(envSpan.exists()).toBe(true) | ||
| expect(envSpan.text()).toBe(buildInfo.env) | ||
| const commitLink = component.find(`a[href$="/commit/${buildInfo.commit}"]`) | ||
| expect(commitLink.exists()).toBe(true) | ||
| const tagLink = component.find(`a[href$="/tag/v${buildInfo.version}"]`) | ||
| expect(tagLink.exists()).toBe(false) | ||
| }) | ||
|
|
||
| it('renders release environment correctly', async () => { | ||
| const buildInfo: BuildInfo = { | ||
| env: 'release', | ||
| version: '1.2.3', | ||
| time: 1234567890, | ||
| commit: 'abcdef', | ||
| shortCommit: 'abc', | ||
| branch: 'release', | ||
| privacyPolicyDate: new Date().toISOString(), | ||
| } | ||
|
|
||
| const component = await mountSuspended(BuildEnvironment, { | ||
| props: { | ||
| buildInfo, | ||
| }, | ||
| }) | ||
|
|
||
| // In release mode, it shows tag version link, not env name | ||
| const envSpan = component.find('span.tracking-wider') | ||
| expect(envSpan.exists()).toBe(false) | ||
| const commitLink = component.find(`a[href$="/commit/${buildInfo.commit}"]`) | ||
| expect(commitLink.exists()).toBe(false) | ||
| const tagLink = component.find(`a[href$="/tag/v${buildInfo.version}"]`) | ||
| expect(tagLink.exists()).toBe(true) | ||
| }) | ||
| }) |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 112
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 168
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 83
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 738
🏁 Script executed:
Repository: npmx-dev/npmx.dev
Length of output: 615
Use
isTestfromstd-envfor consistent test-mode detection.The
process.env.TESTflag is not explicitly wired in this repository's test configuration.std-env(v3.10.0) is already available andisTestis already imported and used inmodules/lunaria.ts, making this the standard approach. Replaceprocess.env.TESTwithisTestto ensure test-mode logic executes reliably.📝 Committable suggestion