-
-
Notifications
You must be signed in to change notification settings - Fork 432
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
Closed
Closed
Changes from 2 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
Some comments aren't visible on the classic Files Changed page.
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
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,27 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
| import { mountSuspended } from '@nuxt/test-utils/runtime' | ||
| import AppFooter from '~/components/AppFooter.vue' | ||
|
|
||
| describe('AppFooter', () => { | ||
|
userquin marked this conversation as resolved.
|
||
| it('BuildEnvironment is properly displayed at settings', async () => { | ||
| const component = await mountSuspended(AppFooter, { | ||
| route: '/settings', | ||
| }) | ||
| const html = component.html() | ||
| expect(html).toContain('<span class="tracking-wider">dev</span>') | ||
| expect(html).toContain( | ||
| '<a href="https://github.com/npmx-dev/npmx.dev/commit/704987bba88909f3782d792c224bde989569acb9"', | ||
| ) | ||
| }) | ||
|
|
||
| it('BuildEnvironment is hidden at home', async () => { | ||
| const component = await mountSuspended(AppFooter, { | ||
| route: '/', | ||
| }) | ||
| const html = component.html() | ||
| expect(html).not.toContain( | ||
| '<a href="https://github.com/npmx-dev/npmx.dev/commit/704987bba88909f3782d792c224bde989569acb9"', | ||
| ) | ||
| expect(html).not.toContain('<span class="tracking-wider">dev</span>') | ||
| }) | ||
| }) | ||
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,48 @@ | ||
| 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.
|
||
| it('renders dev environment correctly', async () => { | ||
| const buildInfo = useAppConfig().buildInfo as BuildInfo | ||
| const component = await mountSuspended(BuildEnvironment, { | ||
| props: { | ||
| buildInfo, | ||
| }, | ||
| }) | ||
| const html = component.html() | ||
|
|
||
| // In dev mode, it shows env name, not version link | ||
| expect(html).toContain('<span class="tracking-wider">dev</span>') | ||
| expect(html).toContain( | ||
| '<a href="https://github.com/npmx-dev/npmx.dev/commit/704987bba88909f3782d792c224bde989569acb9"', | ||
| ) | ||
| expect(html).not.toContain('href="https://github.com/npmx-dev/npmx.dev/tag/v0.0.0"') | ||
| }) | ||
|
|
||
| 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, | ||
| }, | ||
| }) | ||
| const html = component.html() | ||
|
|
||
| // In release mode, it shows tag version link, not env name | ||
| expect(html).not.toContain('<span class="tracking-wider">dev</span>') | ||
| expect(html).not.toContain( | ||
| '<a href="https://github.com/npmx-dev/npmx.dev/commit/704987bba88909f3782d792c224bde989569acb9"', | ||
| ) | ||
| expect(html).toContain('href="https://github.com/npmx-dev/npmx.dev/tag/v1.2.3"') | ||
| }) | ||
| }) | ||
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.