Skip to content

Commit

Permalink
Update favicons to use Tudor crown
Browse files Browse the repository at this point in the history
  • Loading branch information
querkmachine committed Oct 20, 2023
1 parent 4b02efc commit 33dcaa2
Show file tree
Hide file tree
Showing 15 changed files with 88 additions and 15 deletions.
Binary file modified packages/govuk-frontend/src/govuk/assets/images/favicon.ico
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions packages/govuk-frontend/src/govuk/assets/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"icons": [
{
"src": "images/favicon.ico",
"type": "image/x-icon",
"sizes": "48x48"
},
{
"src": "images/favicon.svg",
"type": "image/svg+xml",
"sizes": "150x150",
"purpose": "any"
},
{
"src": "images/govuk-icon-180.png",
"type": "image/png",
"sizes": "180x180",
"purpose": "maskable"
},
{
"src": "images/govuk-icon-192.png",
"type": "image/png",
"sizes": "192x192",
"purpose": "maskable"
},
{
"src": "images/govuk-icon-512.png",
"type": "image/png",
"sizes": "512x512",
"purpose": "maskable"
},
{
"src": "images/govuk-icon-mask.svg",
"type": "image/svg+xml",
"sizes": "150x150",
"purpose": "monochrome"
}
]
}
11 changes: 5 additions & 6 deletions packages/govuk-frontend/src/govuk/template.njk
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">

{% block headIcons %}
<link rel="shortcut icon" sizes="16x16 32x32 48x48" href="{{ assetPath | default("/assets", true) }}/images/favicon.ico" type="image/x-icon">
<link rel="mask-icon" href="{{ assetPath | default("/assets") }}/images/govuk-mask-icon.svg" color="{{ themeColor | default("#0b0c0c", true) }}"> {# Hardcoded value of $govuk-black #}
<link rel="apple-touch-icon" sizes="180x180" href="{{ assetPath | default("/assets", true) }}/images/govuk-apple-touch-icon-180x180.png">
<link rel="apple-touch-icon" sizes="167x167" href="{{ assetPath | default("/assets", true) }}/images/govuk-apple-touch-icon-167x167.png">
<link rel="apple-touch-icon" sizes="152x152" href="{{ assetPath | default("/assets", true) }}/images/govuk-apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" href="{{ assetPath | default("/assets", true) }}/images/govuk-apple-touch-icon.png">
<link rel="icon" sizes="48x48" href="{{ assetPath | default('/assets') }}/images/favicon.ico">
<link rel="icon" sizes="any" href="{{ assetPath | default('/assets') }}/images/favicon.svg" type="image/svg+xml">
<link rel="mask-icon" href="{{ assetPath | default('/assets') }}/images/govuk-icon-mask.svg" color="{{ themeColor | default('#0b0c0c') }}"> {# Hardcoded value of $govuk-black #}
<link rel="apple-touch-icon" href="{{ assetPath | default('/assets') }}/images/govuk-icon-180.png">
<link rel="manifest" href="{{ assetPath | default('/assets') }}/manifest.json">
{% endblock %}

{% block head %}{% endblock %}
Expand Down
44 changes: 42 additions & 2 deletions packages/govuk-frontend/src/govuk/template.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,58 @@ describe('Template', () => {

it('uses a default assets path of /assets', () => {
const $ = renderTemplate()
const $icon = $('link[rel="shortcut icon"]')
const $icon = $('link[rel="icon"][sizes="48x48"]')

expect($icon.attr('href')).toEqual('/assets/images/favicon.ico')
})

it('can have the assets path overridden using assetPath', () => {
const $ = renderTemplate({ assetPath: '/whatever' })
const $icon = $('link[rel="shortcut icon"]')
const $icon = $('link[rel="icon"][sizes="48x48"]')

expect($icon.attr('href')).toEqual('/whatever/images/favicon.ico')
})

describe('favicons', () => {
it('has an .ico icon', () => {
const $ = renderTemplate()
const $icon = $('link[rel="icon"][href$=".ico"]')

expect($icon.attr('sizes')).toEqual('48x48')
expect($icon.attr('href')).toEqual('/assets/images/favicon.ico')
})

it('has an .svg icon', () => {
const $ = renderTemplate()
const $icon = $('link[rel="icon"][href$=".svg"]')

expect($icon.attr('sizes')).toEqual('any')
expect($icon.attr('href')).toEqual('/assets/images/favicon.svg')
})

it('has a mask-icon', () => {
const $ = renderTemplate()
const $icon = $('link[rel="mask-icon"]')

expect($icon.attr('color')).toEqual('#0b0c0c')
expect($icon.attr('href')).toEqual('/assets/images/govuk-icon-mask.svg')
})

it('has an apple-touch-icon', () => {
const $ = renderTemplate()
const $icon = $('link[rel="apple-touch-icon"]')

expect($icon.attr('href')).toEqual('/assets/images/govuk-icon-180.png')
})

it('has a linked web manifest file', () => {
const $ = renderTemplate()
const $icon = $('link[rel="manifest"]')

expect($icon.attr('href')).toEqual('/assets/manifest.json')
})
})

describe('opengraph image', () => {
it('is not included if neither assetUrl nor opengraphImageUrl are set ', () => {
const $ = renderTemplate({})
Expand Down

0 comments on commit 33dcaa2

Please sign in to comment.