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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +3 -0
- data/app/pb_kits/playbook/pb_date_time/date_time.html.erb +1 -0
- data/app/pb_kits/playbook/pb_date_time/date_time.rb +1 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.html.erb +4 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year.jsx +14 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_rails.md +1 -0
- data/app/pb_kits/playbook/pb_date_time/docs/_date_time_show_current_year_react.md +1 -0
- data/app/pb_kits/playbook/pb_date_time/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_date_time/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +3 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +2 -2
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.rb +2 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +33 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.html.erb +4 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.jsx +22 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_show_current_year.md +1 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_dropdown/index.js +18 -2
- data/app/pb_kits/playbook/pb_table/_table.tsx +28 -26
- data/app/pb_kits/playbook/utilities/globalProps.ts +26 -8
- data/app/pb_kits/playbook/utilities/test/globalProps/alignContent.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/alignItems.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/alignSelf.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flex.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexDirection.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexGrow.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexShrink.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/flexWrap.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/justifyContent.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/justifySelf.test.js +18 -0
- data/app/pb_kits/playbook/utilities/test/globalProps/order.test.js +18 -0
- data/dist/chunks/{_line_graph-DDvq7zE7.js → _line_graph-BuucBJlH.js} +1 -1
- data/dist/chunks/_typeahead-VFd5WMRg.js +6 -0
- data/dist/chunks/{_weekday_stacked-DB8t2C4f.js → _weekday_stacked-B4_b9xef.js} +2 -2
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +12 -5
- data/dist/chunks/_typeahead-D2bVH5Fk.js +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e497d506916a6a8c97612016445cb48518fdd40aa15707f40be73898a84cee44
|
|
4
|
+
data.tar.gz: 8d77efa786d47b2c5ee169e9b898c7d2b7e3202c8a63f728d7b73f93e4427244
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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}
|
|
@@ -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,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 %>
|
|
@@ -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,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
|
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
123
|
-
|
|
122
|
+
const headerWidth = (header as HTMLElement).offsetWidth;
|
|
123
|
+
accumulatedWidth += headerWidth;
|
|
124
124
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
cells.forEach((cell) => {
|
|
126
|
+
cell.classList.add('sticky');
|
|
127
|
+
(cell as HTMLElement).style.left = `${accumulatedWidth - headerWidth}px`;
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
-
|
|
174
|
-
|
|
174
|
+
const headerWidth = (header as HTMLElement).offsetWidth;
|
|
175
|
+
accumulatedWidth += headerWidth;
|
|
175
176
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
cells.forEach((cell) => {
|
|
178
|
+
cell.classList.add('sticky');
|
|
179
|
+
(cell as HTMLElement).style.right = `${accumulatedWidth - headerWidth}px`;
|
|
179
180
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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
|
-
|
|
440
|
-
|
|
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
|
-
|
|
467
|
-
|
|
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
|
+
})
|