pebble-web 2.25.2-alpha.2 → 2.25.2
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.
- package/dist/components/typings/Button.d.ts +0 -1
- package/dist/components/typings/Calendar.d.ts +0 -1
- package/dist/components/typings/CheckboxGroup.d.ts +0 -1
- package/dist/components/typings/Control.d.ts +0 -1
- package/dist/components/typings/DateInput.d.ts +0 -1
- package/dist/components/typings/Dropdown.d.ts +0 -1
- package/dist/components/typings/Input.d.ts +0 -1
- package/dist/components/typings/Loader.d.ts +0 -1
- package/dist/components/typings/Message.d.ts +0 -1
- package/dist/components/typings/OptionGroup.d.ts +0 -1
- package/dist/components/typings/OptionGroupCheckBox.d.ts +0 -1
- package/dist/components/typings/OptionGroupRadio.d.ts +0 -1
- package/dist/components/typings/PhoneNumberInput.d.ts +0 -1
- package/dist/components/typings/RadioGroup.d.ts +0 -1
- package/dist/components/typings/Search.d.ts +0 -1
- package/dist/components/typings/SecondaryInput.d.ts +0 -1
- package/dist/components/typings/Select.d.ts +0 -1
- package/dist/components/typings/Text.d.ts +0 -1
- package/dist/components/typings/Typeahead.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/pebble-web.dev.js +160 -333
- package/dist/pebble-web.dev.js.map +1 -1
- package/dist/pebble-web.es.dev.js +66 -216
- package/dist/pebble-web.es.dev.js.map +1 -1
- package/dist/pebble-web.es.js +60 -210
- package/dist/pebble-web.es.js.map +1 -1
- package/dist/pebble-web.js +154 -327
- package/dist/pebble-web.js.map +1 -1
- package/dist/pebble-web.module.dev.js +161 -323
- package/dist/pebble-web.module.dev.js.map +1 -1
- package/dist/pebble-web.module.js +155 -317
- package/dist/pebble-web.module.js.map +1 -1
- package/dist/pebble-web.umd.dev.js +160 -333
- package/dist/pebble-web.umd.dev.js.map +1 -1
- package/dist/pebble-web.umd.js +154 -327
- package/dist/pebble-web.umd.js.map +1 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/useragent/index.d.ts +1 -2
- package/package.json +1 -2
- package/src/components/Button.tsx +1 -3
- package/src/components/Calendar.tsx +4 -28
- package/src/components/CheckboxGroup.tsx +3 -13
- package/src/components/DateInput.tsx +1 -3
- package/src/components/DropDown.tsx +1 -3
- package/src/components/Input.tsx +3 -15
- package/src/components/Loader.tsx +1 -3
- package/src/components/Message.tsx +1 -3
- package/src/components/NativeDateInput.tsx +1 -2
- package/src/components/OptionGroupCheckBox.tsx +2 -14
- package/src/components/PhoneNumberInput.tsx +1 -7
- package/src/components/RadioGroup.tsx +3 -20
- package/src/components/Search.tsx +1 -3
- package/src/components/SecondaryInput.tsx +2 -9
- package/src/components/Select.tsx +1 -13
- package/src/components/Tabs.tsx +1 -1
- package/src/components/Text.tsx +2 -7
- package/src/components/TimePicker.tsx +2 -2
- package/src/components/Toast.tsx +2 -2
- package/src/components/TypeAhead.tsx +3 -14
- package/src/components/__tests__/__snapshots__/optionGroup.test.tsx.snap +3 -0
- package/src/components/__tests__/__snapshots__/select.test.tsx.snap +0 -3
- package/src/components/__tests__/__snapshots__/timepicker.test.tsx.snap +18 -18
- package/src/components/__tests__/calendar.test.tsx +24 -6
- package/src/components/__tests__/checkboxGroup.test.tsx +8 -39
- package/src/components/__tests__/select.test.tsx +30 -19
- package/src/components/__tests__/timepicker.test.tsx +14 -4
- package/src/components/shared/Control.tsx +1 -3
- package/src/components/shared/OptionGroup.tsx +5 -23
- package/src/components/typings/Button.ts +0 -1
- package/src/components/typings/Calendar.ts +0 -1
- package/src/components/typings/CheckboxGroup.ts +0 -1
- package/src/components/typings/Control.ts +0 -1
- package/src/components/typings/DateInput.ts +0 -1
- package/src/components/typings/Dropdown.ts +0 -1
- package/src/components/typings/Input.ts +0 -1
- package/src/components/typings/Loader.ts +0 -1
- package/src/components/typings/Message.ts +0 -1
- package/src/components/typings/OptionGroup.ts +0 -1
- package/src/components/typings/OptionGroupCheckBox.ts +0 -1
- package/src/components/typings/OptionGroupRadio.ts +0 -1
- package/src/components/typings/PhoneNumberInput.ts +0 -1
- package/src/components/typings/RadioGroup.ts +0 -1
- package/src/components/typings/Search.ts +0 -1
- package/src/components/typings/SecondaryInput.ts +0 -1
- package/src/components/typings/Select.ts +0 -1
- package/src/components/typings/Text.ts +0 -1
- package/src/components/typings/Typeahead.ts +0 -1
- package/src/index.ts +0 -1
- package/src/utils/index.ts +0 -1
- package/src/utils/useragent/index.tsx +1 -1
- package/dist/utils/testIds.d.ts +0 -60
- package/src/components/__tests__/__snapshots__/checkboxGroup.test.tsx.snap +0 -88
- package/src/utils/testIds.ts +0 -111
|
@@ -81,6 +81,7 @@ exports[`Component: OptionGroup default snapshot 1`] = `
|
|
|
81
81
|
|
|
82
82
|
<div
|
|
83
83
|
className="emotion-24"
|
|
84
|
+
data-test-id="optiongroup"
|
|
84
85
|
role="radiogroup"
|
|
85
86
|
style={
|
|
86
87
|
Object {
|
|
@@ -714,6 +715,7 @@ Array [
|
|
|
714
715
|
<div
|
|
715
716
|
aria-label="Search"
|
|
716
717
|
className="emotion-36"
|
|
718
|
+
data-test-id="optiongroup"
|
|
717
719
|
role="group"
|
|
718
720
|
style={
|
|
719
721
|
Object {
|
|
@@ -1378,6 +1380,7 @@ Array [
|
|
|
1378
1380
|
<div
|
|
1379
1381
|
aria-label="Search"
|
|
1380
1382
|
className="emotion-24"
|
|
1383
|
+
data-test-id="optiongroup"
|
|
1381
1384
|
role="radiogroup"
|
|
1382
1385
|
style={
|
|
1383
1386
|
Object {
|
|
@@ -172,7 +172,6 @@ exports[`Component: Select multi-select: snapshot 1`] = `
|
|
|
172
172
|
>
|
|
173
173
|
<div
|
|
174
174
|
className="emotion-6"
|
|
175
|
-
data-testid="test-multi-select-input"
|
|
176
175
|
onClick={[Function]}
|
|
177
176
|
>
|
|
178
177
|
<div
|
|
@@ -387,7 +386,6 @@ exports[`Component: Select single-select with searchbox: snapshot 1`] = `
|
|
|
387
386
|
>
|
|
388
387
|
<div
|
|
389
388
|
className="emotion-6"
|
|
390
|
-
data-testid="test-single-select-input"
|
|
391
389
|
onClick={[Function]}
|
|
392
390
|
>
|
|
393
391
|
<div
|
|
@@ -602,7 +600,6 @@ exports[`Component: Select single-select: snapshot 1`] = `
|
|
|
602
600
|
>
|
|
603
601
|
<div
|
|
604
602
|
className="emotion-6"
|
|
605
|
-
data-testid="test-single-select-input"
|
|
606
603
|
onClick={[Function]}
|
|
607
604
|
>
|
|
608
605
|
<div
|
|
@@ -70,7 +70,7 @@ exports[`TimePicker { selectedHour: 1, selectedMinute: 0 } 1`] = `
|
|
|
70
70
|
>
|
|
71
71
|
<div
|
|
72
72
|
className="emotion-2"
|
|
73
|
-
data-
|
|
73
|
+
data-test-id="hour-label"
|
|
74
74
|
onClick={[Function]}
|
|
75
75
|
>
|
|
76
76
|
<span
|
|
@@ -109,7 +109,7 @@ exports[`TimePicker { selectedHour: 1, selectedMinute: 0 } 1`] = `
|
|
|
109
109
|
>
|
|
110
110
|
<div
|
|
111
111
|
className="emotion-2"
|
|
112
|
-
data-
|
|
112
|
+
data-test-id="minute-label"
|
|
113
113
|
onClick={[Function]}
|
|
114
114
|
>
|
|
115
115
|
<span
|
|
@@ -201,7 +201,7 @@ exports[`TimePicker { selectedHour: 1, selectedMinute: 15 } 1`] = `
|
|
|
201
201
|
>
|
|
202
202
|
<div
|
|
203
203
|
className="emotion-2"
|
|
204
|
-
data-
|
|
204
|
+
data-test-id="hour-label"
|
|
205
205
|
onClick={[Function]}
|
|
206
206
|
>
|
|
207
207
|
<span
|
|
@@ -240,7 +240,7 @@ exports[`TimePicker { selectedHour: 1, selectedMinute: 15 } 1`] = `
|
|
|
240
240
|
>
|
|
241
241
|
<div
|
|
242
242
|
className="emotion-2"
|
|
243
|
-
data-
|
|
243
|
+
data-test-id="minute-label"
|
|
244
244
|
onClick={[Function]}
|
|
245
245
|
>
|
|
246
246
|
<span
|
|
@@ -332,7 +332,7 @@ exports[`TimePicker { selectedHour: 1, selectedMinute: undefined } 1`] = `
|
|
|
332
332
|
>
|
|
333
333
|
<div
|
|
334
334
|
className="emotion-2"
|
|
335
|
-
data-
|
|
335
|
+
data-test-id="hour-label"
|
|
336
336
|
onClick={[Function]}
|
|
337
337
|
>
|
|
338
338
|
<span
|
|
@@ -371,7 +371,7 @@ exports[`TimePicker { selectedHour: 1, selectedMinute: undefined } 1`] = `
|
|
|
371
371
|
>
|
|
372
372
|
<div
|
|
373
373
|
className="emotion-2"
|
|
374
|
-
data-
|
|
374
|
+
data-test-id="minute-label"
|
|
375
375
|
onClick={[Function]}
|
|
376
376
|
>
|
|
377
377
|
<span
|
|
@@ -463,7 +463,7 @@ exports[`TimePicker { selectedHour: 12, selectedMinute: 0 } 1`] = `
|
|
|
463
463
|
>
|
|
464
464
|
<div
|
|
465
465
|
className="emotion-2"
|
|
466
|
-
data-
|
|
466
|
+
data-test-id="hour-label"
|
|
467
467
|
onClick={[Function]}
|
|
468
468
|
>
|
|
469
469
|
<span
|
|
@@ -502,7 +502,7 @@ exports[`TimePicker { selectedHour: 12, selectedMinute: 0 } 1`] = `
|
|
|
502
502
|
>
|
|
503
503
|
<div
|
|
504
504
|
className="emotion-2"
|
|
505
|
-
data-
|
|
505
|
+
data-test-id="minute-label"
|
|
506
506
|
onClick={[Function]}
|
|
507
507
|
>
|
|
508
508
|
<span
|
|
@@ -594,7 +594,7 @@ exports[`TimePicker { selectedHour: 12, selectedMinute: 15 } 1`] = `
|
|
|
594
594
|
>
|
|
595
595
|
<div
|
|
596
596
|
className="emotion-2"
|
|
597
|
-
data-
|
|
597
|
+
data-test-id="hour-label"
|
|
598
598
|
onClick={[Function]}
|
|
599
599
|
>
|
|
600
600
|
<span
|
|
@@ -633,7 +633,7 @@ exports[`TimePicker { selectedHour: 12, selectedMinute: 15 } 1`] = `
|
|
|
633
633
|
>
|
|
634
634
|
<div
|
|
635
635
|
className="emotion-2"
|
|
636
|
-
data-
|
|
636
|
+
data-test-id="minute-label"
|
|
637
637
|
onClick={[Function]}
|
|
638
638
|
>
|
|
639
639
|
<span
|
|
@@ -725,7 +725,7 @@ exports[`TimePicker { selectedHour: 12, selectedMinute: undefined } 1`] = `
|
|
|
725
725
|
>
|
|
726
726
|
<div
|
|
727
727
|
className="emotion-2"
|
|
728
|
-
data-
|
|
728
|
+
data-test-id="hour-label"
|
|
729
729
|
onClick={[Function]}
|
|
730
730
|
>
|
|
731
731
|
<span
|
|
@@ -764,7 +764,7 @@ exports[`TimePicker { selectedHour: 12, selectedMinute: undefined } 1`] = `
|
|
|
764
764
|
>
|
|
765
765
|
<div
|
|
766
766
|
className="emotion-2"
|
|
767
|
-
data-
|
|
767
|
+
data-test-id="minute-label"
|
|
768
768
|
onClick={[Function]}
|
|
769
769
|
>
|
|
770
770
|
<span
|
|
@@ -856,7 +856,7 @@ exports[`TimePicker { selectedHour: undefined, selectedMinute: 0 } 1`] = `
|
|
|
856
856
|
>
|
|
857
857
|
<div
|
|
858
858
|
className="emotion-2"
|
|
859
|
-
data-
|
|
859
|
+
data-test-id="hour-label"
|
|
860
860
|
onClick={[Function]}
|
|
861
861
|
>
|
|
862
862
|
<span
|
|
@@ -895,7 +895,7 @@ exports[`TimePicker { selectedHour: undefined, selectedMinute: 0 } 1`] = `
|
|
|
895
895
|
>
|
|
896
896
|
<div
|
|
897
897
|
className="emotion-2"
|
|
898
|
-
data-
|
|
898
|
+
data-test-id="minute-label"
|
|
899
899
|
onClick={[Function]}
|
|
900
900
|
>
|
|
901
901
|
<span
|
|
@@ -987,7 +987,7 @@ exports[`TimePicker { selectedHour: undefined, selectedMinute: 15 } 1`] = `
|
|
|
987
987
|
>
|
|
988
988
|
<div
|
|
989
989
|
className="emotion-2"
|
|
990
|
-
data-
|
|
990
|
+
data-test-id="hour-label"
|
|
991
991
|
onClick={[Function]}
|
|
992
992
|
>
|
|
993
993
|
<span
|
|
@@ -1026,7 +1026,7 @@ exports[`TimePicker { selectedHour: undefined, selectedMinute: 15 } 1`] = `
|
|
|
1026
1026
|
>
|
|
1027
1027
|
<div
|
|
1028
1028
|
className="emotion-2"
|
|
1029
|
-
data-
|
|
1029
|
+
data-test-id="minute-label"
|
|
1030
1030
|
onClick={[Function]}
|
|
1031
1031
|
>
|
|
1032
1032
|
<span
|
|
@@ -1117,7 +1117,7 @@ exports[`TimePicker { selectedHour: undefined, selectedMinute: undefined } 1`] =
|
|
|
1117
1117
|
>
|
|
1118
1118
|
<div
|
|
1119
1119
|
className="emotion-2"
|
|
1120
|
-
data-
|
|
1120
|
+
data-test-id="hour-label"
|
|
1121
1121
|
onClick={[Function]}
|
|
1122
1122
|
>
|
|
1123
1123
|
<span
|
|
@@ -1156,7 +1156,7 @@ exports[`TimePicker { selectedHour: undefined, selectedMinute: undefined } 1`] =
|
|
|
1156
1156
|
>
|
|
1157
1157
|
<div
|
|
1158
1158
|
className="emotion-2"
|
|
1159
|
-
data-
|
|
1159
|
+
data-test-id="minute-label"
|
|
1160
1160
|
onClick={[Function]}
|
|
1161
1161
|
>
|
|
1162
1162
|
<span
|
|
@@ -22,13 +22,19 @@ describe("Calendar", () => {
|
|
|
22
22
|
selected={date}
|
|
23
23
|
/>
|
|
24
24
|
);
|
|
25
|
-
calendar
|
|
25
|
+
calendar
|
|
26
|
+
.find(".react-calendar__tile")
|
|
27
|
+
.at(0)
|
|
28
|
+
.simulate("click");
|
|
26
29
|
|
|
27
30
|
// in case of range selector onChange should only be called once
|
|
28
31
|
// both values of range have been selected.
|
|
29
32
|
expect(changeSpy.calledOnce).toBeFalsy();
|
|
30
33
|
|
|
31
|
-
calendar
|
|
34
|
+
calendar
|
|
35
|
+
.find(".react-calendar__tile")
|
|
36
|
+
.at(10)
|
|
37
|
+
.simulate("click");
|
|
32
38
|
|
|
33
39
|
calendar
|
|
34
40
|
.find(".calendar-test > div")
|
|
@@ -68,7 +74,10 @@ describe("Calendar", () => {
|
|
|
68
74
|
/>
|
|
69
75
|
);
|
|
70
76
|
|
|
71
|
-
calendar
|
|
77
|
+
calendar
|
|
78
|
+
.find(".react-calendar__tile")
|
|
79
|
+
.at(0)
|
|
80
|
+
.simulate("click");
|
|
72
81
|
|
|
73
82
|
calendar
|
|
74
83
|
.find(".calendar-test > div")
|
|
@@ -98,7 +107,10 @@ describe("Calendar", () => {
|
|
|
98
107
|
selected={date[0]}
|
|
99
108
|
/>
|
|
100
109
|
);
|
|
101
|
-
calendar
|
|
110
|
+
calendar
|
|
111
|
+
.find(".react-calendar__tile")
|
|
112
|
+
.at(0)
|
|
113
|
+
.simulate("click");
|
|
102
114
|
|
|
103
115
|
expect(changeSpy.calledOnce).toBeTruthy();
|
|
104
116
|
|
|
@@ -137,9 +149,15 @@ describe("Calendar", () => {
|
|
|
137
149
|
/>
|
|
138
150
|
);
|
|
139
151
|
|
|
140
|
-
calendar
|
|
152
|
+
calendar
|
|
153
|
+
.find(".react-calendar__tile")
|
|
154
|
+
.at(0)
|
|
155
|
+
.simulate("click");
|
|
141
156
|
|
|
142
|
-
calendar
|
|
157
|
+
calendar
|
|
158
|
+
.find(".react-calendar__tile")
|
|
159
|
+
.at(10)
|
|
160
|
+
.simulate("click");
|
|
143
161
|
|
|
144
162
|
calendar
|
|
145
163
|
.find(".calendar-test > div")
|
|
@@ -1,27 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Checkbox, CheckboxGroup } from "../";
|
|
3
3
|
import { mount } from "enzyme";
|
|
4
|
-
import renderer from "react-test-renderer";
|
|
5
4
|
import sinon from "sinon";
|
|
6
5
|
|
|
7
6
|
describe("CheckboxGroup", () => {
|
|
8
|
-
test("snapshot", () => {
|
|
9
|
-
const spy = sinon.spy();
|
|
10
|
-
const component = renderer.create(
|
|
11
|
-
<CheckboxGroup
|
|
12
|
-
selected={["checkbox-1"]}
|
|
13
|
-
onChange={spy}
|
|
14
|
-
name="test"
|
|
15
|
-
testId="checkbox-group"
|
|
16
|
-
>
|
|
17
|
-
<Checkbox value="checkbox-0" label="I am a checkbox" />
|
|
18
|
-
<Checkbox value="checkbox-1" label="I am a checkbox" />
|
|
19
|
-
</CheckboxGroup>
|
|
20
|
-
);
|
|
21
|
-
const tree = component.toJSON();
|
|
22
|
-
expect(tree).toMatchSnapshot();
|
|
23
|
-
});
|
|
24
|
-
|
|
25
7
|
test("should call onChange on click with correct arguments", () => {
|
|
26
8
|
const spy = sinon.spy();
|
|
27
9
|
|
|
@@ -32,7 +14,10 @@ describe("CheckboxGroup", () => {
|
|
|
32
14
|
</CheckboxGroup>
|
|
33
15
|
);
|
|
34
16
|
|
|
35
|
-
checkbox
|
|
17
|
+
checkbox
|
|
18
|
+
.find(Checkbox)
|
|
19
|
+
.at(1)
|
|
20
|
+
.simulate("click");
|
|
36
21
|
|
|
37
22
|
expect(spy.calledWith([])).toBeTruthy();
|
|
38
23
|
|
|
@@ -40,27 +25,11 @@ describe("CheckboxGroup", () => {
|
|
|
40
25
|
selected: []
|
|
41
26
|
});
|
|
42
27
|
|
|
43
|
-
checkbox
|
|
28
|
+
checkbox
|
|
29
|
+
.find(Checkbox)
|
|
30
|
+
.at(0)
|
|
31
|
+
.simulate("click");
|
|
44
32
|
|
|
45
33
|
expect(spy.calledWith(["checkbox-0"])).toBeTruthy();
|
|
46
34
|
});
|
|
47
|
-
|
|
48
|
-
test("should append checkbox test ids for children", () => {
|
|
49
|
-
const spy = sinon.spy();
|
|
50
|
-
|
|
51
|
-
const checkbox = mount(
|
|
52
|
-
<CheckboxGroup
|
|
53
|
-
selected={[]}
|
|
54
|
-
onChange={spy}
|
|
55
|
-
name="test"
|
|
56
|
-
testId="checkbox-group"
|
|
57
|
-
>
|
|
58
|
-
<Checkbox value="checkbox-0" label="I am a checkbox" />
|
|
59
|
-
<Checkbox value="checkbox-1" label="I am a checkbox" />
|
|
60
|
-
</CheckboxGroup>
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
expect(checkbox.find("[data-testid='checkbox-group-0']").length).toBe(1);
|
|
64
|
-
expect(checkbox.find("[data-testid='checkbox-group-1']").length).toBe(1);
|
|
65
|
-
});
|
|
66
35
|
});
|
|
@@ -9,7 +9,6 @@ import Button from "../Button";
|
|
|
9
9
|
import Input from "../Input";
|
|
10
10
|
import Search from "../Search";
|
|
11
11
|
import "../../../tests/__setup__/matchers";
|
|
12
|
-
import { getSelectInputTestIds } from "../../utils/testIds";
|
|
13
12
|
|
|
14
13
|
const options = new Array(5)
|
|
15
14
|
.fill(1)
|
|
@@ -19,9 +18,6 @@ const options = new Array(5)
|
|
|
19
18
|
|
|
20
19
|
const noop = () => {};
|
|
21
20
|
|
|
22
|
-
const SINGLE_SELECT_TEST_ID = "test-single-select";
|
|
23
|
-
const MULTI_SELECT_TEST_ID = "test-multi-select";
|
|
24
|
-
|
|
25
21
|
function getComponent(
|
|
26
22
|
spy = noop,
|
|
27
23
|
props: Partial<SingleSelectProps<string>> = {}
|
|
@@ -32,7 +28,6 @@ function getComponent(
|
|
|
32
28
|
placeholder="Choose Option"
|
|
33
29
|
selected={"option-2"}
|
|
34
30
|
{...props}
|
|
35
|
-
testId={SINGLE_SELECT_TEST_ID}
|
|
36
31
|
>
|
|
37
32
|
{options}
|
|
38
33
|
</Select>
|
|
@@ -49,7 +44,6 @@ function getMultiSelectComponent<T>(
|
|
|
49
44
|
placeholder="Choose Option"
|
|
50
45
|
multiSelect
|
|
51
46
|
{...props}
|
|
52
|
-
testId={MULTI_SELECT_TEST_ID}
|
|
53
47
|
>
|
|
54
48
|
{options}
|
|
55
49
|
</Select>
|
|
@@ -102,17 +96,18 @@ describe("Component: Select", () => {
|
|
|
102
96
|
const spy = sinon.spy();
|
|
103
97
|
const select = mount(getComponent(spy));
|
|
104
98
|
select.find(Input).simulate("click");
|
|
105
|
-
select
|
|
99
|
+
select
|
|
100
|
+
.find(Option)
|
|
101
|
+
.at(2)
|
|
102
|
+
.simulate("click");
|
|
106
103
|
|
|
107
104
|
expect(spy.calledWith("option-3")).toBeTruthy();
|
|
108
105
|
|
|
109
106
|
// wait for the dropdown animation to get over.
|
|
110
107
|
clock.tick(1000);
|
|
111
108
|
|
|
112
|
-
const { optionGroupId } = getSelectInputTestIds(SINGLE_SELECT_TEST_ID);
|
|
113
|
-
|
|
114
109
|
// This means that Option is no more rendered in DOM.
|
|
115
|
-
expect(select).toNotBeInDOM(
|
|
110
|
+
expect(select).toNotBeInDOM("[data-test-id='optiongroup']");
|
|
116
111
|
});
|
|
117
112
|
|
|
118
113
|
test("multi select: should trigger onChange with correct onChange", () => {
|
|
@@ -129,7 +124,10 @@ describe("Component: Select", () => {
|
|
|
129
124
|
})
|
|
130
125
|
);
|
|
131
126
|
select.find(Input).simulate("click");
|
|
132
|
-
select
|
|
127
|
+
select
|
|
128
|
+
.find(Option)
|
|
129
|
+
.at(2)
|
|
130
|
+
.simulate("click");
|
|
133
131
|
|
|
134
132
|
expect(spy.calledWith(["option-3"])).toBeTruthy();
|
|
135
133
|
|
|
@@ -137,7 +135,10 @@ describe("Component: Select", () => {
|
|
|
137
135
|
selected: ["option-3"]
|
|
138
136
|
});
|
|
139
137
|
|
|
140
|
-
select
|
|
138
|
+
select
|
|
139
|
+
.find(Option)
|
|
140
|
+
.at(3)
|
|
141
|
+
.simulate("click");
|
|
141
142
|
|
|
142
143
|
expect(spy.calledWith(["option-3", "option-4"])).toBeTruthy();
|
|
143
144
|
|
|
@@ -145,14 +146,20 @@ describe("Component: Select", () => {
|
|
|
145
146
|
selected: ["option-3", "option-4"]
|
|
146
147
|
});
|
|
147
148
|
|
|
148
|
-
select
|
|
149
|
+
select
|
|
150
|
+
.find(Option)
|
|
151
|
+
.at(2)
|
|
152
|
+
.simulate("click");
|
|
149
153
|
|
|
150
154
|
expect(spy.calledWith(["option-4"])).toBeTruthy();
|
|
151
155
|
|
|
152
156
|
expect(select.find(Button)).toHaveLength(2);
|
|
153
157
|
|
|
154
158
|
// test onClear
|
|
155
|
-
select
|
|
159
|
+
select
|
|
160
|
+
.find(Button)
|
|
161
|
+
.at(0)
|
|
162
|
+
.simulate("click");
|
|
156
163
|
expect(clearSpy.calledOnce).toBeTruthy();
|
|
157
164
|
|
|
158
165
|
// Reopen dropdown and test onApply
|
|
@@ -161,15 +168,16 @@ describe("Component: Select", () => {
|
|
|
161
168
|
selected: ["option-3"]
|
|
162
169
|
});
|
|
163
170
|
|
|
164
|
-
select
|
|
171
|
+
select
|
|
172
|
+
.find(Button)
|
|
173
|
+
.at(1)
|
|
174
|
+
.simulate("click");
|
|
165
175
|
expect(applySpy.calledWith(["option-3"])).toBeTruthy();
|
|
166
176
|
|
|
167
177
|
clock.tick(1000);
|
|
168
178
|
|
|
169
|
-
const { optionGroupId } = getSelectInputTestIds(MULTI_SELECT_TEST_ID, true);
|
|
170
|
-
|
|
171
179
|
// ensure the dropdown is closed
|
|
172
|
-
expect(select).toNotBeInDOM(
|
|
180
|
+
expect(select).toNotBeInDOM("[data-test-id='optiongroup']");
|
|
173
181
|
});
|
|
174
182
|
|
|
175
183
|
test("single select: query change triggers onChange", () => {
|
|
@@ -214,7 +222,10 @@ describe("Component: Select", () => {
|
|
|
214
222
|
);
|
|
215
223
|
select.find(Input).simulate("click");
|
|
216
224
|
|
|
217
|
-
select
|
|
225
|
+
select
|
|
226
|
+
.find(Search)
|
|
227
|
+
.find(".pi-close")
|
|
228
|
+
.simulate("click");
|
|
218
229
|
expect(clearQuerySpy.calledWith("")).toBeTruthy();
|
|
219
230
|
});
|
|
220
231
|
|
|
@@ -36,20 +36,30 @@ describe("TimePicker: functionality test", () => {
|
|
|
36
36
|
const timePicker = mount(
|
|
37
37
|
<TimePicker onHourChange={spyHour} onMinuteChange={spyMinute} />
|
|
38
38
|
);
|
|
39
|
-
timePicker.find("[data-
|
|
39
|
+
timePicker.find("[data-test-id='hour-label']").simulate("click");
|
|
40
40
|
|
|
41
41
|
clock.tick(10000);
|
|
42
42
|
|
|
43
|
-
timePicker
|
|
43
|
+
timePicker
|
|
44
|
+
.find(DropDown)
|
|
45
|
+
.at(0)
|
|
46
|
+
.find(Option)
|
|
47
|
+
.at(0)
|
|
48
|
+
.simulate("click");
|
|
44
49
|
|
|
45
50
|
expect(spyHour.calledOnce).toBeTruthy();
|
|
46
51
|
expect(spyHour.calledWith(1)).toBeTruthy();
|
|
47
52
|
|
|
48
|
-
timePicker.find("[data-
|
|
53
|
+
timePicker.find("[data-test-id='minute-label']").simulate("click");
|
|
49
54
|
|
|
50
55
|
clock.tick(10000);
|
|
51
56
|
|
|
52
|
-
timePicker
|
|
57
|
+
timePicker
|
|
58
|
+
.find(DropDown)
|
|
59
|
+
.at(1)
|
|
60
|
+
.find(Option)
|
|
61
|
+
.at(0)
|
|
62
|
+
.simulate("click");
|
|
53
63
|
|
|
54
64
|
expect(spyMinute.calledOnce).toBeTruthy();
|
|
55
65
|
expect(spyMinute.calledWith(0)).toBeTruthy();
|
|
@@ -13,8 +13,7 @@ function Control<OptionType>(props: ControlProps<OptionType>) {
|
|
|
13
13
|
children = ControlView,
|
|
14
14
|
type,
|
|
15
15
|
className,
|
|
16
|
-
indeterminate
|
|
17
|
-
testId
|
|
16
|
+
indeterminate
|
|
18
17
|
} = props;
|
|
19
18
|
return (
|
|
20
19
|
<div
|
|
@@ -31,7 +30,6 @@ function Control<OptionType>(props: ControlProps<OptionType>) {
|
|
|
31
30
|
onChange && onChange({ value, checked: !checked }, e)
|
|
32
31
|
: undefined
|
|
33
32
|
}
|
|
34
|
-
data-testid={testId}
|
|
35
33
|
>
|
|
36
34
|
{children(props)}
|
|
37
35
|
</div>
|
|
@@ -12,11 +12,6 @@ import {
|
|
|
12
12
|
searchBoxHeight
|
|
13
13
|
} from "../styles/OptionGroup.styles";
|
|
14
14
|
import { rowWrapper, advancedActionsWrapper } from "../styles/Options.styles";
|
|
15
|
-
import {
|
|
16
|
-
getOptionGroupTestIds,
|
|
17
|
-
getOptionTestId,
|
|
18
|
-
getTestIds
|
|
19
|
-
} from "../../utils/testIds";
|
|
20
15
|
|
|
21
16
|
class OptionGroup<OptionType> extends React.PureComponent<
|
|
22
17
|
OptionGroupProps<OptionType>,
|
|
@@ -126,13 +121,10 @@ class OptionGroup<OptionType> extends React.PureComponent<
|
|
|
126
121
|
className,
|
|
127
122
|
isSelected,
|
|
128
123
|
handleChange,
|
|
129
|
-
searchBoxProps
|
|
130
|
-
testId
|
|
124
|
+
searchBoxProps
|
|
131
125
|
} = this.props;
|
|
132
126
|
const { isScrolled, highlighted } = this.state;
|
|
133
127
|
|
|
134
|
-
const testIds = getTestIds(testId, getOptionGroupTestIds);
|
|
135
|
-
|
|
136
128
|
const _children = React.Children.map(children, (_option, i) => {
|
|
137
129
|
// `_option as React.ReactElement<OptionProps>` is a hack
|
|
138
130
|
// Because React does not allow us to specify what sort of elements
|
|
@@ -150,10 +142,7 @@ class OptionGroup<OptionType> extends React.PureComponent<
|
|
|
150
142
|
isSelected: isSelected(option.props.value),
|
|
151
143
|
multiSelect,
|
|
152
144
|
// @ts-ignore
|
|
153
|
-
ref
|
|
154
|
-
testId: testIds.optionId
|
|
155
|
-
? getOptionTestId(testIds.optionId, i)
|
|
156
|
-
: undefined
|
|
145
|
+
ref
|
|
157
146
|
});
|
|
158
147
|
});
|
|
159
148
|
|
|
@@ -179,7 +168,6 @@ class OptionGroup<OptionType> extends React.PureComponent<
|
|
|
179
168
|
onKeyDown: this.handleKeyPress,
|
|
180
169
|
autoFocus: true
|
|
181
170
|
}}
|
|
182
|
-
testId={testIds.searchBoxId}
|
|
183
171
|
/>
|
|
184
172
|
</div>
|
|
185
173
|
)}
|
|
@@ -191,21 +179,15 @@ class OptionGroup<OptionType> extends React.PureComponent<
|
|
|
191
179
|
}}
|
|
192
180
|
className={cx(optionsWrapper, className)}
|
|
193
181
|
role={multiSelect ? "group" : "radiogroup"}
|
|
194
|
-
data-
|
|
182
|
+
data-test-id="optiongroup"
|
|
195
183
|
aria-label={searchBoxProps && searchBoxProps.placeholder}
|
|
196
184
|
>
|
|
197
185
|
{advancedOptions && advancedOptionsProps && (
|
|
198
186
|
<div className={_class}>
|
|
199
|
-
<div
|
|
200
|
-
onClick={advancedOptionsProps.selectVisible}
|
|
201
|
-
data-testid={testIds.selectVisibleId}
|
|
202
|
-
>
|
|
187
|
+
<div onClick={advancedOptionsProps.selectVisible}>
|
|
203
188
|
Select Visible
|
|
204
189
|
</div>
|
|
205
|
-
<div
|
|
206
|
-
onClick={advancedOptionsProps.clearVisible}
|
|
207
|
-
data-testid={testIds.clearVisibleId}
|
|
208
|
-
>
|
|
190
|
+
<div onClick={advancedOptionsProps.clearVisible}>
|
|
209
191
|
Clear Visible
|
|
210
192
|
</div>
|
|
211
193
|
</div>
|