fix: custom meta icons getting overwritten by default icon (#7466)

## Description

Issue reported by Trading Point.

Payload favicon is still shown even when a custom icon is provided.

To replicate add to Payload config:
```ts
  admin: {
    meta: {
      icons: [
        {
          url: '/images/test.jpg',
          fetchPriority: 'high',
          sizes: '16x16',
        },
      ],
    },
  },
```

- [X] I have read and understand the
[CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md)
document in this repository.

## Type of change

- [X] Bug fix (non-breaking change which fixes an issue)

## Checklist:

- [ ] I have added tests that prove my fix is effective or that my
feature works
- [X] Existing test suite passes locally with my changes
- [ ] I have made corresponding changes to the documentation
This commit is contained in:
Jessica Chowdhury
2024-08-06 15:01:46 +01:00
committed by GitHub
parent 0b9397399a
commit 6f35c356fe
3 changed files with 19 additions and 22 deletions

View File

@@ -60,4 +60,14 @@ test.describe('Admin Panel (Root)', () => {
expect(pageURL).toBe(url.global('menu'))
expect(pageURL).not.toContain('/admin')
})
test('ui - should render default payload favicons', async () => {
await page.goto(url.admin)
const favicons = page.locator('link[rel="icon"]')
await expect(favicons).toHaveCount(2)
await expect(favicons.nth(0)).toHaveAttribute('sizes', '32x32')
await expect(favicons.nth(1)).toHaveAttribute('sizes', '32x32')
await expect(favicons.nth(1)).toHaveAttribute('media', '(prefers-color-scheme: dark)')
await expect(favicons.nth(1)).toHaveAttribute('href', /\/payload-favicon-light\.[a-z\d]+\.png/)
})
})