@ons/design-system 62.2.4 → 64.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 (104) hide show
  1. package/components/access-code/example-access-code-error.njk +1 -1
  2. package/components/accordion/_macro.njk +1 -1
  3. package/components/breadcrumbs/_macro.njk +2 -2
  4. package/components/breadcrumbs/_macro.spec.js +1 -1
  5. package/components/button/_macro.njk +1 -1
  6. package/components/button/_macro.spec.js +6 -6
  7. package/components/card/_macro.njk +1 -1
  8. package/components/card/_macro.spec.js +1 -1
  9. package/components/char-check-limit/_macro.njk +1 -1
  10. package/components/char-check-limit/_macro.spec.js +1 -1
  11. package/components/char-check-limit/character-check.spec.js +16 -16
  12. package/components/checkboxes/_macro.njk +3 -1
  13. package/components/checkboxes/example-checkboxes-with-descriptions.njk +1 -0
  14. package/components/collapsible/_macro.spec.js +1 -1
  15. package/components/content-pagination/_macro.njk +2 -2
  16. package/components/content-pagination/_macro.spec.js +2 -2
  17. package/components/cookies-banner/_macro.njk +2 -2
  18. package/components/cookies-banner/_macro.spec.js +2 -2
  19. package/components/details/_macro.njk +1 -1
  20. package/components/details/_macro.spec.js +1 -1
  21. package/components/document-list/_macro.njk +1 -1
  22. package/components/footer/_macro.njk +2 -2
  23. package/components/footer/_macro.spec.js +7 -7
  24. package/components/header/_macro.njk +3 -3
  25. package/components/header/_macro.spec.js +5 -6
  26. package/components/{icons → icon}/_macro.spec.js +7 -7
  27. package/components/{images → image}/_macro.spec.js +13 -13
  28. package/components/{images/example-images-for-regular-screens.njk → image/example-image-for-regular-screens.njk} +1 -1
  29. package/components/{images/example-images-for-retina-screens.njk → image/example-image-for-retina-screens.njk} +1 -1
  30. package/components/input/_input.scss +6 -0
  31. package/components/input/_macro.njk +20 -13
  32. package/components/input/_macro.spec.js +2 -22
  33. package/components/{search/example-search-with-character-check.njk → input/example-input-search-with-character-check.njk} +1 -2
  34. package/components/{search/example-search-with-placeholder.njk → input/example-input-search-with-placeholder.njk} +1 -2
  35. package/components/{search/example-search.njk → input/example-input-search.njk} +1 -2
  36. package/components/{lists → list}/_macro.njk +3 -3
  37. package/components/{lists → list}/_macro.spec.js +42 -42
  38. package/components/message/_macro.njk +2 -2
  39. package/components/message/_macro.spec.js +0 -1
  40. package/components/metadata/_macro.njk +1 -1
  41. package/components/mutually-exclusive/mutually-exclusive.textarea.spec.js +1 -1
  42. package/components/navigation/_macro.njk +3 -3
  43. package/components/pagination/_macro.njk +65 -69
  44. package/components/pagination/_macro.spec.js +18 -16
  45. package/components/pagination/example-pagination-first.njk +5 -5
  46. package/components/pagination/example-pagination-last.njk +5 -5
  47. package/components/pagination/example-pagination-with-no-range-indicator.njk +11 -11
  48. package/components/pagination/example-pagination.njk +2 -2
  49. package/components/panel/_macro.njk +2 -2
  50. package/components/panel/_macro.spec.js +2 -2
  51. package/components/panel/example-panel-with-error-summary.njk +1 -1
  52. package/components/phase-banner/_phase-banner.scss +2 -1
  53. package/components/question/_macro.njk +1 -1
  54. package/components/question/_macro.spec.js +1 -1
  55. package/components/quote/_macro.njk +1 -1
  56. package/components/quote/_macro.spec.js +1 -1
  57. package/components/related-content/_macro.njk +1 -1
  58. package/components/related-content/_macro.spec.js +1 -1
  59. package/components/related-content/example-related-content-general.njk +1 -1
  60. package/components/relationships/example-relationships-error.njk +1 -1
  61. package/components/section-navigation/_macro.njk +2 -2
  62. package/components/select/_macro.njk +1 -2
  63. package/components/share-page/_macro.njk +1 -1
  64. package/components/share-page/_macro.spec.js +5 -5
  65. package/components/summary/_macro.njk +5 -6
  66. package/components/summary/_macro.spec.js +8 -23
  67. package/components/summary/example-summary-grouped-total.njk +0 -2
  68. package/components/summary/example-summary-grouped-with-errors.njk +0 -4
  69. package/components/summary/example-summary-grouped.njk +0 -19
  70. package/components/summary/example-summary-household.njk +0 -5
  71. package/components/summary/example-summary-hub.njk +0 -8
  72. package/components/summary/example-summary-multiple.njk +0 -4
  73. package/components/summary/example-summary.njk +0 -4
  74. package/components/table/_macro.njk +4 -4
  75. package/components/table/_macro.spec.js +17 -1
  76. package/components/table/example-table-basic.njk +1 -2
  77. package/components/table/example-table-numeric.njk +6 -3
  78. package/components/table-of-contents/_macro.njk +1 -1
  79. package/components/table-of-contents/_macro.spec.js +2 -2
  80. package/components/tabs/_macro.njk +6 -5
  81. package/components/tabs/_macro.spec.js +25 -2
  82. package/components/tabs/_tabs.scss +11 -15
  83. package/components/tabs/example-tabs.njk +6 -6
  84. package/components/tabs/tabs.js +24 -8
  85. package/components/tabs/tabs.spec.js +40 -2
  86. package/components/textarea/_macro.njk +2 -2
  87. package/components/textarea/_macro.spec.js +2 -2
  88. package/components/textarea/textarea.spec.js +6 -10
  89. package/components/timeline/_macro.njk +1 -1
  90. package/components/timeline/_macro.spec.js +1 -1
  91. package/css/main.css +3 -3
  92. package/css/print.css +1 -1
  93. package/package.json +1 -1
  94. package/scripts/main.es5.js +1 -1
  95. package/scripts/main.js +1 -1
  96. package/scss/main.scss +3 -4
  97. package/components/search/_macro.njk +0 -30
  98. package/components/search/_macro.spec.js +0 -69
  99. package/components/search/_search.scss +0 -9
  100. /package/components/{icons/_icons.scss → icon/_icon.scss} +0 -0
  101. /package/components/{icons → icon}/_macro.njk +0 -0
  102. /package/components/{images/_images.scss → image/_image.scss} +0 -0
  103. /package/components/{images → image}/_macro.njk +0 -0
  104. /package/components/{lists → list}/_list.scss +0 -0
@@ -16,16 +16,16 @@ const EXAMPLE_IMAGE_IMAGE_MINIMAL = {
16
16
  },
17
17
  };
18
18
 
19
- describe('macro: images', () => {
19
+ describe('macro: image', () => {
20
20
  it('outputs a `figure` element', () => {
21
- const $ = cheerio.load(renderComponent('images', EXAMPLE_IMAGE_URL_MINIMAL));
21
+ const $ = cheerio.load(renderComponent('image', EXAMPLE_IMAGE_URL_MINIMAL));
22
22
 
23
23
  expect($('.ons-figure')[0].tagName).toBe('figure');
24
24
  });
25
25
 
26
26
  it('outputs a `figurecaption` element when `caption` is provided', () => {
27
27
  const $ = cheerio.load(
28
- renderComponent('images', {
28
+ renderComponent('image', {
29
29
  ...EXAMPLE_IMAGE_URL_MINIMAL,
30
30
  caption: 'Example image caption',
31
31
  }),
@@ -36,7 +36,7 @@ describe('macro: images', () => {
36
36
 
37
37
  it('outputs a `figurecaption` element with provided `caption` text', () => {
38
38
  const $ = cheerio.load(
39
- renderComponent('images', {
39
+ renderComponent('image', {
40
40
  ...EXAMPLE_IMAGE_URL_MINIMAL,
41
41
  caption: 'Example image caption',
42
42
  }),
@@ -51,27 +51,27 @@ describe('macro: images', () => {
51
51
 
52
52
  describe('mode: url', () => {
53
53
  it('passes jest-axe checks', async () => {
54
- const $ = cheerio.load(renderComponent('images', EXAMPLE_IMAGE_URL_MINIMAL));
54
+ const $ = cheerio.load(renderComponent('image', EXAMPLE_IMAGE_URL_MINIMAL));
55
55
 
56
56
  const results = await axe($.html());
57
57
  expect(results).toHaveNoViolations();
58
58
  });
59
59
 
60
60
  it('outputs an `img` element', () => {
61
- const $ = cheerio.load(renderComponent('images', EXAMPLE_IMAGE_URL_MINIMAL));
61
+ const $ = cheerio.load(renderComponent('image', EXAMPLE_IMAGE_URL_MINIMAL));
62
62
 
63
63
  expect($('.ons-figure__image')[0].tagName).toBe('img');
64
64
  });
65
65
 
66
66
  it('outputs an `img` element with the expected `src`', () => {
67
- const $ = cheerio.load(renderComponent('images', EXAMPLE_IMAGE_URL_MINIMAL));
67
+ const $ = cheerio.load(renderComponent('image', EXAMPLE_IMAGE_URL_MINIMAL));
68
68
 
69
69
  expect($('.ons-figure__image').attr('src')).toBe('example.png');
70
70
  });
71
71
 
72
72
  it('outputs an `img` element with the expected alt text', () => {
73
73
  const $ = cheerio.load(
74
- renderComponent('images', {
74
+ renderComponent('image', {
75
75
  ...EXAMPLE_IMAGE_URL_MINIMAL,
76
76
  alt: 'Example alt text',
77
77
  }),
@@ -83,33 +83,33 @@ describe('macro: images', () => {
83
83
 
84
84
  describe('mode: image', () => {
85
85
  it('passes jest-axe checks', async () => {
86
- const $ = cheerio.load(renderComponent('images', EXAMPLE_IMAGE_IMAGE_MINIMAL));
86
+ const $ = cheerio.load(renderComponent('image', EXAMPLE_IMAGE_IMAGE_MINIMAL));
87
87
 
88
88
  const results = await axe($.html());
89
89
  expect(results).toHaveNoViolations();
90
90
  });
91
91
 
92
92
  it('outputs an `img` element', () => {
93
- const $ = cheerio.load(renderComponent('images', EXAMPLE_IMAGE_IMAGE_MINIMAL));
93
+ const $ = cheerio.load(renderComponent('image', EXAMPLE_IMAGE_IMAGE_MINIMAL));
94
94
 
95
95
  expect($('.ons-figure__image')[0].tagName).toBe('img');
96
96
  });
97
97
 
98
98
  it('outputs an `img` element with the expected `srcset`', () => {
99
- const $ = cheerio.load(renderComponent('images', EXAMPLE_IMAGE_IMAGE_MINIMAL));
99
+ const $ = cheerio.load(renderComponent('image', EXAMPLE_IMAGE_IMAGE_MINIMAL));
100
100
 
101
101
  expect($('.ons-figure__image').attr('srcset')).toBe('example-small.png 1x, example-large.png 2x');
102
102
  });
103
103
 
104
104
  it('outputs an `img` element with the expected `src`', () => {
105
- const $ = cheerio.load(renderComponent('images', EXAMPLE_IMAGE_IMAGE_MINIMAL));
105
+ const $ = cheerio.load(renderComponent('image', EXAMPLE_IMAGE_IMAGE_MINIMAL));
106
106
 
107
107
  expect($('.ons-figure__image').attr('src')).toBe('example-small.png');
108
108
  });
109
109
 
110
110
  it('outputs an `img` element with the expected alt text', () => {
111
111
  const $ = cheerio.load(
112
- renderComponent('images', {
112
+ renderComponent('image', {
113
113
  ...EXAMPLE_IMAGE_IMAGE_MINIMAL,
114
114
  alt: 'Example alt text',
115
115
  }),
@@ -1,4 +1,4 @@
1
- {% from "components/images/_macro.njk" import onsImage %}
1
+ {% from "components/image/_macro.njk" import onsImage %}
2
2
  {{
3
3
  onsImage({
4
4
  "url": '/img/small/woman-in-purple-dress-shirt.jpg',
@@ -1,4 +1,4 @@
1
- {% from "components/images/_macro.njk" import onsImage %}
1
+ {% from "components/image/_macro.njk" import onsImage %}
2
2
  {{
3
3
  onsImage({
4
4
  "image": {
@@ -137,6 +137,12 @@
137
137
  }
138
138
  }
139
139
 
140
+ .ons-input_search-button {
141
+ display: flex;
142
+ flex-flow: row nowrap !important;
143
+ gap: 0.5rem;
144
+ }
145
+
140
146
  .ons-input-search {
141
147
  @extend .ons-input--block;
142
148
  @extend .ons-input--ghost;
@@ -1,9 +1,9 @@
1
1
  {% macro onsInput(params) %}
2
2
  {% from "components/mutually-exclusive/_macro.njk" import onsMutuallyExclusive %}
3
3
  {% from "components/char-check-limit/_macro.njk" import onsCharLimit %}
4
- {% from "components/search/_macro.njk" import onsSearch %}
5
4
  {% from "components/field/_macro.njk" import onsField %}
6
5
  {% from "components/label/_macro.njk" import onsLabel %}
6
+ {% from "components/button/_macro.njk" import onsButton %}
7
7
 
8
8
  {% if params.type == "number" %}
9
9
  {# Type must be "text" or Firefox and Safari will set a blank value to the server if non numeric characters are entered -
@@ -40,7 +40,7 @@
40
40
  {% if inputmode %}inputmode="{{ inputmode }}"{% endif %}
41
41
  {% if params.autocomplete %}autocomplete="{{ params.autocomplete }}"{% endif %}
42
42
  {% if params.accessiblePlaceholder %}placeholder="{{ params.label.text }}"{% endif %}
43
- {% if params.charCheckLimit %}data-char-check-ref="{{ params.id }}-check-remaining" data-char-check-num="{{ params.charCheckLimit.limit }}" aria-describedby="{{ params.id }}-check-remaining"{% endif %}
43
+ {% if params.charCheckLimit %}data-char-check-ref="{{ params.id }}-check" data-char-check-num="{{ params.charCheckLimit.limit }}" aria-describedby="{{ params.id }}-check"{% endif %}
44
44
  {% if params.charCheckLimit and params.charCheckLimit.charcheckCountdown %}data-char-check-countdown="true"{% endif %}
45
45
  {% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %}{{ attribute }}{% if value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
46
46
  {% if params.label and params.label.description %}{% if params.label.id %}aria-describedby="{{ params.label.id }}-description-hint"{% else %}aria-describedby="description-hint"{% endif %}{% endif %}
@@ -100,21 +100,28 @@
100
100
  </span>
101
101
  {% endif %}
102
102
  {% elif params.searchButton %}
103
- <span class="ons-grid--flex ons-search">
104
- {% call onsSearch({
105
- "accessiblePlaceholder": params.accessiblePlaceholder,
106
- "searchButton": {
103
+ <span class="ons-grid--flex ons-input_search-button">
104
+ {{ input | safe }}
105
+ {%- set buttonLabel -%}
106
+ {%- if params.searchButton.visuallyHideButtonText == true -%}
107
+ <span class="ons-u-vh">{{ params.searchButton.text }}</span>
108
+ {%- else -%}
109
+ {{ params.searchButton.text }}
110
+ {%- endif -%}
111
+ {%- endset -%}
112
+ {{
113
+ onsButton({
107
114
  "type": params.searchButton.type,
115
+ "html": buttonLabel,
108
116
  "text": params.searchButton.text,
109
- "visuallyHideButtonText": params.searchButton.visuallyHideButtonText,
110
117
  "id": params.searchButton.id,
118
+ "variants": 'small',
119
+ "classes": 'ons-search__btn' + (" " + params.searchButton.classes if params.searchButton.classes else ""),
111
120
  "attributes": params.searchButton.attributes,
112
- "classes": params.searchButton.classes,
113
- "iconType": params.searchButton.iconType
114
- }
115
- }) %}
116
- {{ input | safe }}
117
- {% endcall %}
121
+ "iconType": params.searchButton.iconType,
122
+ "iconPosition": 'only' if params.searchButton.visuallyHideButtonText == true else 'before'
123
+ })
124
+ }}
118
125
  </span>
119
126
  {% else %}
120
127
  {{ input | safe }}
@@ -535,26 +535,6 @@ describe('macro: input', () => {
535
535
  });
536
536
 
537
537
  describe('search', () => {
538
- it('renders `search` component', () => {
539
- const faker = templateFaker();
540
- const searchSpy = faker.spy('search');
541
-
542
- faker.renderComponent('input', EXAMPLE_WITH_SEARCH);
543
-
544
- expect(searchSpy.occurrences[0]).toEqual({
545
- accessiblePlaceholder: true,
546
- searchButton: {
547
- type: 'button',
548
- text: 'Search for address',
549
- id: 'search-for-address',
550
- attributes: { a: 42 },
551
- classes: 'extra-search-button-class',
552
- iconType: 'search',
553
- visuallyHideButtonText: true,
554
- },
555
- });
556
- });
557
-
558
538
  it.each('outputs `type` attribute of "search"', () => {
559
539
  const $ = cheerio.load(renderComponent('input', EXAMPLE_WITH_SEARCH));
560
540
 
@@ -621,7 +601,7 @@ describe('macro: input', () => {
621
601
  it('has data attribute which references the character limit component', () => {
622
602
  const $ = cheerio.load(renderComponent('input', EXAMPLE_INPUT_WITH_CHARACTER_LIMIT));
623
603
 
624
- expect($('.ons-input').attr('data-char-check-ref')).toBe('example-id-check-remaining');
604
+ expect($('.ons-input').attr('data-char-check-ref')).toBe('example-id-check');
625
605
  });
626
606
 
627
607
  it('has data attribute which defines limit for character check', () => {
@@ -633,7 +613,7 @@ describe('macro: input', () => {
633
613
  it('has `aria-describedby` attribute which references the character limit component', () => {
634
614
  const $ = cheerio.load(renderComponent('input', EXAMPLE_INPUT_WITH_CHARACTER_LIMIT));
635
615
 
636
- expect($('.ons-input').attr('aria-describedby')).toBe('example-id-check-remaining');
616
+ expect($('.ons-input').attr('aria-describedby')).toBe('example-id-check');
637
617
  });
638
618
 
639
619
  it('renders character limit component', () => {
@@ -1,5 +1,4 @@
1
1
  {% from "components/input/_macro.njk" import onsInput %}
2
-
3
2
  {{
4
3
  onsInput({
5
4
  "id": 'search-field',
@@ -20,4 +19,4 @@
20
19
  "charCountOverLimitPlural": "{x} characters too many"
21
20
  }
22
21
  })
23
- }}
22
+ }}
@@ -1,5 +1,4 @@
1
1
  {% from "components/input/_macro.njk" import onsInput %}
2
-
3
2
  {{
4
3
  onsInput({
5
4
  "id": 'search-field',
@@ -13,4 +12,4 @@
13
12
  "iconType": 'search'
14
13
  }
15
14
  })
16
- }}
15
+ }}
@@ -1,5 +1,4 @@
1
1
  {% from "components/input/_macro.njk" import onsInput %}
2
-
3
2
  {{
4
3
  onsInput({
5
4
  "id": 'search-field',
@@ -13,4 +12,4 @@
13
12
  "iconType": 'search'
14
13
  }
15
14
  })
16
- }}
15
+ }}
@@ -21,7 +21,7 @@
21
21
  {% set listEl = 'ul' %}
22
22
  {% endif %}
23
23
  <{{listEl}} {% if params.id %}id="{{ params.id }}"{% endif %} class="ons-list{% if listEl == 'p' %} ons-list--p{% endif %}{% if params.classes %} {{ params.classes -}}{% endif %}{% if params.variants %}{% if params.variants is not string %}{% for variant in params.variants %} ons-list--{{ variant }}{% endfor %}{% else %} ons-list--{{ params.variants }}{% endif %}{% endif %}{% if otherClasses %} {{ otherClasses -}}{% endif %}"{% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %} {{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}>
24
- {%- for item in (params.itemsList if params.itemsList is iterable else params.itemsList.items()) -%}
24
+ {%- for item in params.itemsList -%}
25
25
  {% if listLength > 1 or listEl == 'ul' %}
26
26
  <li class="ons-list__item{% if item.listClasses %} {{ item.listClasses }}{% endif %}"{% if item.current %} aria-current="true"{% endif %}>
27
27
  {% endif %}
@@ -40,7 +40,7 @@
40
40
  {%- if item.prefix -%}
41
41
  {{- item.prefix -}}.
42
42
  {% elif params.iconPosition == 'before' %}
43
- {% from "components/icons/_macro.njk" import onsIcon %}
43
+ {% from "components/icon/_macro.njk" import onsIcon %}
44
44
  {{
45
45
  onsIcon({
46
46
  "iconType": itemIconType,
@@ -75,7 +75,7 @@
75
75
  {%- elif (item.index and listEl != 'ol') or (item.index and listEl == 'ol' and 'bare' in variants) -%}
76
76
  {{- loop.index -}}
77
77
  {% elif params.iconPosition == 'after' %}
78
- {% from "components/icons/_macro.njk" import onsIcon %}
78
+ {% from "components/icon/_macro.njk" import onsIcon %}
79
79
  {{
80
80
  onsIcon({
81
81
  "iconType": itemIconType,
@@ -22,11 +22,11 @@ const EXAMPLE_ITEM_NAVIGATION_TITLE = {
22
22
  navigationTitle: 'Nav friendly title',
23
23
  };
24
24
 
25
- describe('macro: lists', () => {
25
+ describe('macro: list', () => {
26
26
  describe('list element', () => {
27
27
  it('has `id` attribute when provided', () => {
28
28
  const $ = cheerio.load(
29
- renderComponent('lists', {
29
+ renderComponent('list', {
30
30
  ...EXAMPLE_LIST_TEXT_ITEMS,
31
31
  id: 'example-id',
32
32
  }),
@@ -37,7 +37,7 @@ describe('macro: lists', () => {
37
37
 
38
38
  it('has additionally provided style classes', () => {
39
39
  const $ = cheerio.load(
40
- renderComponent('lists', {
40
+ renderComponent('list', {
41
41
  ...EXAMPLE_LIST_TEXT_ITEMS,
42
42
  classes: 'extra-class another-extra-class',
43
43
  }),
@@ -49,7 +49,7 @@ describe('macro: lists', () => {
49
49
 
50
50
  it('has provided variant style class when one variant is provided', () => {
51
51
  const $ = cheerio.load(
52
- renderComponent('lists', {
52
+ renderComponent('list', {
53
53
  ...EXAMPLE_LIST_TEXT_ITEMS,
54
54
  variants: 'dashed',
55
55
  }),
@@ -60,7 +60,7 @@ describe('macro: lists', () => {
60
60
 
61
61
  it('has provided variant style classes when multiple variants are provided', () => {
62
62
  const $ = cheerio.load(
63
- renderComponent('lists', {
63
+ renderComponent('list', {
64
64
  ...EXAMPLE_LIST_TEXT_ITEMS,
65
65
  variants: ['dashed', 'inline'],
66
66
  }),
@@ -72,7 +72,7 @@ describe('macro: lists', () => {
72
72
 
73
73
  it('assumes the "bare" variant with a prefix modifier class when the first list item has a prefix', () => {
74
74
  const $ = cheerio.load(
75
- renderComponent('lists', {
75
+ renderComponent('list', {
76
76
  itemsList: [{ text: 'Item text', prefix: 'Abc' }],
77
77
  }),
78
78
  );
@@ -83,7 +83,7 @@ describe('macro: lists', () => {
83
83
 
84
84
  it('assumes the "bare" variant with a suffix modifier class when the first list item has a suffix', () => {
85
85
  const $ = cheerio.load(
86
- renderComponent('lists', {
86
+ renderComponent('list', {
87
87
  itemsList: [{ text: 'Item text', suffix: 'Abc' }],
88
88
  }),
89
89
  );
@@ -94,7 +94,7 @@ describe('macro: lists', () => {
94
94
 
95
95
  it('assumes the "bare" variant with a icons modifier class when the first list item has an icon', () => {
96
96
  const $ = cheerio.load(
97
- renderComponent('lists', {
97
+ renderComponent('list', {
98
98
  ...EXAMPLE_LIST_TEXT_ITEMS,
99
99
  iconPosition: 'before',
100
100
  iconType: 'check',
@@ -106,14 +106,14 @@ describe('macro: lists', () => {
106
106
  });
107
107
 
108
108
  it('renders a <ul> element by default', () => {
109
- const $ = cheerio.load(renderComponent('lists', EXAMPLE_LIST_TEXT_ITEMS));
109
+ const $ = cheerio.load(renderComponent('list', EXAMPLE_LIST_TEXT_ITEMS));
110
110
 
111
111
  expect($('.ons-list')[0].tagName).toBe('ul');
112
112
  });
113
113
 
114
114
  it('renders a custom element when a custom `element` is provided', () => {
115
115
  const $ = cheerio.load(
116
- renderComponent('lists', {
116
+ renderComponent('list', {
117
117
  ...EXAMPLE_LIST_TEXT_ITEMS,
118
118
  element: 'div',
119
119
  }),
@@ -124,7 +124,7 @@ describe('macro: lists', () => {
124
124
 
125
125
  it('renders a <ol> element when specified', () => {
126
126
  const $ = cheerio.load(
127
- renderComponent('lists', {
127
+ renderComponent('list', {
128
128
  ...EXAMPLE_LIST_TEXT_ITEMS,
129
129
  element: 'ol',
130
130
  }),
@@ -135,7 +135,7 @@ describe('macro: lists', () => {
135
135
 
136
136
  it('has the expected quantity of <li> elements when a <ol> element is specified', () => {
137
137
  const $ = cheerio.load(
138
- renderComponent('lists', {
138
+ renderComponent('list', {
139
139
  ...EXAMPLE_LIST_TEXT_ITEMS,
140
140
  element: 'ol',
141
141
  }),
@@ -146,7 +146,7 @@ describe('macro: lists', () => {
146
146
 
147
147
  describe('when <ol> is specified but there is only one list item', () => {
148
148
  const $ = cheerio.load(
149
- renderComponent('lists', {
149
+ renderComponent('list', {
150
150
  element: 'ol',
151
151
  itemsList: [{ text: 'Only item' }],
152
152
  }),
@@ -167,7 +167,7 @@ describe('macro: lists', () => {
167
167
 
168
168
  it('has additionally provided `attributes`', () => {
169
169
  const $ = cheerio.load(
170
- renderComponent('lists', {
170
+ renderComponent('list', {
171
171
  ...EXAMPLE_LIST_TEXT_ITEMS,
172
172
  attributes: {
173
173
  a: 123,
@@ -189,7 +189,7 @@ describe('macro: lists', () => {
189
189
  describe('content without link', () => {
190
190
  it('passes jest-axe checks', async () => {
191
191
  const $ = cheerio.load(
192
- renderComponent('lists', {
192
+ renderComponent('list', {
193
193
  itemsList: [item],
194
194
  }),
195
195
  );
@@ -200,7 +200,7 @@ describe('macro: lists', () => {
200
200
 
201
201
  it('renders the expected list item text', () => {
202
202
  const $ = cheerio.load(
203
- renderComponent('lists', {
203
+ renderComponent('list', {
204
204
  itemsList: [item],
205
205
  }),
206
206
  );
@@ -210,7 +210,7 @@ describe('macro: lists', () => {
210
210
 
211
211
  it('does not render a hyperlink element', () => {
212
212
  const $ = cheerio.load(
213
- renderComponent('lists', {
213
+ renderComponent('list', {
214
214
  itemsList: [item],
215
215
  }),
216
216
  );
@@ -222,7 +222,7 @@ describe('macro: lists', () => {
222
222
  describe('content with an internal link', () => {
223
223
  it('passes jest-axe checks', async () => {
224
224
  const $ = cheerio.load(
225
- renderComponent('lists', {
225
+ renderComponent('list', {
226
226
  itemsList: [
227
227
  {
228
228
  ...item,
@@ -238,7 +238,7 @@ describe('macro: lists', () => {
238
238
 
239
239
  it('renders a hyperlink element', () => {
240
240
  const $ = cheerio.load(
241
- renderComponent('lists', {
241
+ renderComponent('list', {
242
242
  itemsList: [
243
243
  {
244
244
  ...item,
@@ -254,7 +254,7 @@ describe('macro: lists', () => {
254
254
 
255
255
  it('does not render a hyperlink element for current item', () => {
256
256
  const $ = cheerio.load(
257
- renderComponent('lists', {
257
+ renderComponent('list', {
258
258
  itemsList: [
259
259
  {
260
260
  ...item,
@@ -270,7 +270,7 @@ describe('macro: lists', () => {
270
270
 
271
271
  it('supports the `inPageLink` variant', () => {
272
272
  const $ = cheerio.load(
273
- renderComponent('lists', {
273
+ renderComponent('list', {
274
274
  itemsList: [
275
275
  {
276
276
  ...item,
@@ -286,7 +286,7 @@ describe('macro: lists', () => {
286
286
 
287
287
  it('has additionally provided style classes', () => {
288
288
  const $ = cheerio.load(
289
- renderComponent('lists', {
289
+ renderComponent('list', {
290
290
  itemsList: [
291
291
  {
292
292
  ...item,
@@ -303,7 +303,7 @@ describe('macro: lists', () => {
303
303
 
304
304
  it('has the provided `target` attribute', () => {
305
305
  const $ = cheerio.load(
306
- renderComponent('lists', {
306
+ renderComponent('list', {
307
307
  itemsList: [
308
308
  {
309
309
  ...item,
@@ -319,7 +319,7 @@ describe('macro: lists', () => {
319
319
 
320
320
  it('renders visually hidden screen reader message when target is "_blank"', () => {
321
321
  const $ = cheerio.load(
322
- renderComponent('lists', {
322
+ renderComponent('list', {
323
323
  itemsList: [
324
324
  {
325
325
  ...item,
@@ -336,7 +336,7 @@ describe('macro: lists', () => {
336
336
 
337
337
  it('renders a default visually hidden screen reader message when target is "_blank"', () => {
338
338
  const $ = cheerio.load(
339
- renderComponent('lists', {
339
+ renderComponent('list', {
340
340
  itemsList: [
341
341
  {
342
342
  ...item,
@@ -352,7 +352,7 @@ describe('macro: lists', () => {
352
352
 
353
353
  it('has additionally provided `attributes`', () => {
354
354
  const $ = cheerio.load(
355
- renderComponent('lists', {
355
+ renderComponent('list', {
356
356
  itemsList: [
357
357
  {
358
358
  ...item,
@@ -372,7 +372,7 @@ describe('macro: lists', () => {
372
372
 
373
373
  it('renders visually hidden prefix', () => {
374
374
  const $ = cheerio.load(
375
- renderComponent('lists', {
375
+ renderComponent('list', {
376
376
  itemsList: [
377
377
  {
378
378
  ...item,
@@ -390,7 +390,7 @@ describe('macro: lists', () => {
390
390
  describe('content with an external link', () => {
391
391
  it('passes jest-axe checks', async () => {
392
392
  const $ = cheerio.load(
393
- renderComponent('lists', {
393
+ renderComponent('list', {
394
394
  itemsList: [
395
395
  {
396
396
  ...item,
@@ -409,7 +409,7 @@ describe('macro: lists', () => {
409
409
  const faker = templateFaker();
410
410
  const externalLinkSpy = faker.spy('external-link');
411
411
 
412
- faker.renderComponent('lists', {
412
+ faker.renderComponent('list', {
413
413
  itemsList: [
414
414
  {
415
415
  ...item,
@@ -429,7 +429,7 @@ describe('macro: lists', () => {
429
429
  const faker = templateFaker();
430
430
  const externalLinkSpy = faker.spy('external-link');
431
431
 
432
- faker.renderComponent('lists', {
432
+ faker.renderComponent('list', {
433
433
  itemsList: [
434
434
  {
435
435
  ...item,
@@ -448,7 +448,7 @@ describe('macro: lists', () => {
448
448
  describe('prefix', () => {
449
449
  it('renders item `prefix` content', () => {
450
450
  const $ = cheerio.load(
451
- renderComponent('lists', {
451
+ renderComponent('list', {
452
452
  itemsList: [
453
453
  {
454
454
  prefix: '[PREFIX]',
@@ -467,7 +467,7 @@ describe('macro: lists', () => {
467
467
 
468
468
  it('marks `prefix` content as visually hidden when list element is not <ol>', () => {
469
469
  const $ = cheerio.load(
470
- renderComponent('lists', {
470
+ renderComponent('list', {
471
471
  itemsList: [
472
472
  {
473
473
  prefix: '[PREFIX]',
@@ -482,7 +482,7 @@ describe('macro: lists', () => {
482
482
 
483
483
  it('does not mark `prefix` content as visually hidden when list element is <ol>', () => {
484
484
  const $ = cheerio.load(
485
- renderComponent('lists', {
485
+ renderComponent('list', {
486
486
  element: 'ol',
487
487
  itemsList: [
488
488
  {
@@ -504,7 +504,7 @@ describe('macro: lists', () => {
504
504
  describe('suffix', () => {
505
505
  it('renders item `suffix` content', () => {
506
506
  const $ = cheerio.load(
507
- renderComponent('lists', {
507
+ renderComponent('list', {
508
508
  itemsList: [
509
509
  {
510
510
  suffix: '[SUFFIX]',
@@ -523,7 +523,7 @@ describe('macro: lists', () => {
523
523
 
524
524
  it('marks `suffix` content as visually hidden when list element is not <ol>', () => {
525
525
  const $ = cheerio.load(
526
- renderComponent('lists', {
526
+ renderComponent('list', {
527
527
  itemsList: [
528
528
  {
529
529
  suffix: '[SUFFIX]',
@@ -538,7 +538,7 @@ describe('macro: lists', () => {
538
538
 
539
539
  it('does not mark `suffix` content as visually hidden when list element is <ol>', () => {
540
540
  const $ = cheerio.load(
541
- renderComponent('lists', {
541
+ renderComponent('list', {
542
542
  element: 'ol',
543
543
  itemsList: [
544
544
  {
@@ -560,9 +560,9 @@ describe('macro: lists', () => {
560
560
  describe('icons', () => {
561
561
  it.each([['before'], ['after']])('renders default icon on list items when icon is positioned %s', iconPosition => {
562
562
  const faker = templateFaker();
563
- const iconsSpy = faker.spy('icons');
563
+ const iconsSpy = faker.spy('icon');
564
564
 
565
- faker.renderComponent('lists', {
565
+ faker.renderComponent('list', {
566
566
  ...EXAMPLE_LIST_TEXT_ITEMS,
567
567
  iconPosition,
568
568
  iconType: 'check',
@@ -575,9 +575,9 @@ describe('macro: lists', () => {
575
575
 
576
576
  it.each([['before'], ['after']])('renders a custom icon on specific list items when icon is positioned %s', iconPosition => {
577
577
  const faker = templateFaker();
578
- const iconsSpy = faker.spy('icons');
578
+ const iconsSpy = faker.spy('icon');
579
579
 
580
- faker.renderComponent('lists', {
580
+ faker.renderComponent('list', {
581
581
  itemsList: [{ text: 'First item' }, { text: 'Second item', iconType: 'print' }, { text: 'Third item' }],
582
582
  iconPosition,
583
583
  iconType: 'check',
@@ -591,7 +591,7 @@ describe('macro: lists', () => {
591
591
 
592
592
  it('renders the icon before the item text', () => {
593
593
  const $ = cheerio.load(
594
- renderComponent('lists', {
594
+ renderComponent('list', {
595
595
  itemsList: [{ text: '<span id="first">First item</span>' }, { text: '<span id="second">Second item</span>' }],
596
596
  iconPosition: 'before',
597
597
  iconType: 'check',
@@ -604,7 +604,7 @@ describe('macro: lists', () => {
604
604
 
605
605
  it('renders the icon after the item text', () => {
606
606
  const $ = cheerio.load(
607
- renderComponent('lists', {
607
+ renderComponent('list', {
608
608
  itemsList: [{ text: '<span id="first">First item</span>' }, { text: '<span id="second">Second item</span>' }],
609
609
  iconPosition: 'after',
610
610
  iconType: 'check',
@@ -1,7 +1,7 @@
1
1
  {%- macro onsMessage(params) -%}
2
2
  <div class="ons-message ons-message--{{ params.type }}">
3
3
  <div class="ons-message__head">
4
- <dl class="ons-message__metadata" {% if params.id %} id="{{ params.id }}"{% endif %} {% if params.name %} name="{{ params.name }}"{% endif %}>
4
+ <dl class="ons-message__metadata" {% if params.id %} id="{{ params.id }}"{% endif %}>
5
5
  <div class="ons-message__sender">
6
6
  <dt class="ons-message__term ons-u-fw-b">{{ params.fromLabel }}:</dt>
7
7
  <dd class="ons-message__value ons-u-fw-b" {% if params.fromId %} id="{{ params.fromId }}"{% endif %} {% if params.fromName %} name="{{ params.fromName }}"{% endif %}>{{ params.fromValue }}</dd>
@@ -15,7 +15,7 @@
15
15
  <a class="ons-message__unread-link" {% if params.unreadLinkId %}id="{{ params.unreadLinkId }}"{% endif %} href="{{ params.unreadLink }}">{{ params.unreadLinkText }}</a>
16
16
  {% endif %}
17
17
  </div>
18
- <div class="ons-message__body" {% if params.messageID %} id="{{ params.messageID }}"{% endif %} {% if params.messageName %} name="{{ params.messageName }}"{% endif %}>
18
+ <div class="ons-message__body" {% if params.messageID %} id="{{ params.messageID }}"{% endif %}>
19
19
  {{ caller() }}
20
20
  </div>
21
21
  </div>