playbook_ui 15.4.0.pre.alpha.PLAY2627requiredmultiselectdropdownbug12416 → 15.4.0.pre.alpha.PLAY2627requiredmultiselectdropdownbug12442

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 (44) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +3 -0
  3. data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +1 -0
  4. data/app/pb_kits/playbook/pb_date_time/date_time.rb +1 -0
  5. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.html.erb +4 -0
  6. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.jsx +14 -0
  7. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_rails.md +1 -0
  8. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_react.md +1 -0
  9. data/app/pb_kits/playbook/pb_date_time/docs/example.yml +3 -1
  10. data/app/pb_kits/playbook/pb_date_time/docs/index.js +1 -0
  11. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +3 -0
  12. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +2 -2
  13. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.rb +2 -0
  14. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +33 -0
  15. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.html.erb +4 -0
  16. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.jsx +22 -0
  17. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.md +1 -0
  18. data/app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml +3 -1
  19. data/app/pb_kits/playbook/pb_date_time_stacked/docs/index.js +1 -0
  20. data/app/pb_kits/playbook/pb_dropdown/index.js +18 -2
  21. data/app/pb_kits/playbook/pb_table/_table.tsx +28 -26
  22. data/app/pb_kits/playbook/utilities/globalProps.ts +26 -8
  23. data/app/pb_kits/playbook/utilities/test/globalProps/alignContent.test.js +18 -0
  24. data/app/pb_kits/playbook/utilities/test/globalProps/alignItems.test.js +18 -0
  25. data/app/pb_kits/playbook/utilities/test/globalProps/alignSelf.test.js +18 -0
  26. data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +18 -0
  27. data/app/pb_kits/playbook/utilities/test/globalProps/flex.test.js +18 -0
  28. data/app/pb_kits/playbook/utilities/test/globalProps/flexDirection.test.js +18 -0
  29. data/app/pb_kits/playbook/utilities/test/globalProps/flexGrow.test.js +18 -0
  30. data/app/pb_kits/playbook/utilities/test/globalProps/flexShrink.test.js +18 -0
  31. data/app/pb_kits/playbook/utilities/test/globalProps/flexWrap.test.js +18 -0
  32. data/app/pb_kits/playbook/utilities/test/globalProps/justifyContent.test.js +18 -0
  33. data/app/pb_kits/playbook/utilities/test/globalProps/justifySelf.test.js +18 -0
  34. data/app/pb_kits/playbook/utilities/test/globalProps/order.test.js +18 -0
  35. data/dist/chunks/{_line_graph-DDvq7zE7.js → _line_graph-BuucBJlH.js} +1 -1
  36. data/dist/chunks/_typeahead-VFd5WMRg.js +6 -0
  37. data/dist/chunks/{_weekday_stacked-DB8t2C4f.js → _weekday_stacked-B4_b9xef.js} +2 -2
  38. data/dist/chunks/vendor.js +1 -1
  39. data/dist/playbook-doc.js +1 -1
  40. data/dist/playbook-rails-react-bindings.js +1 -1
  41. data/dist/playbook-rails.js +1 -1
  42. data/lib/playbook/version.rb +1 -1
  43. metadata +12 -5
  44. data/dist/chunks/_typeahead-D2bVH5Fk.js +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ccec73ff9da24371018279eed782db5b535c23fa452eed663389ef339ec64257
4
- data.tar.gz: 16ed40f32b267d471031f73b72b48b5beaaa8f872d6e1923e2248c6c72bb234f
3
+ metadata.gz: e497d506916a6a8c97612016445cb48518fdd40aa15707f40be73898a84cee44
4
+ data.tar.gz: 8d77efa786d47b2c5ee169e9b898c7d2b7e3202c8a63f728d7b73f93e4427244
5
5
  SHA512:
6
- metadata.gz: 68d0361d59daead7dc1a5d010dc5a07ca80ea2b268d1bdb6220242b41973f7a80432e735ada36f12e3dbc6585bf6b41728c1a026a3f1403fc38a184720275877
7
- data.tar.gz: f7084f65225e083853a288d1323d80f9781cb794f432064839a535e26087cad177fa4de396cd6de13082099c945df5e7111f7b361b4c3e87d0cd98f6b2cdc77d
6
+ metadata.gz: 224b7a7ea3edd7d9fed655c2a4331cc314ac080a2705bcc492569d8a7d96912b767de9d429a2b7c3374f791e67fef5d61f58e17add18c298ea9686124ae7a08f
7
+ data.tar.gz: ccd0e13f740be905e8851024c12b831759b2364fd96c4f39022527403daaa96ef31ab71ed79c4dec90a339362953a141e175249ec1096cd3ba6b6fe12d2b30b5
@@ -17,6 +17,7 @@ type DateTimeProps = {
17
17
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
18
18
  id?: string,
19
19
  size?: "sm" | "md",
20
+ showCurrentYear?: boolean,
20
21
  showDayOfWeek: boolean,
21
22
  showIcon?: boolean,
22
23
  timeZone?: string
@@ -32,6 +33,7 @@ const DateTime = (props: DateTimeProps): React.ReactElement => {
32
33
  showDayOfWeek = false,
33
34
  datetime,
34
35
  id,
36
+ showCurrentYear = false,
35
37
  showIcon = false,
36
38
  size = 'md',
37
39
  timeZone = 'America/New_York',
@@ -59,6 +61,7 @@ const DateTime = (props: DateTimeProps): React.ReactElement => {
59
61
  vertical="baseline"
60
62
  >
61
63
  <FormattedDate
64
+ showCurrentYear={showCurrentYear}
62
65
  showDayOfWeek={showDayOfWeek}
63
66
  size={size}
64
67
  value={datetime}
@@ -9,6 +9,7 @@
9
9
  dark: object.dark,
10
10
  date: object.date,
11
11
  show_day_of_week: object.show_day_of_week,
12
+ show_current_year: object.show_current_year,
12
13
  size: object.size,
13
14
  timezone: object.timezone,
14
15
  }) %>
@@ -16,6 +16,7 @@ module Playbook
16
16
  prop :dark, type: Playbook::Props::Boolean, default: false
17
17
  prop :show_icon, type: Playbook::Props::Boolean, default: false
18
18
  prop :show_day_of_week, type: Playbook::Props::Boolean, default: false
19
+ prop :show_current_year, type: Playbook::Props::Boolean, default: false
19
20
 
20
21
  def classname
21
22
  generate_classname("pb_date_time_kit", align)
@@ -0,0 +1,4 @@
1
+ <%= pb_rails("date_time", props: {
2
+ date: DateTime.now,
3
+ show_current_year: true
4
+ }) %>
@@ -0,0 +1,14 @@
1
+ import React from 'react'
2
+ import DateTime from '../_date_time'
3
+
4
+ const DateTimeShowCurrentYear = (props) => (
5
+ <div>
6
+ <DateTime
7
+ datetime={new Date()}
8
+ showCurrentYear
9
+ {...props}
10
+ />
11
+ </div>
12
+ )
13
+
14
+ export default DateTimeShowCurrentYear
@@ -0,0 +1 @@
1
+ Pass in `show_current_year` to show this date's current year.
@@ -0,0 +1 @@
1
+ Pass in `showCurrentYear` to show this date's current year.
@@ -1,14 +1,16 @@
1
1
  examples:
2
-
2
+
3
3
  rails:
4
4
  - date_time_default: Default
5
5
  - date_time_align: Alignment
6
6
  - date_time_size: Size
7
+ - date_time_show_current_year: Show Current Year
7
8
 
8
9
  react:
9
10
  - date_time_default: Default
10
11
  - date_time_align: Alignment
11
12
  - date_time_size: Size
13
+ - date_time_show_current_year: Show Current Year
12
14
 
13
15
  swift:
14
16
  - date_time_default_swift: Default
@@ -1,3 +1,4 @@
1
1
  export { default as DateTimeDefault } from './_date_time_default.jsx'
2
2
  export { default as DateTimeAlign } from './_date_time_align.jsx'
3
3
  export { default as DateTimeSize } from './_date_time_size.jsx'
4
+ export { default as DateTimeShowCurrentYear } from './_date_time_show_current_year.jsx'
@@ -17,6 +17,7 @@ type DateTimeStackedProps = {
17
17
  datetime: Date,
18
18
  dark: boolean,
19
19
  timeZone?: string,
20
+ showCurrentYear?: boolean,
20
21
  }
21
22
 
22
23
  const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
@@ -28,6 +29,7 @@ const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
28
29
  dark,
29
30
  htmlOptions = {},
30
31
  timeZone = 'America/New_York',
32
+ showCurrentYear = false,
31
33
  } = props
32
34
 
33
35
  const classes = buildCss('pb_date_time_stacked_kit', globalProps(props))
@@ -46,6 +48,7 @@ const DateTimeStacked = (props: DateTimeStackedProps): React.ReactElement => {
46
48
  bold
47
49
  dark={dark}
48
50
  date={date || datetime}
51
+ showCurrentYear={showCurrentYear}
49
52
  />
50
53
  </FlexItem>
51
54
 
@@ -1,8 +1,8 @@
1
- <%= pb_content_tag do %>
1
+ <%= pb_content_tag do %>
2
2
 
3
3
  <%= pb_rails("flex", props: {classname: "flex-container", vertical: "stretch"}) do %>
4
4
  <%= pb_rails("body", props: {classname: "flex-item"}) do %>
5
- <%= pb_rails("date_stacked", props: { date: object.date_time_value, size: "sm", align: "right", bold: true, dark: object.dark }) %>
5
+ <%= pb_rails("date_stacked", props: { date: object.date_time_value, size: "sm", align: "right", bold: true, dark: object.dark, show_current_year: object.show_current_year }) %>
6
6
  <% end %>
7
7
  <%= pb_rails("section_separator", props: { orientation: "vertical", classname: "date-time-padding" }) %>
8
8
  <%= pb_rails("body", props: {classname: "flex-item"}) do %>
@@ -10,6 +10,8 @@ module Playbook
10
10
  default: false
11
11
  prop :timezone, type: Playbook::Props::String,
12
12
  default: "America/New_York"
13
+ prop :show_current_year, type: Playbook::Props::Boolean,
14
+ default: false
13
15
 
14
16
  def date_time_value
15
17
  date || date_time
@@ -41,3 +41,36 @@ test('renders time in timezone', () => {
41
41
  const kit = renderKit(DateTimeStacked, props)
42
42
  expect(kit).toHaveTextContent(`${monthDayYear}11:00aMDT`)
43
43
  })
44
+
45
+ test('renders current year when showCurrentYear is true', () => {
46
+ const currentYearDate = new Date()
47
+ const currentYear = currentYearDate.getFullYear()
48
+
49
+ const kit = renderKit(DateTimeStacked, {
50
+ data: { testid: 'datetimestacked-current-year' },
51
+ datetime: currentYearDate,
52
+ dark: false,
53
+ showCurrentYear: true,
54
+ })
55
+ expect(kit).toHaveTextContent(currentYear.toString())
56
+ })
57
+
58
+ test('hides current year by default', () => {
59
+ const currentYearDate = new Date()
60
+ const currentYear = currentYearDate.getFullYear()
61
+
62
+ const kit = renderKit(DateTimeStacked, {
63
+ data: { testid: 'datetimestacked-hide-year' },
64
+ datetime: currentYearDate,
65
+ dark: false,
66
+ })
67
+
68
+ const yearElement = kit.querySelector('.pb_caption_kit_xs')
69
+
70
+ if (yearElement) {
71
+ expect(yearElement.textContent).not.toBe(currentYear.toString())
72
+ } else {
73
+
74
+ expect(yearElement).toBeNull()
75
+ }
76
+ })
@@ -0,0 +1,4 @@
1
+ <%= pb_rails("date_time_stacked", props: { date_time: DateTime.now, show_current_year: true }) %>
2
+ <br>
3
+ <%= pb_rails("date_time_stacked", props: { date_time: DateTime.now, show_current_year: true, timezone: "America/Denver" }) %>
4
+
@@ -0,0 +1,22 @@
1
+ import React from 'react'
2
+
3
+ import DateTimeStacked from '../_date_time_stacked'
4
+
5
+ const DateTimeStackedShowCurrentYear = (props) => (
6
+ <div>
7
+ <DateTimeStacked
8
+ datetime={new Date()}
9
+ showCurrentYear
10
+ {...props}
11
+ />
12
+ <br />
13
+ <DateTimeStacked
14
+ datetime={new Date()}
15
+ showCurrentYear
16
+ timeZone="America/Denver"
17
+ {...props}
18
+ />
19
+ </div>
20
+ );
21
+
22
+ export default DateTimeStackedShowCurrentYear;
@@ -0,0 +1 @@
1
+ By default, the Date Time Stacked kit does NOT display the year if it is the current year. If you want to display the current year you can do so by setting `showCurrentYear`/`show_current_year` to true as shown here.
@@ -2,9 +2,11 @@ examples:
2
2
 
3
3
  rails:
4
4
  - date_time_stacked_default: Default
5
-
5
+ - date_time_stacked_show_current_year: Show Current Year
6
+
6
7
  react:
7
8
  - date_time_stacked_default: Default
9
+ - date_time_stacked_show_current_year: Show Current Year
8
10
 
9
11
  swift:
10
12
  - date_time_stacked_default_swift: Default
@@ -1 +1,2 @@
1
1
  export { default as DateTimeStackedDefault } from './_date_time_stacked_default.jsx'
2
+ export { default as DateTimeStackedShowCurrentYear } from './_date_time_stacked_show_current_year.jsx'
@@ -33,6 +33,8 @@ export default class PbDropdown extends PbEnhancedElement {
33
33
  this.formPillProps = this.element.dataset.formPillProps
34
34
  ? JSON.parse(this.element.dataset.formPillProps)
35
35
  : {};
36
+ const baseInput = this.element.querySelector(DROPDOWN_INPUT);
37
+ this.wasOriginallyRequired = baseInput && baseInput.hasAttribute("required");
36
38
  this.setDefaultValue();
37
39
  this.bindEventListeners();
38
40
  this.bindSearchInput();
@@ -587,7 +589,9 @@ export default class PbDropdown extends PbEnhancedElement {
587
589
  // for multi_select, for each selectedOption, create a hidden input
588
590
  const name = baseInput.getAttribute("name");
589
591
  this.selectedOptions.forEach((raw) => {
590
- const id = JSON.parse(raw).id;
592
+ const optionData = JSON.parse(raw);
593
+ // Use id if available, otherwise fall back to value
594
+ const id = optionData.id || optionData.value;
591
595
  const inp = document.createElement("input");
592
596
  inp.type = "hidden";
593
597
  inp.name = name;
@@ -595,7 +599,19 @@ export default class PbDropdown extends PbEnhancedElement {
595
599
  inp.dataset.generated = "true";
596
600
  baseInput.insertAdjacentElement("afterend", inp);
597
601
  });
598
- baseInput.value = "";
602
+
603
+ // For multi-select, remove required from base input when there are selections
604
+ // The generated inputs handle the form submission with actual values
605
+ // Restore required attribute when there are no selections (if it was originally required)
606
+ if (this.selectedOptions.size > 0) {
607
+ baseInput.value = "";
608
+ baseInput.removeAttribute("required");
609
+ } else {
610
+ baseInput.value = "";
611
+ if (this.wasOriginallyRequired) {
612
+ baseInput.setAttribute("required", "");
613
+ }
614
+ }
599
615
  }
600
616
 
601
617
  handleBackspaceClear() {
@@ -119,21 +119,22 @@ const Table = (props: TableProps): React.ReactElement => {
119
119
  header.classList.add('sticky-left-shadow');
120
120
  }
121
121
 
122
- accumulatedWidth += (header as HTMLElement).offsetWidth;
123
- }
122
+ const headerWidth = (header as HTMLElement).offsetWidth;
123
+ accumulatedWidth += headerWidth;
124
124
 
125
- cells.forEach((cell) => {
126
- cell.classList.add('sticky');
127
- (cell as HTMLElement).style.left = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
125
+ cells.forEach((cell) => {
126
+ cell.classList.add('sticky');
127
+ (cell as HTMLElement).style.left = `${accumulatedWidth - headerWidth}px`;
128
128
 
129
- if (!isLastColumn) {
130
- cell.classList.add('with-border-right');
131
- cell.classList.remove('sticky-left-shadow');
132
- } else {
133
- cell.classList.remove('with-border-right');
134
- cell.classList.add('sticky-left-shadow');
135
- }
136
- });
129
+ if (!isLastColumn) {
130
+ cell.classList.add('with-border-right');
131
+ cell.classList.remove('sticky-left-shadow');
132
+ } else {
133
+ cell.classList.remove('with-border-right');
134
+ cell.classList.add('sticky-left-shadow');
135
+ }
136
+ });
137
+ }
137
138
  });
138
139
  };
139
140
 
@@ -170,21 +171,22 @@ const Table = (props: TableProps): React.ReactElement => {
170
171
  header.classList.add('sticky-right-shadow');
171
172
  }
172
173
 
173
- accumulatedWidth += (header as HTMLElement).offsetWidth;
174
- }
174
+ const headerWidth = (header as HTMLElement).offsetWidth;
175
+ accumulatedWidth += headerWidth;
175
176
 
176
- cells.forEach((cell) => {
177
- cell.classList.add('sticky');
178
- (cell as HTMLElement).style.right = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
177
+ cells.forEach((cell) => {
178
+ cell.classList.add('sticky');
179
+ (cell as HTMLElement).style.right = `${accumulatedWidth - headerWidth}px`;
179
180
 
180
- if (!isLastColumn) {
181
- cell.classList.add('with-border-left');
182
- cell.classList.remove('sticky-right-shadow');
183
- } else {
184
- cell.classList.remove('with-border-left');
185
- cell.classList.add('sticky-right-shadow');
186
- }
187
- });
181
+ if (!isLastColumn) {
182
+ cell.classList.add('with-border-left');
183
+ cell.classList.remove('sticky-right-shadow');
184
+ } else {
185
+ cell.classList.remove('with-border-left');
186
+ cell.classList.add('sticky-right-shadow');
187
+ }
188
+ });
189
+ }
188
190
  });
189
191
  };
190
192
 
@@ -213,10 +213,24 @@ export type GlobalProps = AlignContent & AlignItems & AlignSelf &
213
213
 
214
214
  const getResponsivePropClasses = (prop: {[key: string]: string}, classPrefix: string) => {
215
215
  const keys: string[] = Object.keys(prop)
216
- return keys.map((size: Sizes) => {
217
- const propValue: string = typeof(prop[size]) === 'string' ? camelToSnakeCase(prop[size]) : prop[size]
218
- return `${classPrefix}_${size}_${propValue}`
219
- }).join(" ")
216
+ const screenSizeValues = ["xs", "sm", "md", "lg", "xl"]
217
+ let classResult = ''
218
+
219
+ // Handle default value separately (generates base class without size prefix)
220
+ if (prop.default !== undefined) {
221
+ const defaultValue: string = typeof(prop.default) === 'string' ? camelToSnakeCase(prop.default) : prop.default
222
+ classResult += `${classPrefix}_${defaultValue} `
223
+ }
224
+
225
+ // Handle responsive sizes (generates classes with size prefix)
226
+ keys.forEach((key) => {
227
+ if (screenSizeValues.includes(key)) {
228
+ const propValue: string = typeof(prop[key]) === 'string' ? camelToSnakeCase(prop[key]) : prop[key]
229
+ classResult += `${classPrefix}_${key}_${propValue} `
230
+ }
231
+ })
232
+
233
+ return classResult.trim()
220
234
  }
221
235
 
222
236
  //reusable function for top, bottom, right and left props
@@ -436,9 +450,11 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
436
450
  if (typeof zIndexEntry[1] == "number") {
437
451
  css += `z_index_${zIndexEntry[1]} `
438
452
  } else if (typeof zIndexEntry[1] == "object") {
439
- Object.entries(zIndexEntry[1]).forEach((zIndexObj) => {
440
- css += `z_index_${zIndexObj[0]}_${zIndexObj[1]} `
453
+ const responsiveObj: {[key: string]: string} = {}
454
+ Object.entries(zIndexEntry[1]).forEach(([key, value]) => {
455
+ responsiveObj[key] = value.toString()
441
456
  })
457
+ css += getResponsivePropClasses(responsiveObj, 'z_index')
442
458
  } else if (zIndexEntry[1] === 'max') {
443
459
  css += `z_index_max `
444
460
  }
@@ -463,9 +479,11 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
463
479
  if (typeof displayEntry[1] == "string") {
464
480
  css += `display_${displayEntry[1]} `
465
481
  } else if (typeof displayEntry[1] == "object") {
466
- Object.entries(displayEntry[1]).forEach((displayObj) => {
467
- css += `display_${displayObj[0]}_${displayObj[1]} `
482
+ const responsiveObj: {[key: string]: string} = {}
483
+ Object.entries(displayEntry[1]).forEach(([key, value]) => {
484
+ responsiveObj[key] = typeof value === 'string' ? value : value.toString()
468
485
  })
486
+ css += getResponsivePropClasses(responsiveObj, 'display')
469
487
  } else {
470
488
  ' '
471
489
  }
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
35
35
  })
36
36
  }
37
37
  })
38
+
39
+ test('Global Props: returns proper class name with default key', () => {
40
+ const testId = `${testSubject}-default-responsive`
41
+ render(
42
+ <Body
43
+ alignContent={{ default: "spaceAround", xs: "center", sm: "spaceAround", md: "center" }}
44
+ data={{ testid: testId }}
45
+ text="Hi"
46
+ />
47
+ )
48
+ const kit = screen.getByTestId(testId)
49
+ // Should have base class for default value
50
+ expect(kit).toHaveClass(`align_content_space_around`)
51
+ // Should have responsive classes for screen sizes
52
+ expect(kit).toHaveClass(`align_content_xs_center`)
53
+ expect(kit).toHaveClass(`align_content_sm_space_around`)
54
+ expect(kit).toHaveClass(`align_content_md_center`)
55
+ })
@@ -34,3 +34,21 @@ test('Global Props: returns proper class name', () => {
34
34
  })
35
35
  }
36
36
  })
37
+
38
+ test('Global Props: returns proper class name with default key', () => {
39
+ const testId = `${testSubject}-default-responsive`
40
+ render(
41
+ <Body
42
+ alignItems={{ default: "end", xs: "center", sm: "end", md: "center" }}
43
+ data={{ testid: testId }}
44
+ text="Hi"
45
+ />
46
+ )
47
+ const kit = screen.getByTestId(testId)
48
+ // Should have base class for default value
49
+ expect(kit).toHaveClass(`align_items_end`)
50
+ // Should have responsive classes for screen sizes
51
+ expect(kit).toHaveClass(`align_items_xs_center`)
52
+ expect(kit).toHaveClass(`align_items_sm_end`)
53
+ expect(kit).toHaveClass(`align_items_md_center`)
54
+ })
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
35
35
  })
36
36
  }
37
37
  })
38
+
39
+ test('Global Props: returns proper class name with default key', () => {
40
+ const testId = `${testSubject}-default-responsive`
41
+ render(
42
+ <Body
43
+ alignSelf={{ default: "end", xs: "center", sm: "end", md: "center" }}
44
+ data={{ testid: testId }}
45
+ text="Hi"
46
+ />
47
+ )
48
+ const kit = screen.getByTestId(testId)
49
+ // Should have base class for default value
50
+ expect(kit).toHaveClass(`align_self_end`)
51
+ // Should have responsive classes for screen sizes
52
+ expect(kit).toHaveClass(`align_self_xs_center`)
53
+ expect(kit).toHaveClass(`align_self_sm_end`)
54
+ expect(kit).toHaveClass(`align_self_md_center`)
55
+ })
@@ -36,3 +36,21 @@ test('Global Props: returns proper class name', () => {
36
36
  })
37
37
  }
38
38
  })
39
+
40
+ test('Global Props: returns proper class name with default key', () => {
41
+ const testId = `${testSubject}-default-responsive`
42
+ render(
43
+ <Body
44
+ data={{ testid: testId }}
45
+ display={{ default: "none", xs: "block", sm: "none", md: "block" }}
46
+ text="Hi"
47
+ />
48
+ )
49
+ const kit = screen.getByTestId(testId)
50
+ // Should have base class for default value
51
+ expect(kit).toHaveClass(`display_none`)
52
+ // Should have responsive classes for screen sizes
53
+ expect(kit).toHaveClass(`display_xs_block`)
54
+ expect(kit).toHaveClass(`display_sm_none`)
55
+ expect(kit).toHaveClass(`display_md_block`)
56
+ })
@@ -62,3 +62,21 @@ test('Global Props: returns proper class name', () => {
62
62
  })
63
63
  }
64
64
  })
65
+
66
+ test('Global Props: returns proper class name with default key', () => {
67
+ const testId = `${testSubject}-default-responsive`
68
+ render(
69
+ <Body
70
+ data={{ testid: testId }}
71
+ flex={{ default: "3", xs: "1", sm: "3", md: "1" }}
72
+ text="Hi"
73
+ />
74
+ )
75
+ const kit = screen.getByTestId(testId)
76
+ // Should have base class for default value
77
+ expect(kit).toHaveClass(`flex_3`)
78
+ // Should have responsive classes for screen sizes
79
+ expect(kit).toHaveClass(`flex_xs_1`)
80
+ expect(kit).toHaveClass(`flex_sm_3`)
81
+ expect(kit).toHaveClass(`flex_md_1`)
82
+ })
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
35
35
  })
36
36
  }
37
37
  })
38
+
39
+ test('Global Props: returns proper class name with default key', () => {
40
+ const testId = `${testSubject}-default-responsive`
41
+ render(
42
+ <Body
43
+ data={{ testid: testId }}
44
+ flexDirection={{ default: "column", xs: "row", sm: "column", md: "row" }}
45
+ text="Hi"
46
+ />
47
+ )
48
+ const kit = screen.getByTestId(testId)
49
+ // Should have base class for default value
50
+ expect(kit).toHaveClass(`flex_direction_column`)
51
+ // Should have responsive classes for screen sizes
52
+ expect(kit).toHaveClass(`flex_direction_xs_row`)
53
+ expect(kit).toHaveClass(`flex_direction_sm_column`)
54
+ expect(kit).toHaveClass(`flex_direction_md_row`)
55
+ })
@@ -33,3 +33,21 @@ test('Global Props: Returns ordinal suffixed class name', () => {
33
33
  })
34
34
  }
35
35
  })
36
+
37
+ test('Global Props: returns proper class name with default key', () => {
38
+ const testId = `${testSubject}-default-responsive`
39
+ render(
40
+ <Body
41
+ data={{ testid: testId }}
42
+ flexGrow={{ default: 1, xs: 0, sm: 1, md: 0 }}
43
+ text="Hi"
44
+ />
45
+ )
46
+ const kit = screen.getByTestId(testId)
47
+ // Should have base class for default value
48
+ expect(kit).toHaveClass(`flex_grow_1`)
49
+ // Should have responsive classes for screen sizes
50
+ expect(kit).toHaveClass(`flex_grow_xs_0`)
51
+ expect(kit).toHaveClass(`flex_grow_sm_1`)
52
+ expect(kit).toHaveClass(`flex_grow_md_0`)
53
+ })
@@ -33,3 +33,21 @@ test('Global Props: Returns ordinal suffixed class name', () => {
33
33
  })
34
34
  }
35
35
  })
36
+
37
+ test('Global Props: returns proper class name with default key', () => {
38
+ const testId = `${testSubject}-default-responsive`
39
+ render(
40
+ <Body
41
+ data={{ testid: testId }}
42
+ flexShrink={{ default: 0, xs: 1, sm: 0, md: 1 }}
43
+ text="Hi"
44
+ />
45
+ )
46
+ const kit = screen.getByTestId(testId)
47
+ // Should have base class for default value
48
+ expect(kit).toHaveClass(`flex_shrink_0`)
49
+ // Should have responsive classes for screen sizes
50
+ expect(kit).toHaveClass(`flex_shrink_xs_1`)
51
+ expect(kit).toHaveClass(`flex_shrink_sm_0`)
52
+ expect(kit).toHaveClass(`flex_shrink_md_1`)
53
+ })
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
35
35
  })
36
36
  }
37
37
  })
38
+
39
+ test('Global Props: returns proper class name with default key', () => {
40
+ const testId = `${testSubject}-default-responsive`
41
+ render(
42
+ <Body
43
+ data={{ testid: testId }}
44
+ flexWrap={{ default: "wrap", xs: "nowrap", sm: "wrap", md: "nowrap" }}
45
+ text="Hi"
46
+ />
47
+ )
48
+ const kit = screen.getByTestId(testId)
49
+ // Should have base class for default value
50
+ expect(kit).toHaveClass(`flex_wrap_wrap`)
51
+ // Should have responsive classes for screen sizes
52
+ expect(kit).toHaveClass(`flex_wrap_xs_nowrap`)
53
+ expect(kit).toHaveClass(`flex_wrap_sm_wrap`)
54
+ expect(kit).toHaveClass(`flex_wrap_md_nowrap`)
55
+ })
@@ -35,3 +35,21 @@ test('Global Props: returns proper class name', () => {
35
35
  })
36
36
  }
37
37
  })
38
+
39
+ test('Global Props: returns proper class name with default key', () => {
40
+ const testId = `${testSubject}-default-responsive`
41
+ render(
42
+ <Body
43
+ data={{ testid: testId }}
44
+ justifyContent={{ default: "spaceBetween", xs: "start", sm: "spaceBetween", md: "start" }}
45
+ text="Hi"
46
+ />
47
+ )
48
+ const kit = screen.getByTestId(testId)
49
+ // Should have base class for default value
50
+ expect(kit).toHaveClass(`justify_content_space_between`)
51
+ // Should have responsive classes for screen sizes
52
+ expect(kit).toHaveClass(`justify_content_xs_start`)
53
+ expect(kit).toHaveClass(`justify_content_sm_space_between`)
54
+ expect(kit).toHaveClass(`justify_content_md_start`)
55
+ })