-
-
Notifications
You must be signed in to change notification settings - Fork 203
fix(ui): fix app footer layout and build environment on narrow screens #963
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
Open
userquin
wants to merge
10
commits into
npmx-dev:main
Choose a base branch
from
userquin:fix-app-footer-layout
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+126
−16
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2ca50ba
fix(ui): fix app footer layout and build environment on narrow screens
userquin c124838
chore: add tests (coverage broken)
userquin b75fdef
fix: missing `nuxt.options.appConfig.env` when testing
userquin 74ffb9c
chore: move `EnvType` to `shared/types/env.ts`
userquin 21e6173
chore: make tests assertions agnostic to build-env changes
userquin aa037e5
chore: fix assertion using backticks
userquin 02522ec
chore: apply coderabbitai suggestion
userquin 3227033
chore: use query selectors instead html string matching
userquin 966919a
chore: update hint at app footer test
userquin 0bd85f0
Merge branch 'main' into fix-app-footer-layout
userquin 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,8 +1,10 @@ | ||
| 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 | ||
| } |
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', () => { | ||
userquin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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.commit}"]`) | ||
| 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.commit}"]`) | ||
| 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,56 @@ | ||
| 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', () => { | ||
userquin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| it('renders dev environment correctly', async () => { | ||
| const buildInfo: BuildInfo = { | ||
| env: 'dev', | ||
| version: '1.2.3', | ||
| time: 1234567890, | ||
| commit: 'abcdef', | ||
| shortCommit: 'abc', | ||
| branch: 'main', | ||
| } | ||
| 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.commit}"]`) | ||
| 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', | ||
| } | ||
|
|
||
| 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.
Uh oh!
There was an error while loading. Please reload this page.