@ons/design-system 59.0.0 → 60.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/components/access-code/uac.scss +1 -1
  2. package/components/autosuggest/_autosuggest.scss +1 -1
  3. package/components/button/_button.scss +3 -3
  4. package/components/download-resources/_download-resources.scss +1 -1
  5. package/components/fieldset/_fieldset.scss +2 -2
  6. package/components/footer/_footer.scss +0 -15
  7. package/components/footer/_macro.njk +62 -103
  8. package/components/footer/_macro.spec.js +56 -186
  9. package/components/header/_header.scss +23 -25
  10. package/components/header/_macro.njk +133 -148
  11. package/components/header/_macro.spec.js +39 -73
  12. package/components/hero/_hero.scss +4 -0
  13. package/components/hero/_macro.njk +35 -92
  14. package/components/hero/_macro.spec.js +54 -190
  15. package/components/icons/_macro.njk +0 -499
  16. package/components/icons/_macro.spec.js +0 -14
  17. package/components/navigation/_macro.njk +14 -14
  18. package/components/navigation/_macro.spec.js +3 -5
  19. package/components/navigation/_navigation.scss +4 -4
  20. package/components/panel/_panel.scss +1 -1
  21. package/components/summary/_summary.scss +2 -2
  22. package/components/table/_table.scss +3 -3
  23. package/css/main.css +3 -3
  24. package/fonts/opensans-bold.woff +0 -0
  25. package/fonts/opensans-bold.woff2 +0 -0
  26. package/fonts/opensans-regular.woff +0 -0
  27. package/fonts/opensans-regular.woff2 +0 -0
  28. package/img/large/placeholder-card.png +0 -0
  29. package/img/large/placeholder-news-medium.png +0 -0
  30. package/img/large/placeholder-news.png +0 -0
  31. package/img/large/placeholder-portrait.png +0 -0
  32. package/img/small/placeholder-card.png +0 -0
  33. package/img/small/placeholder-news-medium.png +0 -0
  34. package/img/small/placeholder-news.png +0 -0
  35. package/img/small/placeholder-portrait.png +0 -0
  36. package/js/main.js +0 -1
  37. package/layout/_template.njk +51 -62
  38. package/package.json +1 -1
  39. package/scripts/main.es5.js +1 -1
  40. package/scripts/main.js +1 -1
  41. package/scss/base/_typography.scss +1 -0
  42. package/scss/main.scss +0 -2
  43. package/scss/patternlib.scss +2 -1
  44. package/scss/utilities/_typography.scss +1 -1
  45. package/scss/vars/_colors.scss +9 -4
  46. package/scss/vars/_typography.scss +1 -1
  47. package/components/find-a-support-centre/_find-a-support-centre.scss +0 -9
  48. package/components/promotional-banner/_macro.njk +0 -49
  49. package/components/promotional-banner/_macro.spec.js +0 -97
  50. package/components/promotional-banner/_promo-banner.scss +0 -72
  51. package/components/select/select.js +0 -19
  52. package/components/select/select.spec.js +0 -56
  53. package/css/census.css +0 -243
  54. package/css/ids.css +0 -243
  55. package/favicons/browserconfig.xml +0 -12
  56. package/favicons/census/cy/android-chrome-192x192.png +0 -0
  57. package/favicons/census/cy/android-chrome-512x512.png +0 -0
  58. package/favicons/census/cy/apple-touch-icon.png +0 -0
  59. package/favicons/census/cy/browserconfig.xml +0 -12
  60. package/favicons/census/cy/favicon-16x16.png +0 -0
  61. package/favicons/census/cy/favicon-32x32.png +0 -0
  62. package/favicons/census/cy/favicon.ico +0 -0
  63. package/favicons/census/cy/manifest.json +0 -20
  64. package/favicons/census/cy/mstitle-150x150.png +0 -0
  65. package/favicons/census/cy/mstitle-310x150.png +0 -0
  66. package/favicons/census/cy/mstitle-310x310.png +0 -0
  67. package/favicons/census/cy/mstitle-70x70.png +0 -0
  68. package/favicons/census/cy/opengraph.png +0 -0
  69. package/favicons/census/cy/safari-pinned-tab.svg +0 -3
  70. package/favicons/census/cy/site.webmanifest +0 -19
  71. package/favicons/census/cy/twitter.png +0 -0
  72. package/favicons/census/en/android-chrome-192x192.png +0 -0
  73. package/favicons/census/en/android-chrome-512x512.png +0 -0
  74. package/favicons/census/en/apple-touch-icon.png +0 -0
  75. package/favicons/census/en/browserconfig.xml +0 -12
  76. package/favicons/census/en/favicon-16x16.png +0 -0
  77. package/favicons/census/en/favicon-32x32.png +0 -0
  78. package/favicons/census/en/favicon.ico +0 -0
  79. package/favicons/census/en/manifest.json +0 -20
  80. package/favicons/census/en/mstitle-150x150.png +0 -0
  81. package/favicons/census/en/mstitle-310x150.png +0 -0
  82. package/favicons/census/en/mstitle-310x310.png +0 -0
  83. package/favicons/census/en/mstitle-70x70.png +0 -0
  84. package/favicons/census/en/opengraph.png +0 -0
  85. package/favicons/census/en/safari-pinned-tab.svg +0 -3
  86. package/favicons/census/en/site.webmanifest +0 -19
  87. package/favicons/census/en/twitter.png +0 -0
  88. package/favicons/census/ni/favicon.ico +0 -0
  89. package/favicons/ids/cy/android-chrome-192x192.png +0 -0
  90. package/favicons/ids/cy/android-chrome-512x512.png +0 -0
  91. package/favicons/ids/cy/apple-touch-icon.png +0 -0
  92. package/favicons/ids/cy/browserconfig.xml +0 -12
  93. package/favicons/ids/cy/favicon-16x16.png +0 -0
  94. package/favicons/ids/cy/favicon-32x32.png +0 -0
  95. package/favicons/ids/cy/favicon.ico +0 -0
  96. package/favicons/ids/cy/manifest.json +0 -20
  97. package/favicons/ids/cy/mstile-150x150.png +0 -0
  98. package/favicons/ids/cy/mstile-310x150.png +0 -0
  99. package/favicons/ids/cy/mstile-310x310.png +0 -0
  100. package/favicons/ids/cy/mstile-70x70.png +0 -0
  101. package/favicons/ids/cy/opengraph.png +0 -0
  102. package/favicons/ids/cy/safari-pinned-tab.svg +0 -27
  103. package/favicons/ids/cy/site.webmanifest +0 -54
  104. package/favicons/ids/cy/twitter.png +0 -0
  105. package/favicons/ids/en/android-chrome-192x192.png +0 -0
  106. package/favicons/ids/en/android-chrome-512x512.png +0 -0
  107. package/favicons/ids/en/apple-touch-icon.png +0 -0
  108. package/favicons/ids/en/browserconfig.xml +0 -12
  109. package/favicons/ids/en/favicon-16x16.png +0 -0
  110. package/favicons/ids/en/favicon-32x32.png +0 -0
  111. package/favicons/ids/en/favicon.ico +0 -0
  112. package/favicons/ids/en/manifest.json +0 -20
  113. package/favicons/ids/en/mstile-150x150.png +0 -0
  114. package/favicons/ids/en/mstile-310x150.png +0 -0
  115. package/favicons/ids/en/mstile-310x310.png +0 -0
  116. package/favicons/ids/en/mstile-70x70.png +0 -0
  117. package/favicons/ids/en/opengraph.png +0 -0
  118. package/favicons/ids/en/safari-pinned-tab.svg +0 -27
  119. package/favicons/ids/en/site.webmanifest +0 -54
  120. package/favicons/ids/en/twitter.png +0 -0
  121. package/favicons/mstitle-150x150.png +0 -0
  122. package/favicons/mstitle-310x150.png +0 -0
  123. package/favicons/mstitle-310x310.png +0 -0
  124. package/favicons/mstitle-70x70.png +0 -0
  125. package/img/UKOpenGovernmentLicence-grey.svg +0 -4
  126. package/img/UKOpenGovernmentLicence.svg +0 -13
  127. package/img/card-placeholder.svg +0 -14
  128. package/img/census-landscape.svg +0 -4514
  129. package/img/census-logo-stacked-pos-billingual.png +0 -0
  130. package/img/census-logo-stacked-pos-cy.png +0 -0
  131. package/img/census-logo-stacked-pos-en.png +0 -0
  132. package/img/census-promo-banner.svg +0 -489
  133. package/img/circle-lines.svg +0 -31
  134. package/img/dummy-brand-logo.svg +0 -6
  135. package/img/icons--check.svg +0 -3
  136. package/img/icons--chevron-down.svg +0 -3
  137. package/img/its-about-us--dark.svg +0 -4
  138. package/img/its-about-us--light.svg +0 -4
  139. package/img/large/hero-man.png +0 -0
  140. package/img/logo.svg +0 -77
  141. package/img/ni-syn-cyfrif--dark.svg +0 -3
  142. package/img/ni-syn-cyfrif--light.svg +0 -3
  143. package/img/nisra-logo-black-en.svg +0 -4
  144. package/img/ogl.svg +0 -10
  145. package/img/ons-logo-black-cy.svg +0 -4
  146. package/img/ons-logo-black-en.svg +0 -4
  147. package/img/people-mob.png +0 -0
  148. package/img/people.png +0 -0
  149. package/img/rehearsal-areas.svg +0 -11
  150. package/img/small/hero-man.png +0 -0
  151. package/scss/census.scss +0 -2
  152. package/scss/ids.scss +0 -2
  153. package/scss/settings/_census.scss +0 -159
  154. package/scss/settings/_ids.scss +0 -52
@@ -1,7 +1,7 @@
1
1
  .ons-uac {
2
2
  &__input {
3
3
  font-family: $font-mono !important;
4
- font-weight: 700;
4
+ font-weight: $font-weight-bold;
5
5
  letter-spacing: 0.14em;
6
6
  text-transform: uppercase;
7
7
  width: 15.1em;
@@ -105,7 +105,7 @@
105
105
  }
106
106
 
107
107
  .ons-panel__body {
108
- font-weight: bold;
108
+ font-weight: $font-weight-bold;
109
109
  padding: 0.8rem 0.8rem 0.8rem 2rem;
110
110
  }
111
111
  }
@@ -139,7 +139,7 @@ $button-shadow-size: 3px;
139
139
  &__inner {
140
140
  background: var(--ons-color-button-secondary);
141
141
  color: var(--ons-color-text);
142
- font-weight: normal;
142
+ font-weight: $font-weight-regular;
143
143
 
144
144
  .ons-svg-icon {
145
145
  fill: var(--ons-color-text);
@@ -187,7 +187,7 @@ $button-shadow-size: 3px;
187
187
  border-radius: 0;
188
188
  box-shadow: none;
189
189
  color: var(--ons-color-text-link);
190
- font-weight: normal;
190
+ font-weight: $font-weight-regular;
191
191
  padding: 0;
192
192
  .ons-svg-icon {
193
193
  fill: var(--ons-color-text-link);
@@ -445,7 +445,7 @@ $button-shadow-size: 3px;
445
445
  color: var(--ons-color-branded-text);
446
446
  display: block;
447
447
  font-size: 1rem;
448
- font-weight: normal;
448
+ font-weight: $font-weight-regular;
449
449
  padding: 0.6rem 1rem;
450
450
  text-align: left;
451
451
 
@@ -33,7 +33,7 @@
33
33
  margin-top: 0.5rem;
34
34
 
35
35
  .ons-label {
36
- font-weight: normal;
36
+ font-weight: $font-weight-regular;
37
37
  margin-bottom: 0;
38
38
  margin-right: 0.5rem;
39
39
  }
@@ -24,13 +24,13 @@
24
24
  }
25
25
 
26
26
  &__description--title {
27
- font-weight: normal;
27
+ font-weight: $font-weight-regular;
28
28
  }
29
29
 
30
30
  > * .ons-fieldset {
31
31
  .ons-fieldset {
32
32
  &__legend {
33
- font-weight: normal;
33
+ font-weight: $font-weight-regular;
34
34
  }
35
35
  }
36
36
  }
@@ -49,19 +49,4 @@
49
49
  margin-bottom: 0.5rem !important;
50
50
  }
51
51
  }
52
-
53
- &__poweredby,
54
- &__crest,
55
- &__partnership {
56
- font-size: 0;
57
- }
58
-
59
- &__partnership {
60
- &-prefix {
61
- @extend .ons-u-fs-s;
62
-
63
- margin-bottom: 0.2rem;
64
- margin-top: -0.3rem;
65
- }
66
- }
67
52
  }
@@ -29,18 +29,6 @@
29
29
  {% endif %}
30
30
  {% endset %}
31
31
 
32
- {% set poweredByLogo %}
33
- {% if params.poweredBy and params.poweredBy.logo %}
34
- {{
35
- onsIcon({
36
- "iconType": params.poweredBy.logo,
37
- "altText": params.poweredBy.alt,
38
- "altTextId": 'poweredby-alt'
39
- })
40
- }}
41
- {% endif %}
42
- {% endset %}
43
-
44
32
  <footer class="ons-footer">
45
33
 
46
34
  {% if params.footerWarning %}
@@ -122,116 +110,87 @@
122
110
  <hr class="ons-footer__hr">
123
111
  </div>
124
112
  {% endif %}
125
-
126
113
  </div>
127
114
 
128
- <div class="ons-grid ons-grid--flex ons-grid--vertical-top ons-grid--between">
129
- <div class="ons-grid__col">
130
- {% if params.legal %}
131
- <!-- Legal -->
132
- {% for legal in params.legal %}
133
- {{
134
- onsList({
135
- "classes": 'ons-u-mb-s ons-footer--rows',
136
- "variants": ['bare', 'inline'],
137
- "itemsList": legal.itemsList
138
- })
139
- }}
140
- {% endfor %}
141
- {% endif %}
115
+ <div class="ons-grid ons-grid--flex ons-grid--vertical-top ons-grid--between">
116
+ <div class="ons-grid__col">
117
+ {% if params.legal %}
118
+ <!-- Legal -->
119
+ {% for legal in params.legal %}
120
+ {{
121
+ onsList({
122
+ "classes": 'ons-u-mb-s ons-footer--rows',
123
+ "variants": ['bare', 'inline'],
124
+ "itemsList": legal.itemsList
125
+ })
126
+ }}
127
+ {% endfor %}
128
+ {% endif %}
142
129
 
143
- {% if params.OGLLink %}
144
- <!-- OGL -->
145
- <div class="ons-footer__license ons-u-mb-m">
146
- {{
147
- onsIcon({
148
- "iconType": 'ogl'
130
+ {% if params.OGLLink %}
131
+ <!-- OGL -->
132
+ <div class="ons-footer__license ons-u-mb-m">
133
+ {{
134
+ onsIcon({
135
+ "iconType": 'ogl'
136
+ })
137
+ }}
138
+ {% if params.OGLLink.HTML %}
139
+ {{ params.OGLLink.HTML | safe }}
140
+ {% elif params.OGLLink %}
141
+ {% from "components/external-link/_macro.njk" import onsExternalLink %}
142
+ {% if params.lang == 'cy' %}
143
+ {{ params.OGLLink.pre | default('Mae’r holl gynnwys ar gael o dan y') }} {{
144
+ onsExternalLink({
145
+ "url": params.OGLLink.url | default('https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/'),
146
+ "linkText": params.OGLLink.link | default('Drwydded Llywodraeth Leol v3.0')
149
147
  })
150
- }}
151
- {% if params.OGLLink.HTML %}
152
- {{ params.OGLLink.HTML | safe }}
153
- {% elif params.OGLLink %}
154
- {% from "components/external-link/_macro.njk" import onsExternalLink %}
155
- {% if params.lang == 'cy' %}
156
- {{ params.OGLLink.pre | default('Mae’r holl gynnwys ar gael o dan y') }} {{
148
+ }}{{ params.OGLLink.post | default(', oni bai y nodir fel arall') }}
149
+ {% else %}
150
+ {{ params.OGLLink.pre | default('All content is available under the') }} {{
157
151
  onsExternalLink({
158
152
  "url": params.OGLLink.url | default('https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/'),
159
- "linkText": params.OGLLink.link | default('Drwydded Llywodraeth Leol v3.0')
153
+ "linkText": params.OGLLink.link | default('Open Government Licence v3.0')
160
154
  })
161
- }}{{ params.OGLLink.post | default(', oni bai y nodir fel arall') }}
162
- {% else %}
163
- {{ params.OGLLink.pre | default('All content is available under the') }} {{
164
- onsExternalLink({
165
- "url": params.OGLLink.url | default('https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/'),
166
- "linkText": params.OGLLink.link | default('Open Government Licence v3.0')
167
- })
168
- }}{{ params.OGLLink.post | default(', except where otherwise stated') }}
169
- {% endif %}
155
+ }}{{ params.OGLLink.post | default(', except where otherwise stated') }}
170
156
  {% endif %}
171
- </div>
172
- {% endif %}
173
-
174
- {% if params.poweredBy %}
175
- {% if not params.poweredBy.partnership %}
176
- <div class="ons-footer__poweredby ons-u-mb-m">
177
- {{ poweredByLogo | safe }}
178
- </div>
179
157
  {% endif %}
180
- {% else %}
181
- <div class="ons-footer__poweredby ons-u-mb-m">
182
- {{ onsLogo | safe }}
183
- </div>
184
- {% endif %}
185
- </div>
186
-
187
- {% if params.crest %}
188
- <!-- Crest -->
189
- <div class="ons-grid__col ons-footer__crest ons-u-mb-m@xxs@l">
190
- {{
191
- onsIcon({
192
- "iconType": 'crest'
193
- })
194
- }}
195
158
  </div>
196
159
  {% endif %}
197
160
  </div>
198
-
199
- {% if (params.poweredBy) and (params.poweredBy.partnership) %}
200
- <div class="ons-grid ons-grid--flex ons-grid--vertical-bottom ons-grid--between ons-u-mt-l">
201
- <div class="ons-grid__col ons-footer__poweredby ons-u-mb-m">
202
- {{ poweredByLogo | safe }}
161
+ </div>
162
+
163
+ <div class="ons-grid ons-grid--flex ons-grid--vertical-bottom ons-grid--between ons-footer__poweredby">
164
+ {% if params.poweredBy %}
165
+ {{ params.poweredBy | safe }}
166
+ {% else %}
167
+ <div class="ons-grid__col ons-u-mb-m">
168
+ {{ onsLogo | safe }}
203
169
  </div>
204
-
205
- <div class="ons-grid__col ons-footer__partnership ons-u-mb-m">
206
- <div class="ons-footer__partnership-prefix">{{ params.poweredBy.partnership }}</div>
207
- {% if params.lang == 'cy' %}
208
- {{
209
- onsIcon({
210
- "iconType": 'ons-logo-cy',
211
- "altText": 'Swyddfa Ystadegau Gwladol',
212
- "altTextId": 'ons-logo-cy-footer-alt'
213
- })
214
- }}
215
- {% else %}
216
- {{
217
- onsIcon({
218
- "iconType": 'ons-logo-en',
219
- "altText": 'Office for National Statistics',
220
- "altTextId": 'ons-logo-en-footer-alt'
221
- })
222
- }}
223
- {% endif %}
170
+ {% endif %}
171
+ </div>
172
+
173
+ {% if params.crest %}
174
+ <!-- Crest -->
175
+ <div class="ons-grid ons-grid--flex ons-grid--vertical-bottom ons-grid--between">
176
+ <div class="ons-grid__col ons-footer__crest ons-u-mb-m@xxs@l">
177
+ {{
178
+ onsIcon({
179
+ "iconType": 'crest'
180
+ })
181
+ }}
224
182
  </div>
225
183
  </div>
184
+
226
185
  {% endif %}
227
186
 
228
187
  {% if params.copyrightDeclaration %}
229
- <!-- Copyright -->
230
- <div class="ons-grid">
231
- <div class="ons-grid__col">
232
- <p class="ons-u-fs-s ons-u-mb-no ons-footer__copyright">&copy; {{ params.copyrightDeclaration.copyright }} <br> {{ params.copyrightDeclaration.text }}</p>
188
+ <!-- Copyright -->
189
+ <div class="ons-grid ons-grid--flex ons-grid--vertical-bottom ons-grid--between">
190
+ <div class="ons-grid__col">
191
+ <p class="ons-u-fs-s ons-u-mb-no ons-footer__copyright">&copy; {{ params.copyrightDeclaration.copyright }} <br> {{ params.copyrightDeclaration.text }}</p>
192
+ </div>
233
193
  </div>
234
- </div>
235
194
  {% endif %}
236
195
  </div>
237
196
  </div>
@@ -6,17 +6,6 @@ import axe from '../../tests/helpers/axe';
6
6
  import { mapAll } from '../../tests/helpers/cheerio';
7
7
  import { renderComponent, templateFaker } from '../../tests/helpers/rendering';
8
8
 
9
- const EXAMPLE_POWERED_BY_PARAM = {
10
- logo: 'person',
11
- alt: 'Person alt text',
12
- };
13
-
14
- const EXAMPLE_POWERED_BY_WITH_PARTNERSHIP_PARAM = {
15
- logo: 'person',
16
- alt: 'Person alt text',
17
- partnership: 'Prefix text string',
18
- };
19
-
20
9
  const EXAMPLE_OGL_LINK_PARAM = {
21
10
  pre: 'All content is available under the',
22
11
  link: 'Open Government Licence v3.0',
@@ -365,162 +354,102 @@ describe('macro: footer', () => {
365
354
  });
366
355
  });
367
356
 
368
- describe('powered by logo', () => {
369
- describe.each([
370
- [
371
- 'the `lang` parameter is not provided',
372
- {},
373
- {
374
- iconType: 'ons-logo-en',
375
- altText: 'Office for National Statistics',
376
- },
377
- ],
378
- [
379
- 'the `lang` parameter is "en"',
380
- { lang: 'en' },
381
- {
382
- iconType: 'ons-logo-en',
383
- altText: 'Office for National Statistics',
384
- },
385
- ],
386
- [
387
- 'the `lang` parameter is "cy"',
388
- { lang: 'cy' },
389
- {
390
- iconType: 'ons-logo-cy',
391
- altText: 'Swyddfa Ystadegau Gwladol',
392
- },
393
- ],
394
- ])('where %s', (_, langParams, defaultIcon) => {
357
+ describe('poweredBy logo', () => {
358
+ describe('default poweredBy logo', () => {
395
359
  describe.each([
396
360
  [
397
- 'the `poweredBy` and `OGLLink` parameters are provided',
361
+ 'the `lang` parameter is not provided',
362
+ {},
398
363
  {
399
- poweredBy: EXAMPLE_POWERED_BY_PARAM,
400
- OGLLink: EXAMPLE_OGL_LINK_PARAM,
401
- },
402
- {
403
- iconType: 'person',
404
- altText: 'Person alt text',
364
+ iconType: 'ons-logo-en',
365
+ altText: 'Office for National Statistics',
405
366
  },
406
367
  ],
407
368
  [
408
- 'the `poweredBy.partnership` and `OGLLink` parameters are provided',
409
- {
410
- poweredBy: EXAMPLE_POWERED_BY_WITH_PARTNERSHIP_PARAM,
411
- OGLLink: EXAMPLE_OGL_LINK_PARAM,
412
- },
369
+ 'the `lang` parameter is "en"',
370
+ { lang: 'en' },
413
371
  {
414
- iconType: 'person',
415
- altText: 'Person alt text',
372
+ iconType: 'ons-logo-en',
373
+ altText: 'Office for National Statistics',
416
374
  },
417
375
  ],
376
+ ])('where %s', (_, langParams, defaultIcon) => {
377
+ const params = {
378
+ ...langParams,
379
+ };
380
+ it('renders the expected icon', () => {
381
+ const faker = templateFaker();
382
+ const iconsSpy = faker.spy('icons');
383
+
384
+ faker.renderComponent('footer', params);
385
+
386
+ expect(iconsSpy.occurrences).toContainEqual(expect.objectContaining(defaultIcon));
387
+ });
388
+ });
389
+ });
390
+ describe('provided poweredBy logo', () => {
391
+ describe.each([
418
392
  [
419
- 'the `poweredBy` parameter is not provided but the `legal` parameter is provided',
393
+ 'the `lang` parameter is "cy"',
394
+ { lang: 'cy' },
420
395
  {
421
- legal: EXAMPLE_LEGAL_PARAM,
396
+ iconType: 'ons-logo-cy',
397
+ altText: 'Swyddfa Ystadegau Gwladol',
422
398
  },
423
- defaultIcon,
424
399
  ],
400
+ ])('where %s', (_, langParams, defaultIcon) => {
401
+ const params = {
402
+ ...langParams,
403
+ };
404
+ it('renders the expected icon', () => {
405
+ const faker = templateFaker();
406
+ const iconsSpy = faker.spy('icons');
407
+
408
+ faker.renderComponent('footer', params);
409
+
410
+ expect(iconsSpy.occurrences).toContainEqual(expect.objectContaining(defaultIcon));
411
+ });
412
+ });
413
+ });
414
+ describe('provided poweredBy logo', () => {
415
+ describe.each([
425
416
  [
426
- 'the `poweredBy` parameter is not provided but the `legal` and `OGLLink` parameters are provided',
417
+ 'the `poweredBy` and `OGLLink` parameters are provided',
427
418
  {
428
- legal: EXAMPLE_LEGAL_PARAM,
419
+ poweredBy: '<img src="logo.svg" alt="logo">',
429
420
  OGLLink: EXAMPLE_OGL_LINK_PARAM,
430
421
  },
431
- defaultIcon,
432
422
  ],
433
423
  [
434
424
  'the `poweredBy` and `legal` parameters are provided',
435
425
  {
436
- poweredBy: EXAMPLE_POWERED_BY_PARAM,
426
+ poweredBy: '<img src="logo.svg" alt="logo">',
437
427
  legal: EXAMPLE_LEGAL_PARAM,
438
428
  },
439
- {
440
- iconType: 'person',
441
- altText: 'Person alt text',
442
- },
443
- ],
444
- [
445
- 'the `poweredBy.partnership` and `legal` parameters are provided',
446
- {
447
- poweredBy: EXAMPLE_POWERED_BY_WITH_PARTNERSHIP_PARAM,
448
- legal: EXAMPLE_LEGAL_PARAM,
449
- },
450
- {
451
- iconType: 'person',
452
- altText: 'Person alt text',
453
- },
454
429
  ],
455
430
  [
456
431
  'the `poweredBy` and `crest` parameters are provided',
457
432
  {
458
- poweredBy: EXAMPLE_POWERED_BY_PARAM,
433
+ poweredBy: '<img src="logo.svg" alt="logo">',
459
434
  crest: true,
460
435
  },
461
- {
462
- iconType: 'person',
463
- altText: 'Person alt text',
464
- },
465
- ],
466
- [
467
- 'the `poweredBy.partnership` and `crest` parameters are provided',
468
- {
469
- poweredBy: EXAMPLE_POWERED_BY_WITH_PARTNERSHIP_PARAM,
470
- crest: true,
471
- },
472
- {
473
- iconType: 'person',
474
- altText: 'Person alt text',
475
- },
476
436
  ],
477
437
  [
478
438
  'the `poweredBy`, `legal` and `crest` parameters are provided',
479
439
  {
480
- poweredBy: EXAMPLE_POWERED_BY_PARAM,
481
- legal: EXAMPLE_LEGAL_PARAM,
482
- crest: true,
483
- },
484
- {
485
- iconType: 'person',
486
- altText: 'Person alt text',
487
- },
488
- ],
489
- [
490
- 'the `poweredBy.partnership`, `legal` and `crest` parameters are provided',
491
- {
492
- poweredBy: EXAMPLE_POWERED_BY_WITH_PARTNERSHIP_PARAM,
440
+ poweredBy: '<img src="logo.svg" alt="logo">',
493
441
  legal: EXAMPLE_LEGAL_PARAM,
494
442
  crest: true,
495
443
  },
496
- {
497
- iconType: 'person',
498
- altText: 'Person alt text',
499
- },
500
444
  ],
501
445
  [
502
446
  'the `poweredBy` parameter is provided but the `legal` and `crest` parameters are not provided',
503
447
  {
504
- poweredBy: EXAMPLE_POWERED_BY_PARAM,
505
- },
506
- {
507
- iconType: 'person',
508
- altText: 'Person alt text',
448
+ poweredBy: '<img src="logo.svg" alt="logo">',
509
449
  },
510
450
  ],
511
- [
512
- 'the `poweredBy.partnership` parameter is provided but the `legal` and `crest` parameters are not provided',
513
- {
514
- poweredBy: EXAMPLE_POWERED_BY_WITH_PARTNERSHIP_PARAM,
515
- },
516
- {
517
- iconType: 'person',
518
- altText: 'Person alt text',
519
- },
520
- ],
521
- ])('where %s', (_, poweredByParams, expectedIcon) => {
451
+ ])('where %s', (_, poweredByParams) => {
522
452
  const params = {
523
- ...langParams,
524
453
  ...poweredByParams,
525
454
  };
526
455
 
@@ -531,13 +460,10 @@ describe('macro: footer', () => {
531
460
  expect(results).toHaveNoViolations();
532
461
  });
533
462
 
534
- it('renders the expected icon', () => {
535
- const faker = templateFaker();
536
- const iconsSpy = faker.spy('icons');
537
-
538
- faker.renderComponent('footer', params);
463
+ it('renders the expected logo', () => {
464
+ const $ = cheerio.load(renderComponent('footer', params));
539
465
 
540
- expect(iconsSpy.occurrences).toContainEqual(expect.objectContaining(expectedIcon));
466
+ expect($('.ons-footer__poweredby img').attr('src')).toBe('logo.svg');
541
467
  });
542
468
  });
543
469
  });
@@ -631,60 +557,4 @@ describe('macro: footer', () => {
631
557
  expect($('.ons-footer__crest').length).toBe(1);
632
558
  });
633
559
  });
634
-
635
- describe('partnership', () => {
636
- const params = {
637
- poweredBy: EXAMPLE_POWERED_BY_WITH_PARTNERSHIP_PARAM,
638
- };
639
-
640
- it('passes jest-axe checks', async () => {
641
- const $ = cheerio.load(renderComponent('footer', params));
642
-
643
- const results = await axe($.html());
644
- expect(results).toHaveNoViolations();
645
- });
646
-
647
- it('renders ONS icon when `partnership` parameter is provided', () => {
648
- const faker = templateFaker();
649
- const iconsSpy = faker.spy('icons');
650
-
651
- faker.renderComponent('footer', params);
652
-
653
- expect(iconsSpy.occurrences).toContainEqual(expect.objectContaining({ iconType: 'ons-logo-en' }));
654
- });
655
-
656
- it('renders "poweredBy" icon when `partnership` parameter is provided', () => {
657
- const faker = templateFaker();
658
- const iconsSpy = faker.spy('icons');
659
-
660
- faker.renderComponent('footer', params);
661
-
662
- expect(iconsSpy.occurrences).toContainEqual(expect.objectContaining({ iconType: 'person' }));
663
- });
664
-
665
- it('renders "poweredBy" element when `partnership` parameter is provided', () => {
666
- const $ = cheerio.load(renderComponent('footer', params));
667
-
668
- expect($('.ons-footer__poweredby').length).toBe(1);
669
- });
670
-
671
- it('renders "partnership" and "prefix" elements when `partnership` parameter is provided', () => {
672
- const $ = cheerio.load(renderComponent('footer', params));
673
-
674
- expect($('.ons-footer__partnership').length).toBe(1);
675
- expect($('.ons-footer__partnership-prefix').length).toBe(1);
676
- });
677
-
678
- it('does not render "partnership" element when `partnership` parameter is not provided', () => {
679
- const params = {
680
- poweredBy: {
681
- logo: 'person',
682
- alt: 'Person alt text',
683
- },
684
- };
685
- const $ = cheerio.load(renderComponent('footer', params));
686
-
687
- expect($('.ons-footer__partnership').length).toBe(0);
688
- });
689
- });
690
560
  });