@ons/design-system 53.1.1 → 54.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.
@@ -429,6 +429,34 @@ describe('macro: input', () => {
429
429
  ).toBe('Example prefix text');
430
430
  });
431
431
 
432
+ it('does not render prefix element when `prefix.id` not set', () => {
433
+ const $ = cheerio.load(
434
+ renderComponent('input', {
435
+ ...EXAMPLE_INPUT_MINIMAL,
436
+ prefix: {
437
+ title: 'Example prefix title',
438
+ text: 'Example prefix text',
439
+ },
440
+ }),
441
+ );
442
+
443
+ expect($('.ons-input-type--prefix').length).toBe(0);
444
+ });
445
+
446
+ it('does not render prefix element when `prefix.title` not set', () => {
447
+ const $ = cheerio.load(
448
+ renderComponent('input', {
449
+ ...EXAMPLE_INPUT_MINIMAL,
450
+ prefix: {
451
+ text: 'Example prefix text',
452
+ id: 'example-prefix-id',
453
+ },
454
+ }),
455
+ );
456
+
457
+ expect($('.ons-input-type--prefix').length).toBe(0);
458
+ });
459
+
432
460
  it('adds `aria-labelledby` attribute when `suffix` is provided', () => {
433
461
  const $ = cheerio.load(
434
462
  renderComponent('input', {
@@ -485,6 +513,34 @@ describe('macro: input', () => {
485
513
  });
486
514
  });
487
515
 
516
+ it('does not render suffix element when `suffix.id` not set', () => {
517
+ const $ = cheerio.load(
518
+ renderComponent('input', {
519
+ ...EXAMPLE_INPUT_MINIMAL,
520
+ suffix: {
521
+ title: 'Example suffix title',
522
+ text: 'Example suffix text',
523
+ },
524
+ }),
525
+ );
526
+
527
+ expect($('.ons-input').length).toBe(0);
528
+ });
529
+
530
+ it('does not render suffix element when `suffix.title` not set', () => {
531
+ const $ = cheerio.load(
532
+ renderComponent('input', {
533
+ ...EXAMPLE_INPUT_MINIMAL,
534
+ suffix: {
535
+ text: 'Example suffix text',
536
+ id: 'example-suffix-id',
537
+ },
538
+ }),
539
+ );
540
+
541
+ expect($('.ons-input').length).toBe(0);
542
+ });
543
+
488
544
  describe('search', () => {
489
545
  it('renders `search` component', () => {
490
546
  const faker = templateFaker();
@@ -11,6 +11,7 @@ const EXAMPLE_MUTUALLY_EXCLUSIVE_DURATION_PARAMS = {
11
11
  name: 'address-duration-years',
12
12
  suffix: {
13
13
  text: 'Years',
14
+ id: 'address-duration-years-suffix',
14
15
  },
15
16
  attributes: {
16
17
  min: 0,
@@ -22,6 +23,7 @@ const EXAMPLE_MUTUALLY_EXCLUSIVE_DURATION_PARAMS = {
22
23
  name: 'address-duration-months',
23
24
  suffix: {
24
25
  text: 'Months',
26
+ id: 'address-duration-months-suffix',
25
27
  },
26
28
  attributes: {
27
29
  min: 0,
@@ -16,6 +16,7 @@ const EXAMPLE_MUTUALLY_EXCLUSIVE_NUMBER_INPUT_PARAMS = {
16
16
  prefix: {
17
17
  title: 'Pounds',
18
18
  text: '£',
19
+ id: 'currency-prefix',
19
20
  },
20
21
  mutuallyExclusive: {
21
22
  or: 'Or',