fix(ui): fix app footer layout and build environment on narrow screens#963
fix(ui): fix app footer layout and build environment on narrow screens#963userquin wants to merge 8 commits intonpmx-dev:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
📝 WalkthroughWalkthroughBuildEnvironment rendering was moved in AppFooter to a separate container while retaining the same Suggested reviewers
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
test/nuxt/components/AppFooter.spec.ts (1)
10-25: Prefer DOM assertions over full HTML string matches to reduce brittleness.HTML string contains are fragile to class or attribute ordering changes. Consider asserting on elements/text/attributes instead.
♻️ Example adjustment
- 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"', - ) + const env = component.find('span.tracking-wider') + expect(env.exists()).toBe(true) + expect(env.text()).toBe('dev') + const commitLink = component.find('a[href*="commit/"]') + expect(commitLink.exists()).toBe(true)test/nuxt/components/BuildEnvironment.spec.ts (1)
7-22: Make the dev test self-contained by inliningBuildInfo.Relying on
useAppConfig()couples this test to Nuxt app initialisation. An explicitBuildInfokeeps it deterministic and focused.♻️ Example adjustment
- const buildInfo = useAppConfig().buildInfo as BuildInfo + const buildInfo: BuildInfo = { + env: 'dev', + version: '0.0.0', + time: 1770237446424, + commit: '704987bba88909f3782d792c224bde989569acb9', + shortCommit: '704987b', + branch: 'xxx', + }
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
test/nuxt/components/AppFooter.spec.ts (1)
6-16: Consider using DOM queries for more resilient assertions.The exact HTML string matching (e.g.,
<span class="tracking-wider">) is fragile—if class order changes or attributes are added, the test will break unexpectedly. Using Vue Test Utils selectors would be more maintainable.♻️ Suggested refactor using DOM queries
it('BuildEnvironment is properly displayed at settings', async () => { const buildInfo = useAppConfig().buildInfo const component = await mountSuspended(AppFooter, { route: '/settings', }) - const html = component.html() - expect(html).toContain(`<span class="tracking-wider">${buildInfo.env}</span>`) - expect(html).toContain( - `<a href="https://github.com/npmx-dev/npmx.dev/commit/${buildInfo.commit}"`, - ) + const envSpan = component.find('span.tracking-wider') + expect(envSpan.exists()).toBe(true) + expect(envSpan.text()).toBe(buildInfo.env) + const commitLink = component.find(`a[href*="${buildInfo.commit}"]`) + expect(commitLink.exists()).toBe(true) })
fixed with last commit |
This PR just moves the
BuildEnvironment.vueafter links container updating its styles to add some margins.I need to add some test.
/cc @danielroe I haven't found a way to mock
useAppConfig=> small refactor atBuildEnvironmentto acceptBuildInfoand updatedmodules/build-env.tsto mock it (maybe usinguseRuntimeConfig().publicinstead ? ).