@ons/design-system 72.1.2 → 72.2.1

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 (31) hide show
  1. package/components/address-input/_macro.spec.js +0 -1
  2. package/components/address-input/autosuggest.address.spec.js +0 -1
  3. package/components/autosuggest/autosuggest.spec.js +0 -2
  4. package/components/button/_button.scss +3 -2
  5. package/components/char-check-limit/_macro.spec.js +50 -58
  6. package/components/description-list/_macro.njk +7 -1
  7. package/components/description-list/_macro.spec.js +4 -1
  8. package/components/description-list/example-inline-description-list.njk +2 -1
  9. package/components/document-list/_macro.spec.js +298 -347
  10. package/components/header/_macro.spec.js +0 -1
  11. package/components/header/example-header-external-with-navigation-and-search.njk +0 -1
  12. package/components/hero/_hero.scss +45 -4
  13. package/components/hero/_macro.njk +49 -10
  14. package/components/hero/_macro.spec.js +84 -1
  15. package/components/hero/example-hero-grey.njk +78 -0
  16. package/components/icon/_macro.njk +146 -0
  17. package/components/list/_list.scss +3 -0
  18. package/components/list/_macro.njk +12 -18
  19. package/components/list/_macro.spec.js +11 -7
  20. package/components/message-list/_macro.njk +10 -3
  21. package/components/message-list/_macro.spec.js +72 -14
  22. package/components/message-list/_message-list.scss +1 -1
  23. package/components/navigation/_macro.njk +0 -1
  24. package/components/navigation/_macro.spec.js +0 -1
  25. package/components/panel/_macro.njk +1 -1
  26. package/components/panel/_macro.spec.js +15 -1
  27. package/css/main.css +1 -1
  28. package/package.json +1 -1
  29. package/scss/base/_typography.scss +1 -1
  30. package/scss/helpers/_mq.scss +1 -1
  31. package/scss/vars/_colors.scss +1 -0
@@ -83,7 +83,6 @@ describe('FOR: Macro: Address-input', () => {
83
83
  ariaYouHaveSelected: '[params.ariaYouHaveSelected]',
84
84
  ariaMinChars: '[params.ariaMinChars]',
85
85
  minChars: '[params.minChars]',
86
- ariaResultsLabel: '[params.ariaResultsLabel]',
87
86
  ariaOneResult: '[params.ariaOneResult]',
88
87
  ariaNResults: '[params.ariaNResults]',
89
88
  ariaLimitedResults: '[params.ariaLimitedResults]',
@@ -15,7 +15,6 @@ const EXAMPLE_ADDRESS_INPUT = {
15
15
  ariaYouHaveSelected: 'You have selected',
16
16
  ariaMinChars: 'Enter 3 or more characters for suggestions.',
17
17
  minChars: 3,
18
- ariaResultsLabel: 'Country suggestions',
19
18
  ariaOneResult: 'There is one suggestion available.',
20
19
  ariaNResults: 'There are {n} suggestions available.',
21
20
  ariaLimitedResults: 'Type more characters to improve your search',
@@ -16,7 +16,6 @@ const EXAMPLE_AUTOSUGGEST = {
16
16
  ariaYouHaveSelected: 'You have selected',
17
17
  ariaMinChars: 'Enter 3 or more characters for suggestions.',
18
18
  minChars: 3,
19
- ariaResultsLabel: 'Country suggestions',
20
19
  ariaOneResult: 'There is one suggestion available.',
21
20
  ariaNResults: 'There are {n} suggestions available.',
22
21
  ariaLimitedResults: 'Type more characters to improve your search',
@@ -40,7 +39,6 @@ const EXAMPLE_AUTOSUGGEST_WITH_LANGUAGE = {
40
39
  ariaYouHaveSelected: 'You have selected',
41
40
  ariaMinChars: 'Enter 3 or more characters for suggestions.',
42
41
  minChars: 3,
43
- ariaResultsLabel: 'Country suggestions',
44
42
  ariaOneResult: 'There is one suggestion available.',
45
43
  ariaNResults: 'There are {n} suggestions available.',
46
44
  ariaLimitedResults: 'Type more characters to improve your search',
@@ -28,8 +28,9 @@ $button-shadow-size: 3px;
28
28
 
29
29
  &--search {
30
30
  .ons-icon {
31
- @include mq(s, l) {
32
- margin-right: 0.5rem;
31
+ margin: 0.125rem 0.5rem 0.125rem 0;
32
+ @include mq(xs, s) {
33
+ margin-right: 0;
33
34
  }
34
35
  }
35
36
  }
@@ -5,65 +5,57 @@ import * as cheerio from 'cheerio';
5
5
  import axe from '../../tests/helpers/axe';
6
6
  import { renderComponent } from '../../tests/helpers/rendering';
7
7
 
8
- const EXAMPLE_CHAR_CHECK_LIMIT = {
9
- id: 'example-char-check-limit',
10
- charCountSingular: 'You have {x} character remaining',
11
- charCountPlural: 'You have {x} characters remaining',
12
- charCountOverLimitSingular: '{x} character too many',
13
- charCountOverLimitPlural: '{x} characters too many',
14
- };
15
-
16
- describe('macro: char-check-limit', () => {
17
- it('passes jest-axe checks without check', async () => {
18
- const $ = cheerio.load(renderComponent('char-check-limit', EXAMPLE_CHAR_CHECK_LIMIT));
19
-
20
- const results = await axe($.html());
21
- expect(results).toHaveNoViolations();
22
- });
23
-
24
- it('passes jest-axe checks with check', async () => {
25
- const $ = cheerio.load(
26
- renderComponent(
27
- 'char-check-limit',
28
- {
29
- ...EXAMPLE_CHAR_CHECK_LIMIT,
30
- variant: 'check',
31
- },
32
- ['<p>Test content.</p>'],
33
- ),
34
- );
35
-
36
- const results = await axe($.html());
37
- expect(results).toHaveNoViolations();
38
- });
39
-
40
- it('has the provided `id` attribute', () => {
41
- const $ = cheerio.load(renderComponent('char-check-limit', EXAMPLE_CHAR_CHECK_LIMIT));
42
-
43
- expect($('.ons-input__limit').attr('id')).toBe('example-char-check-limit');
44
- });
45
-
46
- it('has the provided data attributes', () => {
47
- const $ = cheerio.load(renderComponent('char-check-limit', EXAMPLE_CHAR_CHECK_LIMIT));
48
-
49
- expect($('.ons-input__limit').attr('data-charcount-singular')).toBe('You have {x} character remaining');
50
- expect($('.ons-input__limit').attr('data-charcount-plural')).toBe('You have {x} characters remaining');
51
- expect($('.ons-input__limit').attr('data-charcount-limit-singular')).toBe('{x} character too many');
52
- expect($('.ons-input__limit').attr('data-charcount-limit-plural')).toBe('{x} characters too many');
8
+ import { EXAMPLE_CHAR_CHECK_LIMIT } from './_test-examples';
9
+
10
+ describe('FOR: Macro: CharCheckLimit', () => {
11
+ describe('GIVEN: Params: Required', () => {
12
+ describe('WHEN: required params are provided', () => {
13
+ const $ = cheerio.load(renderComponent('char-check-limit', EXAMPLE_CHAR_CHECK_LIMIT));
14
+
15
+ test('THEN: passes jest-axe checks', async () => {
16
+ const results = await axe($.html());
17
+
18
+ expect(results).toHaveNoViolations();
19
+ });
20
+ test('THEN: has the provided id attribute', () => {
21
+ expect($('.ons-input__limit').attr('id')).toBe('example-char-check-limit');
22
+ });
23
+ test('THEN: has the data attribute which defines charCountPlural', () => {
24
+ expect($('.ons-input__limit').attr('data-charcount-plural')).toBe('You have {x} characters remaining');
25
+ });
26
+ test('THEN: has the data attribute which defines charCountSingular', () => {
27
+ expect($('.ons-input__limit').attr('data-charcount-singular')).toBe('You have {x} character remaining');
28
+ });
29
+ test('THEN: has the data attribute which defines charCountOverLimitSingular', () => {
30
+ expect($('.ons-input__limit').attr('data-charcount-limit-singular')).toBe('{x} character too many');
31
+ });
32
+ test('THEN: has the data attribute which defines charCountOverLimitPlural', () => {
33
+ expect($('.ons-input__limit').attr('data-charcount-limit-plural')).toBe('{x} characters too many');
34
+ });
35
+ });
53
36
  });
54
37
 
55
- it('has expected nested content', () => {
56
- const $ = cheerio.load(
57
- renderComponent(
58
- 'char-check-limit',
59
- {
60
- ...EXAMPLE_CHAR_CHECK_LIMIT,
61
- variant: 'check',
62
- },
63
- ['<p>Test content.</p>'],
64
- ),
65
- );
66
-
67
- expect($('.ons-js-char-check-input').html().trim()).toBe('<p>Test content.</p>');
38
+ describe('GIVEN: Params: variant', () => {
39
+ describe('WHEN: variant is provided', () => {
40
+ const $ = cheerio.load(
41
+ renderComponent(
42
+ 'char-check-limit',
43
+ {
44
+ ...EXAMPLE_CHAR_CHECK_LIMIT,
45
+ variant: 'check',
46
+ },
47
+ ['<p>Test content.</p>'],
48
+ ),
49
+ );
50
+
51
+ test('THEN: passes jest-axe checks with variant set to check', async () => {
52
+ const results = await axe($.html());
53
+ expect(results).toHaveNoViolations();
54
+ });
55
+
56
+ test('THEN: renders the passed content', () => {
57
+ expect($('.ons-js-char-check-input').text()).toBe('Test content.');
58
+ });
59
+ });
68
60
  });
69
61
  });
@@ -21,7 +21,13 @@
21
21
  {% if descriptionItem.id %}id="{{ descriptionItem.id }}"{% endif %}
22
22
  class="ons-description-list__value ons-grid__col ons-col-{{ params.descriptionCol }}@{{ 'xs@l' if params.variant == 'inline' else 'm' }}"
23
23
  >
24
- {{- descriptionItem.description -}}
24
+ {%- if descriptionItem.url -%}
25
+ <a class="ons-description-list__link" href="{{ descriptionItem.url }}">
26
+ {{- descriptionItem.description -}}
27
+ </a>
28
+ {%- else -%}
29
+ {{- descriptionItem.description -}}
30
+ {%- endif -%}
25
31
  </dd>
26
32
  {% endif %}
27
33
  {% endfor %}
@@ -30,6 +30,7 @@ const EXAMPLE_DESCRIPTION_LIST_FULL = {
30
30
  {
31
31
  id: 'description-3',
32
32
  description: '49300005832',
33
+ url: '#',
33
34
  },
34
35
  ],
35
36
  },
@@ -142,7 +143,9 @@ describe('macro: description-list', () => {
142
143
 
143
144
  expect($listElements[4].tagName).toBe('dd');
144
145
  expect($($listElements[4]).attr('id')).toBe('description-3');
145
- expect($($listElements[4]).text()).toBe('49300005832');
146
+ const $link = $($listElements[4]).find('a');
147
+ expect($link.attr('href')).toBe('#');
148
+ expect($link.text()).toBe('49300005832');
146
149
  });
147
150
 
148
151
  it.each([
@@ -49,7 +49,8 @@
49
49
  "description": "Jacky Turner"
50
50
  },
51
51
  {
52
- "description": "Louise Goodland"
52
+ "description": "Louise Goodland",
53
+ 'url': '#'
53
54
  }
54
55
  ]
55
56
  }