From 124c619fb816417efbcaf56cefb334e8993b68ca Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Wed, 14 Oct 2026 19:14:39 -0400 Subject: [PATCH] fix(web): restore category filter button corners --- src_assets/common/assets/web/Featured.vue | 37 +++++++------ tests/web/sunshine_styles.test.js | 63 +++++++++++++++++++---- 2 files changed, 74 insertions(+), 26 deletions(-) diff --git a/src_assets/common/assets/web/Featured.vue b/src_assets/common/assets/web/Featured.vue index 19d89330c..4c25011de 100644 --- a/src_assets/common/assets/web/Featured.vue +++ b/src_assets/common/assets/web/Featured.vue @@ -8,24 +8,27 @@
-
+
{{ $t('featured.category_filter') }} - - + +
+ + +
diff --git a/tests/web/sunshine_styles.test.js b/tests/web/sunshine_styles.test.js index a266467fb..afe8d8620 100644 --- a/tests/web/sunshine_styles.test.js +++ b/tests/web/sunshine_styles.test.js @@ -50,6 +50,25 @@ function componentStyle(markup, selector) { return getComputedStyle(document.querySelector(selector)) } +/** + * @brief Mount the featured page with a deterministic app directory. + * + * @param {object} directory App and category data returned by the directory service. + * @returns {Promise} Mounted featured page. + */ +async function mountFeatured(directory) { + vi.stubGlobal('fetch', vi.fn(async () => ({ + ok: true, + json: async () => directory, + }))) + wrapper = mount(Featured, { + attachTo: document.body, + global: { mocks: { $t: key => key }, stubs: { Navbar: true, SimpleIcon: true } }, + }) + await flushPromises() + return wrapper +} + const componentCases = [ ['body', '
', 'body', { backgroundColor: 'var(--color-bg-base)', color: 'var(--color-text-base)' }], ['card', '
', '.card', { backgroundColor: 'var(--color-surface)', color: 'var(--color-text-base)' }], @@ -93,6 +112,40 @@ const componentCases = [ ] describe.each(['light', 'dark'])('%s theme cascade', theme => { + it.each([0, 1, 2])('rounds the outside category filter corners with %i categories', async categoryCount => { + document.documentElement.dataset.theme = theme + document.documentElement.dataset.bsTheme = theme + const categories = [ + { id: 'clients', originalId: 'clients' }, + { id: 'tools', originalId: 'tools' }, + ].slice(0, categoryCount) + await mountFeatured({ apps: [], categories }) + + expect(wrapper.get('fieldset legend').text()).toBe('featured.category_filter') + const buttons = wrapper.findAll('.btn-group > .btn') + expect(buttons).toHaveLength(categoryCount + 1) + const firstStyle = getComputedStyle(buttons[0].element) + const lastStyle = getComputedStyle(buttons.at(-1).element) + expect(firstStyle.borderTopLeftRadius).not.toBe('0px') + expect(firstStyle.borderBottomLeftRadius).not.toBe('0px') + expect(lastStyle.borderTopRightRadius).not.toBe('0px') + expect(lastStyle.borderBottomRightRadius).not.toBe('0px') + if (categoryCount > 0) { + expect(firstStyle.borderTopRightRadius).toBe('0px') + expect(firstStyle.borderBottomRightRadius).toBe('0px') + expect(lastStyle.borderTopLeftRadius).toBe('0px') + expect(lastStyle.borderBottomLeftRadius).toBe('0px') + for (const button of buttons.slice(1, -1)) { + const style = getComputedStyle(button.element) + expect([style.borderTopLeftRadius, style.borderBottomLeftRadius, style.borderTopRightRadius, style.borderBottomRightRadius]).toEqual(['0px', '0px', '0px', '0px']) + } + await buttons[1].trigger('click') + expect(buttons[1].classes()).toContain('active') + await buttons[0].trigger('click') + expect(buttons[0].classes()).toContain('active') + } + }) + it('allows specific component rules to override theme defaults', () => { document.documentElement.dataset.theme = theme document.documentElement.dataset.bsTheme = theme @@ -120,15 +173,7 @@ describe.each(['light', 'dark'])('%s theme cascade', theme => { it('themes the rendered official and platform badges without Bootstrap background utilities', async () => { document.documentElement.dataset.theme = theme document.documentElement.dataset.bsTheme = theme - vi.stubGlobal('fetch', vi.fn(async () => ({ - ok: true, - json: async () => ({ apps: [{ id: 'sample', name: 'Sample App', official: true, platforms: ['linux'] }] }), - }))) - wrapper = mount(Featured, { - attachTo: document.body, - global: { mocks: { $t: key => key }, stubs: { Navbar: true, SimpleIcon: true } }, - }) - await flushPromises() + await mountFeatured({ apps: [{ id: 'sample', name: 'Sample App', official: true, platforms: ['linux'] }] }) const [official, platform] = wrapper.findAll('.badge') expect(getComputedStyle(official.element).backgroundColor).toBe('var(--color-primary)')