@iamproperty/components 7.6.4--beta6 → 7.6.4--beta7

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 (137) hide show
  1. package/assets/css/components/actionbar.component.css +1 -1
  2. package/assets/css/components/actionbar.component.css.map +1 -1
  3. package/assets/css/components/address-lookup.component.css +1 -1
  4. package/assets/css/components/address-lookup.component.css.map +1 -1
  5. package/assets/css/components/barchart.component.css +1 -1
  6. package/assets/css/components/barchart.component.css.map +1 -1
  7. package/assets/css/components/calendar.component.css +1 -1
  8. package/assets/css/components/calendar.component.css.map +1 -1
  9. package/assets/css/components/card.component.css +1 -1
  10. package/assets/css/components/card.component.css.map +1 -1
  11. package/assets/css/components/carousel.component.css +1 -1
  12. package/assets/css/components/carousel.component.css.map +1 -1
  13. package/assets/css/components/collapsible-side.css +1 -1
  14. package/assets/css/components/collapsible-side.css.map +1 -1
  15. package/assets/css/components/content.component.css +1 -1
  16. package/assets/css/components/content.component.css.map +1 -1
  17. package/assets/css/components/doughnutchart.component.css +1 -1
  18. package/assets/css/components/doughnutchart.component.css.map +1 -1
  19. package/assets/css/components/fileupload.css +1 -1
  20. package/assets/css/components/fileupload.css.map +1 -1
  21. package/assets/css/components/modal.component.css +1 -1
  22. package/assets/css/components/modal.component.css.map +1 -1
  23. package/assets/css/components/multi-step-modal.component.css +1 -1
  24. package/assets/css/components/multi-step-modal.component.css.map +1 -1
  25. package/assets/css/components/multiselect.css +1 -1
  26. package/assets/css/components/multiselect.css.map +1 -1
  27. package/assets/css/components/nav.component.css +1 -1
  28. package/assets/css/components/nav.component.css.map +1 -1
  29. package/assets/css/components/nav.global.css +1 -1
  30. package/assets/css/components/nav.global.css.map +1 -1
  31. package/assets/css/components/pagination.css +1 -1
  32. package/assets/css/components/pagination.css.map +1 -1
  33. package/assets/css/components/slider.css +1 -1
  34. package/assets/css/components/slider.css.map +1 -1
  35. package/assets/css/components/split-button.component.css +1 -1
  36. package/assets/css/components/split-button.component.css.map +1 -1
  37. package/assets/css/components/table-basic.component.css +1 -1
  38. package/assets/css/components/table-basic.component.css.map +1 -1
  39. package/assets/css/components/table-basic.global.css +1 -1
  40. package/assets/css/components/table-basic.global.css.map +1 -1
  41. package/assets/css/components/table.component.css +1 -1
  42. package/assets/css/components/table.component.css.map +1 -1
  43. package/assets/css/components/table.global.css +1 -1
  44. package/assets/css/components/table.global.css.map +1 -1
  45. package/assets/css/components/tabs.component.css +1 -1
  46. package/assets/css/components/tabs.component.css.map +1 -1
  47. package/assets/css/components/tag.component.css +1 -1
  48. package/assets/css/components/tag.component.css.map +1 -1
  49. package/assets/css/components/video-modal.component.css +1 -1
  50. package/assets/css/components/video-modal.component.css.map +1 -1
  51. package/assets/css/core.min.css +1 -1
  52. package/assets/css/core.min.css.map +1 -1
  53. package/assets/css/style.min.css +1 -1
  54. package/assets/css/style.min.css.map +1 -1
  55. package/assets/js/components/accordion/accordion.component.min.js +1 -1
  56. package/assets/js/components/actionbar/actionbar.component.min.js +2 -2
  57. package/assets/js/components/address-lookup/address-lookup.component.min.js +2 -2
  58. package/assets/js/components/advanced-select/advanced-select.component.min.js +1 -1
  59. package/assets/js/components/applied-filters/applied-filters.component.min.js +1 -1
  60. package/assets/js/components/barchart/barchart.component.min.js +2 -2
  61. package/assets/js/components/bento-grid/bento-grid.component.min.js +1 -1
  62. package/assets/js/components/calendar/calendar.component.min.js +2 -2
  63. package/assets/js/components/card/card.component.min.js +2 -2
  64. package/assets/js/components/carousel/carousel.component.min.js +3 -3
  65. package/assets/js/components/collapsible-side/collapsible-side.component.min.js +2 -2
  66. package/assets/js/components/content/content.component.min.js +4 -4
  67. package/assets/js/components/darkmode/darkmode.component.min.js +1 -1
  68. package/assets/js/components/doughnutchart/doughnutchart.component.min.js +2 -2
  69. package/assets/js/components/fileupload/fileupload.component.min.js +2 -2
  70. package/assets/js/components/filter-card/filter-card.component.min.js +1 -1
  71. package/assets/js/components/filterlist/filterlist.component.min.js +1 -1
  72. package/assets/js/components/form/form.component.min.js +1 -1
  73. package/assets/js/components/header/header.component.min.js +1 -1
  74. package/assets/js/components/inline-edit/inline-edit.component.min.js +1 -1
  75. package/assets/js/components/input/input.component.min.js +1 -1
  76. package/assets/js/components/input-range/input-range.component.min.js +1 -1
  77. package/assets/js/components/marketing/marketing.component.min.js +1 -1
  78. package/assets/js/components/menu/menu.component.min.js +1 -1
  79. package/assets/js/components/milestone/milestone.component.min.js +1 -1
  80. package/assets/js/components/milestone-group/milestone-group.component.min.js +1 -1
  81. package/assets/js/components/modal/modal.component.min.js +4 -4
  82. package/assets/js/components/multi-step/multi-step.component.min.js +1 -1
  83. package/assets/js/components/multi-step-modal/multi-step-modal.component.min.js +4 -4
  84. package/assets/js/components/multiselect/multiselect.component.min.js +2 -2
  85. package/assets/js/components/nav/nav.component.min.js +3 -3
  86. package/assets/js/components/notification/notification.component.min.js +1 -1
  87. package/assets/js/components/pagination/pagination.component.min.js +2 -2
  88. package/assets/js/components/password/password.component.min.js +1 -1
  89. package/assets/js/components/popover/popover.component.min.js +1 -1
  90. package/assets/js/components/rank/rank.component.min.js +1 -1
  91. package/assets/js/components/rankings/rankings.component.min.js +1 -1
  92. package/assets/js/components/rating/rating.component.min.js +1 -1
  93. package/assets/js/components/record-card/record-card.component.min.js +1 -1
  94. package/assets/js/components/search/search.component.min.js +1 -1
  95. package/assets/js/components/slider/slider.component.min.js +2 -2
  96. package/assets/js/components/split-button/split-button.component.min.js +5 -5
  97. package/assets/js/components/std-address-lookup/std-address-lookup.component.min.js +2 -2
  98. package/assets/js/components/table/table.component.min.js +8 -6
  99. package/assets/js/components/table/table.component.min.js.map +1 -1
  100. package/assets/js/components/table-ajax/table-ajax.component.min.js +8 -6
  101. package/assets/js/components/table-ajax/table-ajax.component.min.js.map +1 -1
  102. package/assets/js/components/table-basic/table-basic.component.min.js +7 -5
  103. package/assets/js/components/table-basic/table-basic.component.min.js.map +1 -1
  104. package/assets/js/components/table-no-submit/table-no-submit.component.min.js +8 -6
  105. package/assets/js/components/table-no-submit/table-no-submit.component.min.js.map +1 -1
  106. package/assets/js/components/table-submit/table-submit.component.min.js +8 -6
  107. package/assets/js/components/table-submit/table-submit.component.min.js.map +1 -1
  108. package/assets/js/components/tabs/tabs.component.min.js +3 -3
  109. package/assets/js/components/tag/tag.component.min.js +2 -2
  110. package/assets/js/components/tooltip/tooltip.component.min.js +1 -1
  111. package/assets/js/components/video-card/video-card.component.min.js +1 -1
  112. package/assets/js/components/video-modal/video-modal.component.min.js +2 -2
  113. package/assets/js/components/word-count/word-count.component.min.js +1 -1
  114. package/assets/js/modules/integration-tests.js +402 -0
  115. package/assets/js/modules/table.js +17 -1
  116. package/assets/js/scripts.bundle.js +5 -2
  117. package/assets/js/scripts.bundle.js.map +1 -1
  118. package/assets/js/scripts.bundle.min.js +2 -2
  119. package/assets/js/scripts.bundle.min.js.map +1 -1
  120. package/assets/js/scripts.js +11 -0
  121. package/assets/sass/components/modal.component.scss +1 -0
  122. package/assets/sass/components/nav.global.scss +9 -5
  123. package/assets/sass/components/table-basic.component.scss +3 -0
  124. package/assets/sass/components/table-basic.global.scss +124 -2
  125. package/assets/sass/components/table.global.scss +153 -0
  126. package/assets/sass/elements/button__group.css +57 -16
  127. package/assets/sass/elements/buttons--compact.scss +2 -2
  128. package/assets/sass/elements/buttons--special.scss +1 -1
  129. package/assets/sass/elements/label.scss +4 -0
  130. package/assets/sass/elements/progress.scss +2 -2
  131. package/assets/ts/modules/integration-tests.ts +526 -0
  132. package/assets/ts/modules/table.ts +22 -1
  133. package/assets/ts/scripts.ts +14 -0
  134. package/dist/components.es.js +29 -29
  135. package/dist/components.umd.js +226 -216
  136. package/package.json +2 -2
  137. package/src/components/Header/Header.vue +1 -1
@@ -0,0 +1,402 @@
1
+ const integrationTests = () => {
2
+ let errorTable = [];
3
+ let test = {};
4
+ const intro = "These tests run against mark-up and content meant to test how a component or element has been integrated. Making sure that guidance setout in the design system is being followed.";
5
+ window.integrationTestsIntro = intro;
6
+ console.log("%cVirgin Money Framework Tests", "color: #E10A0A; font-size: 24px; font-weight: bold; margin-top: 20px; margin-bottom: 10px;");
7
+ console.log("%c" + intro, "font-size: 14px; margin-bottom: 20px;");
8
+ console.log("%cKey", "font-size: 16px;font-weight:bold;");
9
+ console.log('%c %c' + 'Successfully implemented', 'background-color: green; margin-right: 10px', 'background-color: transparent');
10
+ console.log('%c %c' + 'NOT implemented correctly', 'background-color: red; margin-right: 10px', 'background-color: transparent');
11
+ console.log('%c %c' + 'N/A', 'background-color: grey; margin-right: 10px', 'background-color: transparent');
12
+ console.log('%c %c' + 'Warning - No action needed', 'background-color: orange; margin-right: 10px', 'background-color: transparent');
13
+ console.log('%c ? %c' + 'Warning - Action needed', 'background-color: orange; margin-right: 10px', 'background-color: transparent');
14
+ // #region Card deck Footer test
15
+ test = {
16
+ 'Test': 'Each card with in a card deck has a footer with some CTA text via a button link',
17
+ 'Total': 0,
18
+ 'Passes': 0,
19
+ 'Fails': 0
20
+ };
21
+ Array.from(document.querySelectorAll('.card-deck .card')).forEach((card, index) => {
22
+ if (card.closest('.navbar') == null) {
23
+ let btnLink = card.querySelector('.btn-link');
24
+ if (btnLink != null && btnLink.textContent.length)
25
+ test['Passes']++;
26
+ else
27
+ test['Fails']++;
28
+ }
29
+ });
30
+ test['Total'] = test['Passes'] + test['Fails'];
31
+ errorTable.push(test);
32
+ // #endregion
33
+ // #region Article deck background colour
34
+ test = {
35
+ 'Test': 'Article Decks need to have a background colour applied',
36
+ 'Total': 0,
37
+ 'Passes': 0,
38
+ 'Fails': 0
39
+ };
40
+ Array.from(document.querySelectorAll('.article-deck')).forEach((deck, index) => {
41
+ let container = deck.closest('.container');
42
+ if (container != null && container.matches('[class*="bg-"]'))
43
+ test['Passes']++;
44
+ else
45
+ test['Fails']++;
46
+ });
47
+ test['Total'] = test['Passes'] + test['Fails'];
48
+ errorTable.push(test);
49
+ // #endregion
50
+ // #region Tabs Carousel title test
51
+ test = {
52
+ 'Test': 'Tabs Carousel has a h2 title with a display-4 class. It should always have a strapline next to it also.',
53
+ 'Total': 0,
54
+ 'Passes': 0,
55
+ 'Fails': 0,
56
+ 'Notes': 'The site nav contains cards without a footer by design.'
57
+ };
58
+ Array.from(document.querySelectorAll('.tabs__container--carousel')).forEach((tabs, index) => {
59
+ let title = tabs.querySelector('h2.display-4:first-child');
60
+ let strapline = tabs.querySelector('h2.display-4:first-child + .strapline');
61
+ if (title != null && strapline != null)
62
+ test['Passes']++;
63
+ else
64
+ test['Fails']++;
65
+ });
66
+ test['Total'] = test['Passes'] + test['Fails'];
67
+ errorTable.push(test);
68
+ // #endregion
69
+ // #region Split Container tests
70
+ test = {
71
+ 'Test': 'Split Containers can only have multiple of two columns. So either 2, 4, 6 and so on.',
72
+ 'Total': 0,
73
+ 'Passes': 0,
74
+ 'Fails': 0,
75
+ 'Notes': ''
76
+ };
77
+ Array.from(document.querySelectorAll('.container.container--split')).forEach((container, index) => {
78
+ if (container.querySelectorAll(':scope > .row > [class*="col"]').length % 2 === 0)
79
+ test['Passes']++;
80
+ else
81
+ test['Fails']++;
82
+ });
83
+ test['Total'] = test['Passes'] + test['Fails'];
84
+ errorTable.push(test);
85
+ // #endregion
86
+ // #region Statement Container tests
87
+ test = {
88
+ 'Test': 'Statement Containers with only one paragraph or text element should have the class of .h6',
89
+ 'Total': 0,
90
+ 'Passes': 0,
91
+ 'Fails': 0,
92
+ 'Notes': ''
93
+ };
94
+ Array.from(document.querySelectorAll('.container.container--statement')).forEach((container, index) => {
95
+ if (container.querySelectorAll(':scope > *').length == 1 && container.querySelectorAll(':scope > .h6:first-child').length == 1)
96
+ test['Passes']++;
97
+ else if (container.querySelectorAll(':scope > *').length == 1)
98
+ test['Fails']++;
99
+ });
100
+ test['Total'] = test['Passes'] + test['Fails'];
101
+ errorTable.push(test);
102
+ // #endregion
103
+ // #region CTA Container tests
104
+ test = {
105
+ 'Test': 'CTA Containers title should always have the class of .h1',
106
+ 'Total': 0,
107
+ 'Passes': 0,
108
+ 'Fails': 0,
109
+ 'Notes': ''
110
+ };
111
+ Array.from(document.querySelectorAll('.container.container--cta')).forEach((container, index) => {
112
+ if (container.querySelectorAll('h2.h1:first-child').length == 1)
113
+ test['Passes']++;
114
+ else
115
+ test['Fails']++;
116
+ });
117
+ test['Total'] = test['Passes'] + test['Fails'];
118
+ errorTable.push(test);
119
+ // #endregion
120
+ // Print Implementation tests
121
+ console.log("%cImplementation Tests", "font-size: 16px;font-weight:bold; margin-top: 20px;");
122
+ errorTable.forEach(function (entry) {
123
+ let color = 'green';
124
+ if (entry['Total'] === 0) {
125
+ color = 'grey';
126
+ }
127
+ else if (entry['Fails'] != 0) {
128
+ color = 'red';
129
+ }
130
+ if (entry['Type'] == 'warning') {
131
+ color = 'orange';
132
+ }
133
+ console.groupCollapsed('%c %c' + entry.Test, 'background-color: ' + color + '; margin-right: 10px', 'background-color: transparent');
134
+ console.table({
135
+ Passed: { value: entry['Passes'] },
136
+ Failed: { value: entry['Fails'] },
137
+ Total: { value: entry['Total'] }
138
+ });
139
+ if (entry['Notes'] != '') {
140
+ console.log(entry['Notes']);
141
+ }
142
+ console.groupEnd();
143
+ });
144
+ window.integrationTests = errorTable;
145
+ // Resest table
146
+ var errorTableUtility = [];
147
+ // #region Padding classes
148
+ test = {
149
+ 'Test': 'There are XX padding classes being used on this page',
150
+ 'Type': 'warning',
151
+ 'Total': 0,
152
+ 'Passes': 0,
153
+ 'Fails': 0,
154
+ 'Notes': ''
155
+ };
156
+ Array.from(document.querySelectorAll('[class*="p-"],[class*="pt-"],[class*="pb-"],[class*="pl-"],[class*="pr-"],[class*="px-"],[class*="py-"]')).forEach((element, index) => {
157
+ test['Total']++;
158
+ });
159
+ test['Test'] = test['Test'].replace('XX', test['Total']);
160
+ errorTableUtility.push(test);
161
+ // #endregion
162
+ // #region Margin classes
163
+ test = {
164
+ 'Test': 'There are XX margin classes being used on this page',
165
+ 'Type': 'warning',
166
+ 'Total': 0,
167
+ 'Passes': 0,
168
+ 'Fails': 0,
169
+ 'Notes': ''
170
+ };
171
+ Array.from(document.querySelectorAll('[class*="m-"],[class*="mt-"],[class*="mb-"],[class*="ml-"],[class*="mr-"],[class*="mx-"],[class*="my-"]')).forEach((element, index) => {
172
+ test['Total']++;
173
+ });
174
+ test['Test'] = test['Test'].replace('XX', test['Total']);
175
+ errorTableUtility.push(test);
176
+ // #endregion
177
+ // #region Text modifier classes
178
+ test = {
179
+ 'Test': 'There are XX text modifier classes being used on this page',
180
+ 'Type': 'warning',
181
+ 'Total': 0,
182
+ 'Passes': 0,
183
+ 'Fails': 0,
184
+ 'Notes': ''
185
+ };
186
+ Array.from(document.querySelectorAll('[class*="text-"]')).forEach((element, index) => {
187
+ test['Total']++;
188
+ });
189
+ test['Test'] = test['Test'].replace('XX', test['Total']);
190
+ errorTableUtility.push(test);
191
+ // #endregion
192
+ // Print the utility classes tests
193
+ console.log("%cUtility classes", "font-size: 16px;font-weight:bold;");
194
+ console.log("The use of certain utility classes is necessary at times but the over use of these classes will lead to design/layout inconsistencies.");
195
+ errorTableUtility.forEach(function (entry) {
196
+ let color = 'green';
197
+ if (entry['Total'] === 0)
198
+ color = 'grey';
199
+ else if (entry['Fails'] != 0)
200
+ color = 'red';
201
+ if (entry['Type'] == 'warning')
202
+ color = 'orange';
203
+ console.groupCollapsed('%c %c' + entry.Test, 'background-color: ' + color + '; margin-right: 10px', 'background-color: transparent');
204
+ console.table({
205
+ Total: { value: entry['Total'] }
206
+ });
207
+ if (entry['Notes'] != '') {
208
+ console.log(entry['Notes']);
209
+ }
210
+ console.groupEnd();
211
+ });
212
+ // #region Headings out of context tests
213
+ console.log("%cAccessibility and Best practice Tests", "font-size: 16px;font-weight:bold;");
214
+ let color = 'green';
215
+ let contextLevel = 1;
216
+ let headingTable = {};
217
+ Array.from(document.querySelectorAll('h1,h2,h3,h4,h5,h6')).forEach((heading, index) => {
218
+ let level = 1;
219
+ let text = heading.textContent;
220
+ if (heading.matches("h2"))
221
+ level = 2;
222
+ else if (heading.matches("h3"))
223
+ level = 3;
224
+ else if (heading.matches("h4"))
225
+ level = 4;
226
+ else if (heading.matches("h5"))
227
+ level = 5;
228
+ else if (heading.matches("h6"))
229
+ level = 6;
230
+ let inOrder = (level - contextLevel) <= 1;
231
+ if (index == 0 && level != 1) {
232
+ inOrder = false;
233
+ }
234
+ let test = {
235
+ "Heading Level": level,
236
+ "In order": inOrder
237
+ };
238
+ if (inOrder) {
239
+ contextLevel = level;
240
+ }
241
+ else {
242
+ color = 'red';
243
+ }
244
+ headingTable[text] = test;
245
+ });
246
+ console.groupCollapsed('%c %c' + 'Headings are in the correct order', 'background-color: ' + color + '; margin-right: 10px', 'background-color: transparent');
247
+ console.table(headingTable);
248
+ console.groupEnd();
249
+ console.groupCollapsed('%c ? %c' + 'Do all of the headings make sense out of context and do they introduce the content that follows?', 'background-color: ' + 'orange' + '; margin-right: 10px', 'background-color: transparent');
250
+ console.log("You should be able to read the below table and get an understanding of what the page content consists of. The titles should make sense when read in order and child titles should be relevant to the parent title.");
251
+ console.table(headingTable);
252
+ console.groupEnd();
253
+ // #endregion
254
+ // #region Links out of context tests
255
+ let linksTable = {};
256
+ Array.from(document.querySelectorAll('a')).forEach((link, index) => {
257
+ var url = link.getAttribute('href');
258
+ var text = link.textContent;
259
+ var title = link.getAttribute('title');
260
+ let test = {
261
+ "Text": text,
262
+ "Title": title
263
+ };
264
+ linksTable[url] = test;
265
+ });
266
+ console.groupCollapsed('%c ? %c' + 'Do all of the links make sense out of context and do they describe the page/section that it links to?', 'background-color: ' + 'orange' + '; margin-right: 10px', 'background-color: transparent');
267
+ console.table(linksTable);
268
+ console.groupEnd();
269
+ // #endregion
270
+ // #region Image alt tags out of context tests
271
+ let imgTable = {};
272
+ let imgNoAltTable = {};
273
+ Array.from(document.querySelectorAll('img[alt]')).forEach((image, index) => {
274
+ var url = image.getAttribute('src');
275
+ var alt = image.getAttribute('alt');
276
+ if (alt != "") {
277
+ let test = {
278
+ "Alt": alt
279
+ };
280
+ imgTable[url] = test;
281
+ }
282
+ else {
283
+ var url = image.getAttribute('src');
284
+ let test = {};
285
+ imgNoAltTable[url] = test;
286
+ }
287
+ });
288
+ console.groupCollapsed('%c ? %c' + 'Do all of the images with an alt tag make sense out of context and describes the image appropriately?', 'background-color: ' + 'orange' + '; margin-right: 10px', 'background-color: transparent');
289
+ console.table(imgTable);
290
+ console.log('%cImages with an empty alt tag:', 'font-weight: bold;');
291
+ console.table(imgNoAltTable);
292
+ console.groupEnd();
293
+ // #endregion
294
+ // #region Keyboard user messages
295
+ console.groupCollapsed('%c ? %c' + 'Can you navigation the page links by tabbing through the page?', 'background-color: ' + 'orange' + '; margin-right: 10px', 'background-color: transparent');
296
+ console.log('Are all of the links, input fields and buttons accessible through using the keyboard only?');
297
+ console.groupEnd();
298
+ // #endregion
299
+ console.log("%cLighthouse", "font-size: 16px;font-weight:bold;");
300
+ // #region Lighthouse
301
+ console.groupCollapsed('%c ? %c' + 'Have you ran a lighthouse report on this page', 'background-color: ' + 'orange' + '; margin-right: 10px', 'background-color: transparent');
302
+ console.log('If you are in a modern version of chrome you can a lighthouse report by opening the lighthouse window within the devtools. This should appear as a tab link above.');
303
+ console.log('This report will give you more detail about the above the tests aswell as extra tests. ');
304
+ console.groupEnd();
305
+ // #endregion
306
+ console.log("%cImage sizes", "font-size: 16px;font-weight:bold;");
307
+ console.log("The below tests work from the current screen size, so if you have your screen at a mobile viewport the scaling and sizes of images will reflect that. It is worth running the image tests in both mobile and desktop views. Simply change the screen size and refresh the page.");
308
+ Array.from(document.querySelectorAll('img')).forEach((imgElem, index) => {
309
+ if (!imgElem.matches("[src*='http']") && !imgElem.matches("[src$='.svg']")) {
310
+ let src = imgElem.getAttribute('src');
311
+ var xhr = new XMLHttpRequest();
312
+ xhr.open('HEAD', src, true);
313
+ xhr.onreadystatechange = function () {
314
+ if (xhr.readyState == 4) {
315
+ if (xhr.status == 200) {
316
+ var imgFSize = xhr.getResponseHeader('Content-Length');
317
+ if (imgFSize > 1024) { //ignore images under 1Kb
318
+ var imgW = imgElem.naturalWidth;
319
+ var imgH = imgElem.naturalHeight;
320
+ var imgW2 = imgElem.clientWidth;
321
+ var imgH2 = imgElem.clientHeight;
322
+ var imgScl = (imgW2 / imgW).toFixed(2) == "0.00" ? "Hidden" : (imgW2 / imgW).toFixed(2);
323
+ var imgFSize2 = Math.floor(imgFSize / 1024);
324
+ var imgBPP = (imgFSize / (imgW * imgH)).toFixed(2);
325
+ var cssColor = "green";
326
+ var bppColor = "green";
327
+ var scaleColor = "green";
328
+ var bppError = "";
329
+ var scaleError = "";
330
+ if (imgBPP > 0.5) {
331
+ cssColor = "red";
332
+ bppColor = "red";
333
+ bppError = "The image has a VERY large \'Bytes per pixel\' score, trying optimising the image using https://tinypng.com/.";
334
+ }
335
+ else if (imgBPP > 0.2) {
336
+ cssColor = "orange";
337
+ bppColor = "orange";
338
+ bppError = "The image has a large \'Bytes per pixel\' score, trying optimising the image using https://tinypng.com/.";
339
+ }
340
+ if (imgScl > 1.2) {
341
+ cssColor = "red";
342
+ scaleColor = "red";
343
+ scaleError = "The image size is smaller than the size shown on screen this may cause the image to appear blurry and low quality.";
344
+ }
345
+ else if (imgScl < 0.5) {
346
+ cssColor = "red";
347
+ scaleColor = "red";
348
+ scaleError = "The image size is VERY large compared to the size shown on screen, this means unnecessary kb's are being downloaded. Try resizing the image in photoshop or other image editing software.";
349
+ }
350
+ else if (imgScl < 0.8) {
351
+ cssColor = "orange";
352
+ scaleColor = "orange";
353
+ scaleError = "The image size is large compared to the size shown on screen, this means unnecessary kb's are being downloaded. Try resizing the image in photoshop or other image editing software.";
354
+ }
355
+ console.log("%c %c " + imgElem.src, 'background: url(' + imgElem.src + '); border: 3px solid ' + cssColor + '; line-height: 30px; width: 30px; background-size: cover;', 'background-color: transparent');
356
+ if (bppError != "") {
357
+ console.log('%c %c' + bppError, 'background-color: ' + bppColor + '; margin-right: 10px', 'background-color: transparent');
358
+ }
359
+ if (scaleError != "") {
360
+ console.log('%c %c' + scaleError, 'background-color: ' + scaleColor + '; margin-right: 10px', 'background-color: transparent');
361
+ }
362
+ console.table({
363
+ Image: { "Dimensions": imgW + "x" + imgH, "Scaled to": imgW2 + "x" + imgH2, "Scale": imgScl, "Filesize": imgFSize2 + "Kb", "Bytes per pixel": imgBPP }
364
+ });
365
+ console.groupEnd();
366
+ }
367
+ }
368
+ else {
369
+ console.log('%c %c' + imgElem.src + ' not loaded', 'background-color: red; margin-right: 10px', 'background-color: transparent');
370
+ }
371
+ }
372
+ };
373
+ xhr.send(null);
374
+ }
375
+ });
376
+ // Add to dom here
377
+ let integrationTestsArr = [];
378
+ if (typeof window.integrationTests != "undefined") {
379
+ window.integrationTests.forEach(function (entry) {
380
+ if (entry['Total'] != 0 && entry['Type'] != "warning") {
381
+ integrationTestsArr.push(entry['Test']);
382
+ }
383
+ });
384
+ }
385
+ if (integrationTestsArr.length != 0) {
386
+ let displayComp = document.querySelector('#vmtests-display');
387
+ if (displayComp != null) {
388
+ displayComp.innerHTML = `<div class="container">
389
+ <h2>Integration notes</h2>
390
+ <ul id="integrationTests"></ul>
391
+ </div>`;
392
+ let integrationTests = document.getElementById('integrationTests');
393
+ if (integrationTests != null) {
394
+ integrationTestsArr.forEach(function (test) {
395
+ integrationTests.innerHTML += '<li>' + test + '</li>';
396
+ });
397
+ }
398
+ }
399
+ }
400
+ return null;
401
+ };
402
+ export default integrationTests;
@@ -147,8 +147,16 @@ export const setupBasicTable = (component, table, form, pagination) => {
147
147
  getLargestLastColWidth(component, table);
148
148
  getRowHeight(component, table);
149
149
  }
150
+ highlightRows(component);
150
151
  };
151
152
  // #region Basic table fnctions
153
+ export const highlightRows = (component) => {
154
+ Array.from(component.querySelectorAll('tr[data-highlight]')).forEach((row) => {
155
+ row.insertAdjacentHTML('afterend', `<tr role="presentation" class="tr--highlight">
156
+ <td colspan="100%"><i class="fa-solid fa-star"></i> ${row.getAttribute('data-highlight')}</td>
157
+ </tr>`);
158
+ });
159
+ };
152
160
  export const transferAttributes = (component, pagination) => {
153
161
  if (component.hasAttribute('data-total'))
154
162
  pagination.setAttribute('data-total', component.getAttribute('data-total'));
@@ -254,13 +262,21 @@ export const createMobileButton = (component, table) => {
254
262
  });
255
263
  Array.from(table.querySelectorAll('tbody tr')).forEach((row, index) => {
256
264
  const preExpanded = row.getAttribute('data-view') === 'full' ? 'aria-expanded' : '';
257
- row.insertAdjacentHTML('afterbegin', `<td class="${component.hasAttribute('data-expandable') ? 'td--fixed ' : ''}td--expand"><button class="btn btn-compact btn-secondary btn-sm" data-expand-button ${preExpanded} data-index="${index}">Expand</button></td>`);
265
+ row.insertAdjacentHTML('afterbegin', `<td class="${component.hasAttribute('data-expandable') ? 'td--fixed ' : ''}td--expand"><button class="btn btn-compact btn-secondary btn-sm fa-circle-plus" data-expand-button ${preExpanded} data-index="${index}">Expand</button></td>`);
258
266
  });
259
267
  table.addEventListener('click', (event) => {
260
268
  if (event && event.target instanceof HTMLElement && event.target.closest('[data-expand-button]')) {
261
269
  const button = event.target.closest('[data-expand-button]');
262
270
  const tableRow = button.closest('tr');
263
271
  button.toggleAttribute('aria-expanded');
272
+ if (button.classList.contains('fa-circle-plus')) {
273
+ button.classList.remove('fa-circle-plus');
274
+ button.classList.add('fa-circle-minus');
275
+ }
276
+ else {
277
+ button.classList.remove('fa-circle-minus');
278
+ button.classList.add('fa-circle-plus');
279
+ }
264
280
  if (tableRow.getAttribute('data-view') == 'full')
265
281
  tableRow.setAttribute('data-view', 'default');
266
282
  else
@@ -1,5 +1,8 @@
1
1
  /*!
2
- * iamKey v7.6.4--beta6
2
+ * iamKey v7.6.4--beta7
3
3
  * Copyright 2022-2026 iamproperty
4
- */(function(d){typeof define=="function"&&define.amd?define(d):d()})((function(){"use strict";var d=a=>{a.classList.add("js-enabled"),(navigator.userAgent.indexOf("MSIE")!==-1||navigator.appVersion.indexOf("Trident/")>0)&&a.classList.add("ie")},g=a=>{var t=function(c){var r=document.querySelector('label[for="'.concat(c.replace("#",""),'"]')),o=document.querySelector(c+" summary"),i=document.querySelector("dialog".concat(c)),n=document.querySelector("detail".concat(c));r instanceof HTMLElement?r.click():o instanceof HTMLElement?o.click():i instanceof HTMLElement?i.showModal():n instanceof HTMLElement&&n.addAttribute("open")};location.hash&&t(location.hash),window.addEventListener("hashchange",function(){t(location.hash)},!1),addEventListener("popstate",e=>{if(e&&e.state&&e.state.type&&e.state.type=="pagination"){var c=document.querySelector("#".concat(e.state.form)),r=document.querySelector("#".concat(e.state.form," [data-pagination]"));r?r.value=e.state.page:c.innerHTML+='<input name="page" type="hidden" data-pagination="true" value="'.concat(e.state.page,'" />'),c.dispatchEvent(new Event("submit"))}}),Array.from(document.querySelectorAll("form")).forEach(e=>{e?.closest("iam-form")||e.addEventListener("submit",c=>{var r;e.querySelector(":invalid")&&(e.classList.add("was-validated"),(r=e?.querySelector("input:invalid"))===null||r===void 0||r.scrollIntoView(),c.preventDefault())})}),document.addEventListener("click",e=>{var c;if(e&&e.target instanceof HTMLElement&&e.target.matches("form button:not([type=button])")){var r=e.target.closest("form");r?.closest("iam-form")||(Array.from(r.querySelectorAll("[data-password-type]")).forEach(o=>{o.setAttribute("type","password")}),(r.querySelector(":invalid")||r.querySelector('.pwd-checker[data-strength="1"]')||r.querySelector('.pwd-checker[data-strength="2"]'))&&(r.classList.add("was-validated"),(c=r?.querySelector("input:invalid"))===null||c===void 0||c.scrollIntoView(),e.preventDefault()),r.querySelector("iam-multiselect[data-is-required][data-error]")&&(r.classList.add("was-validated"),e.preventDefault()))}}),document.addEventListener("keydown",e=>{e.key==="Escape"&&document.querySelector(".dialog--transactional[open], .dialog--acknowledgement[open]")&&(e.preventDefault(),e.stopPropagation())}),Array.from(document.querySelectorAll("label progress")).forEach(e=>{var c=e.closest("label");c.setAttribute("data-percent",e.getAttribute("value"))})};function m(){window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"Pageview",pageTitle:document.title}),document.addEventListener("click",a=>{var t=a.target.closest("[open] summary");if(t)window.dataLayer.push({event:"closeDetails",detailsTitle:t.textContent||""});else{var e=a.target.closest("summary"),c=a.target.closest("a"),r=a.target.closest("button");e&&window.dataLayer.push({event:"openDetails",detailsTitle:e.textContent||""}),c&&window.dataLayer.push({event:"linkClicked",linkText:c.hasAttribute("title")?c.getAttribute("title")||"":c.textContent||"",class:c.hasAttribute("class")&&c.getAttribute("class")||"",href:c.getAttribute("href")||""}),r&&window.dataLayer.push({event:"buttonClicked",buttonText:r.textContent||"",class:r.hasAttribute("class")&&r.getAttribute("class")||""})}})}window.triggerDynamicEvent=function(a){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"change";console.log("event"),a.hasAttribute("data-change-events")&&t=="change"&&l(a,a.getAttribute("data-change-events")),a.hasAttribute("data-click-events")&&t=="click"&&l(a,a.getAttribute("data-click-events"))};var p=()=>{document.addEventListener("change",a=>{a&&a.target instanceof HTMLElement&&a.target.closest("[data-change-events]")&&l(a.target,a.target.closest("[data-change-events]").getAttribute("data-change-events"))}),document.addEventListener("keyup",a=>{a&&a.target instanceof HTMLElement&&a.target.closest("[data-change-events]")&&l(a.target,a.target.closest("[data-change-events]").getAttribute("data-change-events"))}),document.addEventListener("click",a=>{a&&a.target instanceof HTMLElement&&a.target.closest("[data-click-events]")&&l(a.target,a.target.closest("[data-click-events]").getAttribute("data-click-events"))})},l=(a,t)=>{if(t||(t=a.parentNode.getAttribute("data-change-events")),!t)return!1;Array.from(JSON.parse(t)).forEach(e=>{v(a,e)})},v=(a,t)=>{if("matches"in t)return t.matches=="any"||a.value==t.matches?u(a,t,"if"):u(a,t,"else"),!1;if("in-list"in t){var e=document.querySelector("".concat(t["in-list"],' option[value="').concat(a.value,'"]'));return document.querySelector("".concat(t["in-list"],' option[value="').concat(a.value,'"]'))?u(e,t,"if"):u(e,t,"else"),!1}else"event"in t&&u(a,t,"event")},u=(a,t,e)=>{if(!(e in t))return!1;switch(t[e]){case"hide":if(document.querySelector(t.target)){var c=document.querySelector(t.target);c.classList.add("js-hide"),Array.from(c.querySelectorAll("[data-required]")).forEach(n=>{n.removeAttribute("required")})}break;case"show":if(document.querySelector(t.target)){var r=document.querySelector(t.target);r.classList.remove("js-hide"),Array.from(r.querySelectorAll("[data-required]")).forEach(n=>{n.closest(".js-hide")||n.setAttribute("required","true")})}break;case"populate-form":h(a,t);break;case"dispatchEvent":var o=new Event(t.value);document.querySelector("".concat(t.target)).dispatchEvent(o);break;case"setAttribute":Array.from(document.querySelectorAll("".concat(t.target))).forEach(function(n){n.setAttribute(t.attribute,t.value)});break;case"focus":document.querySelector("".concat(t.target)).focus();break;case"removeAttribute":Array.from(document.querySelectorAll("".concat(t.target))).forEach(function(n){n.removeAttribute(t.attribute)});break;case"updateValue":document.querySelector("".concat(t.target)).value=t.value?t.value:"";var i=new Event("change");document.querySelector("".concat(t.target)).dispatchEvent(i);break;case"submitForm":document.querySelector("".concat(t.target)).submit();break;case"openLink":document.querySelector("".concat(t.target)).value&&(window.location.href=document.querySelector("".concat(t.target)).value);break}},h=function(t,e){var c=JSON.parse(t.getAttribute("data-values")),r=document.querySelector(e.target);if(!c)return!1;Object.keys(c).forEach(o=>{document.getElementById(o)&&document.getElementById(o).tagName=="SPAN"&&(document.getElementById(o).innerHTML=c[o]),r.querySelector('select[name="'.concat(o,'"] [value="').concat(c[o],'"]'))?(r.querySelector('select[name="'.concat(o,'"]')).value=c[o],t.hasAttribute("data-lock-fields")&&(r.querySelector('select[name="'.concat(o,'"]')).disabled=!0)):r.querySelector('input[name="'.concat(o,'"][type="radio"][value="').concat(c[o],'"]'))?(Array.from(r.querySelectorAll('input[name="'.concat(o,'"][type="radio"]'))).forEach(function(i){i.disabled=!0}),r.querySelector('input[name="'.concat(o,'"][type="radio"][value="').concat(c[o],'"]')).checked=!0,r.querySelector('input[name="'.concat(o,'"][type="radio"][value="').concat(c[o],'"]')).disabled=!1):r.querySelector('input[name="'.concat(o,'"]'))&&(r.querySelector('input[name="'.concat(o,'"]')).value=c[o],t.hasAttribute("data-lock-fields")&&r.querySelector('input[name="'.concat(o,'"]')).setAttribute("readonly","true"))})},b=function(a,t,e,c){function r(o){return o instanceof e?o:new e(function(i){i(o)})}return new(e||(e=Promise))(function(o,i){function n(s){try{f(c.next(s))}catch(y){i(y)}}function q(s){try{f(c.throw(s))}catch(y){i(y)}}function f(s){s.done?o(s.value):r(s.value).then(n,q)}f((c=c.apply(a,t||[])).next())})};document.addEventListener("DOMContentLoaded",()=>b(void 0,void 0,void 0,function*(){m(),p(),d(document.body),g()}))}));
4
+ */(function(w){typeof define=="function"&&define.amd?define(w):w()})((function(){"use strict";var w=a=>{a.classList.add("js-enabled"),(navigator.userAgent.indexOf("MSIE")!==-1||navigator.appVersion.indexOf("Trident/")>0)&&a.classList.add("ie")},H=a=>{var e=function(n){var r=document.querySelector('label[for="'.concat(n.replace("#",""),'"]')),s=document.querySelector(n+" summary"),u=document.querySelector("dialog".concat(n)),i=document.querySelector("detail".concat(n));r instanceof HTMLElement?r.click():s instanceof HTMLElement?s.click():u instanceof HTMLElement?u.showModal():i instanceof HTMLElement&&i.addAttribute("open")};location.hash&&e(location.hash),window.addEventListener("hashchange",function(){e(location.hash)},!1),addEventListener("popstate",o=>{if(o&&o.state&&o.state.type&&o.state.type=="pagination"){var n=document.querySelector("#".concat(o.state.form)),r=document.querySelector("#".concat(o.state.form," [data-pagination]"));r?r.value=o.state.page:n.innerHTML+='<input name="page" type="hidden" data-pagination="true" value="'.concat(o.state.page,'" />'),n.dispatchEvent(new Event("submit"))}}),Array.from(document.querySelectorAll("form")).forEach(o=>{o?.closest("iam-form")||o.addEventListener("submit",n=>{var r;o.querySelector(":invalid")&&(o.classList.add("was-validated"),(r=o?.querySelector("input:invalid"))===null||r===void 0||r.scrollIntoView(),n.preventDefault())})}),document.addEventListener("click",o=>{var n;if(o&&o.target instanceof HTMLElement&&o.target.matches("form button:not([type=button])")){var r=o.target.closest("form");r?.closest("iam-form")||(Array.from(r.querySelectorAll("[data-password-type]")).forEach(s=>{s.setAttribute("type","password")}),(r.querySelector(":invalid")||r.querySelector('.pwd-checker[data-strength="1"]')||r.querySelector('.pwd-checker[data-strength="2"]'))&&(r.classList.add("was-validated"),(n=r?.querySelector("input:invalid"))===null||n===void 0||n.scrollIntoView(),o.preventDefault()),r.querySelector("iam-multiselect[data-is-required][data-error]")&&(r.classList.add("was-validated"),o.preventDefault()))}}),document.addEventListener("keydown",o=>{o.key==="Escape"&&document.querySelector(".dialog--transactional[open], .dialog--acknowledgement[open]")&&(o.preventDefault(),o.stopPropagation())}),Array.from(document.querySelectorAll("label progress")).forEach(o=>{var n=o.closest("label");n.setAttribute("data-percent",o.getAttribute("value"))})};function N(){window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"Pageview",pageTitle:document.title}),document.addEventListener("click",a=>{var e=a.target.closest("[open] summary");if(e)window.dataLayer.push({event:"closeDetails",detailsTitle:e.textContent||""});else{var o=a.target.closest("summary"),n=a.target.closest("a"),r=a.target.closest("button");o&&window.dataLayer.push({event:"openDetails",detailsTitle:o.textContent||""}),n&&window.dataLayer.push({event:"linkClicked",linkText:n.hasAttribute("title")?n.getAttribute("title")||"":n.textContent||"",class:n.hasAttribute("class")&&n.getAttribute("class")||"",href:n.getAttribute("href")||""}),r&&window.dataLayer.push({event:"buttonClicked",buttonText:r.textContent||"",class:r.hasAttribute("class")&&r.getAttribute("class")||""})}})}window.triggerDynamicEvent=function(a){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"change";console.log("event"),a.hasAttribute("data-change-events")&&e=="change"&&v(a,a.getAttribute("data-change-events")),a.hasAttribute("data-click-events")&&e=="click"&&v(a,a.getAttribute("data-click-events"))};var M=()=>{document.addEventListener("change",a=>{a&&a.target instanceof HTMLElement&&a.target.closest("[data-change-events]")&&v(a.target,a.target.closest("[data-change-events]").getAttribute("data-change-events"))}),document.addEventListener("keyup",a=>{a&&a.target instanceof HTMLElement&&a.target.closest("[data-change-events]")&&v(a.target,a.target.closest("[data-change-events]").getAttribute("data-change-events"))}),document.addEventListener("click",a=>{a&&a.target instanceof HTMLElement&&a.target.closest("[data-click-events]")&&v(a.target,a.target.closest("[data-click-events]").getAttribute("data-click-events"))})},v=(a,e)=>{if(e||(e=a.parentNode.getAttribute("data-change-events")),!e)return!1;Array.from(JSON.parse(e)).forEach(o=>{C(a,o)})},C=(a,e)=>{if("matches"in e)return e.matches=="any"||a.value==e.matches?f(a,e,"if"):f(a,e,"else"),!1;if("in-list"in e){var o=document.querySelector("".concat(e["in-list"],' option[value="').concat(a.value,'"]'));return document.querySelector("".concat(e["in-list"],' option[value="').concat(a.value,'"]'))?f(o,e,"if"):f(o,e,"else"),!1}else"event"in e&&f(a,e,"event")},f=(a,e,o)=>{if(!(o in e))return!1;switch(e[o]){case"hide":if(document.querySelector(e.target)){var n=document.querySelector(e.target);n.classList.add("js-hide"),Array.from(n.querySelectorAll("[data-required]")).forEach(i=>{i.removeAttribute("required")})}break;case"show":if(document.querySelector(e.target)){var r=document.querySelector(e.target);r.classList.remove("js-hide"),Array.from(r.querySelectorAll("[data-required]")).forEach(i=>{i.closest(".js-hide")||i.setAttribute("required","true")})}break;case"populate-form":D(a,e);break;case"dispatchEvent":var s=new Event(e.value);document.querySelector("".concat(e.target)).dispatchEvent(s);break;case"setAttribute":Array.from(document.querySelectorAll("".concat(e.target))).forEach(function(i){i.setAttribute(e.attribute,e.value)});break;case"focus":document.querySelector("".concat(e.target)).focus();break;case"removeAttribute":Array.from(document.querySelectorAll("".concat(e.target))).forEach(function(i){i.removeAttribute(e.attribute)});break;case"updateValue":document.querySelector("".concat(e.target)).value=e.value?e.value:"";var u=new Event("change");document.querySelector("".concat(e.target)).dispatchEvent(u);break;case"submitForm":document.querySelector("".concat(e.target)).submit();break;case"openLink":document.querySelector("".concat(e.target)).value&&(window.location.href=document.querySelector("".concat(e.target)).value);break}},D=function(e,o){var n=JSON.parse(e.getAttribute("data-values")),r=document.querySelector(o.target);if(!n)return!1;Object.keys(n).forEach(s=>{document.getElementById(s)&&document.getElementById(s).tagName=="SPAN"&&(document.getElementById(s).innerHTML=n[s]),r.querySelector('select[name="'.concat(s,'"] [value="').concat(n[s],'"]'))?(r.querySelector('select[name="'.concat(s,'"]')).value=n[s],e.hasAttribute("data-lock-fields")&&(r.querySelector('select[name="'.concat(s,'"]')).disabled=!0)):r.querySelector('input[name="'.concat(s,'"][type="radio"][value="').concat(n[s],'"]'))?(Array.from(r.querySelectorAll('input[name="'.concat(s,'"][type="radio"]'))).forEach(function(u){u.disabled=!0}),r.querySelector('input[name="'.concat(s,'"][type="radio"][value="').concat(n[s],'"]')).checked=!0,r.querySelector('input[name="'.concat(s,'"][type="radio"][value="').concat(n[s],'"]')).disabled=!1):r.querySelector('input[name="'.concat(s,'"]'))&&(r.querySelector('input[name="'.concat(s,'"]')).value=n[s],e.hasAttribute("data-lock-fields")&&r.querySelector('input[name="'.concat(s,'"]')).setAttribute("readonly","true"))})},F=()=>{var a=[],e={},o="These tests run against mark-up and content meant to test how a component or element has been integrated. Making sure that guidance setout in the design system is being followed.";window.integrationTestsIntro=o,console.log("%cVirgin Money Framework Tests","color: #E10A0A; font-size: 24px; font-weight: bold; margin-top: 20px; margin-bottom: 10px;"),console.log("%c"+o,"font-size: 14px; margin-bottom: 20px;"),console.log("%cKey","font-size: 16px;font-weight:bold;"),console.log("%c %cSuccessfully implemented","background-color: green; margin-right: 10px","background-color: transparent"),console.log("%c %cNOT implemented correctly","background-color: red; margin-right: 10px","background-color: transparent"),console.log("%c %cN/A","background-color: grey; margin-right: 10px","background-color: transparent"),console.log("%c %cWarning - No action needed","background-color: orange; margin-right: 10px","background-color: transparent"),console.log("%c ? %cWarning - Action needed","background-color: orange; margin-right: 10px","background-color: transparent"),e={Test:"Each card with in a card deck has a footer with some CTA text via a button link",Total:0,Passes:0,Fails:0},Array.from(document.querySelectorAll(".card-deck .card")).forEach((t,c)=>{if(t.closest(".navbar")==null){var l=t.querySelector(".btn-link");l!=null&&l.textContent.length?e.Passes++:e.Fails++}}),e.Total=e.Passes+e.Fails,a.push(e),e={Test:"Article Decks need to have a background colour applied",Total:0,Passes:0,Fails:0},Array.from(document.querySelectorAll(".article-deck")).forEach((t,c)=>{var l=t.closest(".container");l!=null&&l.matches('[class*="bg-"]')?e.Passes++:e.Fails++}),e.Total=e.Passes+e.Fails,a.push(e),e={Test:"Tabs Carousel has a h2 title with a display-4 class. It should always have a strapline next to it also.",Total:0,Passes:0,Fails:0,Notes:"The site nav contains cards without a footer by design."},Array.from(document.querySelectorAll(".tabs__container--carousel")).forEach((t,c)=>{var l=t.querySelector("h2.display-4:first-child"),d=t.querySelector("h2.display-4:first-child + .strapline");l!=null&&d!=null?e.Passes++:e.Fails++}),e.Total=e.Passes+e.Fails,a.push(e),e={Test:"Split Containers can only have multiple of two columns. So either 2, 4, 6 and so on.",Total:0,Passes:0,Fails:0,Notes:""},Array.from(document.querySelectorAll(".container.container--split")).forEach((t,c)=>{t.querySelectorAll(':scope > .row > [class*="col"]').length%2===0?e.Passes++:e.Fails++}),e.Total=e.Passes+e.Fails,a.push(e),e={Test:"Statement Containers with only one paragraph or text element should have the class of .h6",Total:0,Passes:0,Fails:0,Notes:""},Array.from(document.querySelectorAll(".container.container--statement")).forEach((t,c)=>{t.querySelectorAll(":scope > *").length==1&&t.querySelectorAll(":scope > .h6:first-child").length==1?e.Passes++:t.querySelectorAll(":scope > *").length==1&&e.Fails++}),e.Total=e.Passes+e.Fails,a.push(e),e={Test:"CTA Containers title should always have the class of .h1",Total:0,Passes:0,Fails:0,Notes:""},Array.from(document.querySelectorAll(".container.container--cta")).forEach((t,c)=>{t.querySelectorAll("h2.h1:first-child").length==1?e.Passes++:e.Fails++}),e.Total=e.Passes+e.Fails,a.push(e),console.log("%cImplementation Tests","font-size: 16px;font-weight:bold; margin-top: 20px;"),a.forEach(function(t){var c="green";t.Total===0?c="grey":t.Fails!=0&&(c="red"),t.Type=="warning"&&(c="orange"),console.groupCollapsed("%c %c"+t.Test,"background-color: "+c+"; margin-right: 10px","background-color: transparent"),console.table({Passed:{value:t.Passes},Failed:{value:t.Fails},Total:{value:t.Total}}),t.Notes!=""&&console.log(t.Notes),console.groupEnd()}),window.integrationTests=a;var n=[];e={Test:"There are XX padding classes being used on this page",Type:"warning",Total:0,Passes:0,Fails:0,Notes:""},Array.from(document.querySelectorAll('[class*="p-"],[class*="pt-"],[class*="pb-"],[class*="pl-"],[class*="pr-"],[class*="px-"],[class*="py-"]')).forEach((t,c)=>{e.Total++}),e.Test=e.Test.replace("XX",e.Total),n.push(e),e={Test:"There are XX margin classes being used on this page",Type:"warning",Total:0,Passes:0,Fails:0,Notes:""},Array.from(document.querySelectorAll('[class*="m-"],[class*="mt-"],[class*="mb-"],[class*="ml-"],[class*="mr-"],[class*="mx-"],[class*="my-"]')).forEach((t,c)=>{e.Total++}),e.Test=e.Test.replace("XX",e.Total),n.push(e),e={Test:"There are XX text modifier classes being used on this page",Type:"warning",Total:0,Passes:0,Fails:0,Notes:""},Array.from(document.querySelectorAll('[class*="text-"]')).forEach((t,c)=>{e.Total++}),e.Test=e.Test.replace("XX",e.Total),n.push(e),console.log("%cUtility classes","font-size: 16px;font-weight:bold;"),console.log("The use of certain utility classes is necessary at times but the over use of these classes will lead to design/layout inconsistencies."),n.forEach(function(t){var c="green";t.Total===0?c="grey":t.Fails!=0&&(c="red"),t.Type=="warning"&&(c="orange"),console.groupCollapsed("%c %c"+t.Test,"background-color: "+c+"; margin-right: 10px","background-color: transparent"),console.table({Total:{value:t.Total}}),t.Notes!=""&&console.log(t.Notes),console.groupEnd()}),console.log("%cAccessibility and Best practice Tests","font-size: 16px;font-weight:bold;");var r="green",s=1,u={};Array.from(document.querySelectorAll("h1,h2,h3,h4,h5,h6")).forEach((t,c)=>{var l=1,d=t.textContent;t.matches("h2")?l=2:t.matches("h3")?l=3:t.matches("h4")?l=4:t.matches("h5")?l=5:t.matches("h6")&&(l=6);var h=l-s<=1;c==0&&l!=1&&(h=!1);var p={"Heading Level":l,"In order":h};h?s=l:r="red",u[d]=p}),console.groupCollapsed("%c %cHeadings are in the correct order","background-color: "+r+"; margin-right: 10px","background-color: transparent"),console.table(u),console.groupEnd(),console.groupCollapsed("%c ? %cDo all of the headings make sense out of context and do they introduce the content that follows?","background-color: orange; margin-right: 10px","background-color: transparent"),console.log("You should be able to read the below table and get an understanding of what the page content consists of. The titles should make sense when read in order and child titles should be relevant to the parent title."),console.table(u),console.groupEnd();var i={};Array.from(document.querySelectorAll("a")).forEach((t,c)=>{var l=t.getAttribute("href"),d=t.textContent,h=t.getAttribute("title"),p={Text:d,Title:h};i[l]=p}),console.groupCollapsed("%c ? %cDo all of the links make sense out of context and do they describe the page/section that it links to?","background-color: orange; margin-right: 10px","background-color: transparent"),console.table(i),console.groupEnd();var A={},m={};Array.from(document.querySelectorAll("img[alt]")).forEach((t,c)=>{var l=t.getAttribute("src"),d=t.getAttribute("alt");if(d!=""){var h={Alt:d};A[l]=h}else{var l=t.getAttribute("src"),p={};m[l]=p}}),console.groupCollapsed("%c ? %cDo all of the images with an alt tag make sense out of context and describes the image appropriately?","background-color: orange; margin-right: 10px","background-color: transparent"),console.table(A),console.log("%cImages with an empty alt tag:","font-weight: bold;"),console.table(m),console.groupEnd(),console.groupCollapsed("%c ? %cCan you navigation the page links by tabbing through the page?","background-color: orange; margin-right: 10px","background-color: transparent"),console.log("Are all of the links, input fields and buttons accessible through using the keyboard only?"),console.groupEnd(),console.log("%cLighthouse","font-size: 16px;font-weight:bold;"),console.groupCollapsed("%c ? %cHave you ran a lighthouse report on this page","background-color: orange; margin-right: 10px","background-color: transparent"),console.log("If you are in a modern version of chrome you can a lighthouse report by opening the lighthouse window within the devtools. This should appear as a tab link above."),console.log("This report will give you more detail about the above the tests aswell as extra tests. "),console.groupEnd(),console.log("%cImage sizes","font-size: 16px;font-weight:bold;"),console.log("The below tests work from the current screen size, so if you have your screen at a mobile viewport the scaling and sizes of images will reflect that. It is worth running the image tests in both mobile and desktop views. Simply change the screen size and refresh the page."),Array.from(document.querySelectorAll("img")).forEach((t,c)=>{if(!t.matches("[src*='http']")&&!t.matches("[src$='.svg']")){var l=t.getAttribute("src"),d=new XMLHttpRequest;d.open("HEAD",l,!0),d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200){var h=d.getResponseHeader("Content-Length");if(h>1024){var p=t.naturalWidth,P=t.naturalHeight,S=t.clientWidth,O=t.clientHeight,k=(S/p).toFixed(2)=="0.00"?"Hidden":(S/p).toFixed(2),B=Math.floor(h/1024),E=(h/(p*P)).toFixed(2),b="green",L="green",q="green",x="",T="";E>.5?(b="red",L="red",x="The image has a VERY large 'Bytes per pixel' score, trying optimising the image using https://tinypng.com/."):E>.2&&(b="orange",L="orange",x="The image has a large 'Bytes per pixel' score, trying optimising the image using https://tinypng.com/."),k>1.2?(b="red",q="red",T="The image size is smaller than the size shown on screen this may cause the image to appear blurry and low quality."):k<.5?(b="red",q="red",T="The image size is VERY large compared to the size shown on screen, this means unnecessary kb's are being downloaded. Try resizing the image in photoshop or other image editing software."):k<.8&&(b="orange",q="orange",T="The image size is large compared to the size shown on screen, this means unnecessary kb's are being downloaded. Try resizing the image in photoshop or other image editing software."),console.log("%c %c "+t.src,"background: url("+t.src+"); border: 3px solid "+b+"; line-height: 30px; width: 30px; background-size: cover;","background-color: transparent"),x!=""&&console.log("%c %c"+x,"background-color: "+L+"; margin-right: 10px","background-color: transparent"),T!=""&&console.log("%c %c"+T,"background-color: "+q+"; margin-right: 10px","background-color: transparent"),console.table({Image:{Dimensions:p+"x"+P,"Scaled to":S+"x"+O,Scale:k,Filesize:B+"Kb","Bytes per pixel":E}}),console.groupEnd()}}else console.log("%c %c"+t.src+" not loaded","background-color: red; margin-right: 10px","background-color: transparent")},d.send(null)}});var g=[];if(typeof window.integrationTests<"u"&&window.integrationTests.forEach(function(t){t.Total!=0&&t.Type!="warning"&&g.push(t.Test)}),g.length!=0){var y=document.querySelector("#vmtests-display");if(y!=null){y.innerHTML=`<div class="container">
5
+ <h2>Integration notes</h2>
6
+ <ul id="integrationTests"></ul>
7
+ </div>`;var z=document.getElementById("integrationTests");z!=null&&g.forEach(function(t){z.innerHTML+="<li>"+t+"</li>"})}}return null},I=Object.freeze({__proto__:null,default:F}),X=function(a,e,o,n){function r(s){return s instanceof o?s:new o(function(u){u(s)})}return new(o||(o=Promise))(function(s,u){function i(g){try{m(n.next(g))}catch(y){u(y)}}function A(g){try{m(n.throw(g))}catch(y){u(y)}}function m(g){g.done?s(g.value):r(g.value).then(i,A)}m((n=n.apply(a,e||[])).next())})},_=["localhost"];_.includes(window.location.hostname)&&Promise.resolve().then(function(){return I}).then(a=>{window.iamTest=()=>{F()}}).catch(a=>{console.log(a.message)}),document.addEventListener("DOMContentLoaded",()=>X(void 0,void 0,void 0,function*(){N(),M(),w(document.body),H()}))}));
5
8
  //# sourceMappingURL=scripts.bundle.js.map