@ionic/core 7.5.6-dev.11700520259.172f33bb → 7.5.6-dev.11701102039.134ebc28
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/components/icon.js +17 -25
- package/components/index7.js +1 -1
- package/components/ion-datetime.js +2 -15
- package/dist/cjs/{index-6b8be5a4.js → index-5ea49600.js} +1 -1
- package/dist/cjs/ion-accordion_2.cjs.entry.js +1 -1
- package/dist/cjs/ion-back-button.cjs.entry.js +1 -1
- package/dist/cjs/ion-breadcrumb_2.cjs.entry.js +1 -1
- package/dist/cjs/ion-button_2.cjs.entry.js +17 -25
- package/dist/cjs/ion-datetime_3.cjs.entry.js +3 -16
- package/dist/cjs/ion-fab_3.cjs.entry.js +1 -1
- package/dist/cjs/ion-input.cjs.entry.js +1 -1
- package/dist/cjs/ion-item_8.cjs.entry.js +1 -1
- package/dist/cjs/ion-menu_3.cjs.entry.js +1 -1
- package/dist/cjs/ion-refresher_2.cjs.entry.js +1 -1
- package/dist/cjs/ion-reorder_2.cjs.entry.js +1 -1
- package/dist/cjs/ion-searchbar.cjs.entry.js +1 -1
- package/dist/cjs/ion-select_3.cjs.entry.js +1 -1
- package/dist/cjs/ion-toggle.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +4 -4
- package/dist/collection/components/datetime/datetime.js +2 -15
- package/dist/docs.json +21 -21
- package/dist/esm/{index-5d8e6a4f.js → index-d1a56aed.js} +1 -1
- package/dist/esm/ion-accordion_2.entry.js +1 -1
- package/dist/esm/ion-back-button.entry.js +1 -1
- package/dist/esm/ion-breadcrumb_2.entry.js +1 -1
- package/dist/esm/ion-button_2.entry.js +17 -25
- package/dist/esm/ion-datetime_3.entry.js +3 -16
- package/dist/esm/ion-fab_3.entry.js +1 -1
- package/dist/esm/ion-input.entry.js +1 -1
- package/dist/esm/ion-item_8.entry.js +1 -1
- package/dist/esm/ion-menu_3.entry.js +1 -1
- package/dist/esm/ion-refresher_2.entry.js +1 -1
- package/dist/esm/ion-reorder_2.entry.js +1 -1
- package/dist/esm/ion-searchbar.entry.js +1 -1
- package/dist/esm/ion-select_3.entry.js +1 -1
- package/dist/esm/ion-toggle.entry.js +1 -1
- package/dist/esm-es5/ion-accordion_2.entry.js +1 -1
- package/dist/esm-es5/ion-back-button.entry.js +1 -1
- package/dist/esm-es5/ion-breadcrumb_2.entry.js +1 -1
- package/dist/esm-es5/ion-button_2.entry.js +1 -1
- package/dist/esm-es5/ion-datetime_3.entry.js +1 -1
- package/dist/esm-es5/ion-fab_3.entry.js +1 -1
- package/dist/esm-es5/ion-input.entry.js +1 -1
- package/dist/esm-es5/ion-item_8.entry.js +1 -1
- package/dist/esm-es5/ion-menu_3.entry.js +1 -1
- package/dist/esm-es5/ion-refresher_2.entry.js +1 -1
- package/dist/esm-es5/ion-reorder_2.entry.js +1 -1
- package/dist/esm-es5/ion-searchbar.entry.js +1 -1
- package/dist/esm-es5/ion-select_3.entry.js +1 -1
- package/dist/esm-es5/ion-toggle.entry.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/{p-8dc8c0b7.entry.js → p-04dca48d.entry.js} +1 -1
- package/dist/ionic/{p-85f8bc31.entry.js → p-0838e6bb.entry.js} +1 -1
- package/dist/ionic/{p-68d27845.system.entry.js → p-14923cd7.system.entry.js} +1 -1
- package/dist/ionic/{p-1f21e106.system.entry.js → p-19a7c660.system.entry.js} +1 -1
- package/dist/ionic/{p-1070ed59.entry.js → p-29adc040.entry.js} +1 -1
- package/dist/ionic/p-40903d34.system.js +1 -1
- package/dist/ionic/{p-edeb2f05.system.entry.js → p-42435018.system.entry.js} +1 -1
- package/dist/ionic/{p-52138a68.entry.js → p-431151f2.entry.js} +1 -1
- package/dist/ionic/p-47c2e0a5.entry.js +4 -0
- package/dist/ionic/{p-3f4fdd67.system.entry.js → p-4d786d1f.system.entry.js} +1 -1
- package/dist/ionic/{p-bb20a3fb.entry.js → p-52360c7a.entry.js} +1 -1
- package/dist/ionic/{p-1f011033.system.entry.js → p-61c30156.system.entry.js} +1 -1
- package/dist/ionic/{p-a94bed6d.system.entry.js → p-640efee6.system.entry.js} +1 -1
- package/dist/ionic/{p-9437dac6.system.entry.js → p-6594d76a.system.entry.js} +1 -1
- package/dist/ionic/{p-73ab9076.entry.js → p-68166ba6.entry.js} +1 -1
- package/dist/ionic/{p-324226bf.system.entry.js → p-7b4cd5fc.system.entry.js} +1 -1
- package/dist/ionic/{p-d4bd82e9.system.entry.js → p-7d7fdaf0.system.entry.js} +1 -1
- package/dist/ionic/p-8659f9a9.system.entry.js +4 -0
- package/dist/ionic/{p-ace47557.entry.js → p-899fb2da.entry.js} +1 -1
- package/dist/ionic/{p-413e5a56.entry.js → p-8cbf0979.entry.js} +1 -1
- package/dist/ionic/{p-d50f9c4b.entry.js → p-8d5a30dd.entry.js} +1 -1
- package/dist/ionic/{p-dc527a33.entry.js → p-97a96f5f.entry.js} +1 -1
- package/dist/ionic/p-a3cbbb36.system.entry.js +4 -0
- package/dist/ionic/{p-3101643f.entry.js → p-a43603ce.entry.js} +1 -1
- package/dist/ionic/{p-459dd2a9.entry.js → p-bd76524d.entry.js} +1 -1
- package/dist/ionic/{p-cb9c77e7.system.entry.js → p-c429a314.system.entry.js} +1 -1
- package/dist/ionic/{p-54aba2a6.system.entry.js → p-cd2808f5.system.entry.js} +1 -1
- package/dist/ionic/{p-5b885cc5.system.entry.js → p-dbf7d6e5.system.entry.js} +1 -1
- package/dist/ionic/{p-af83378e.entry.js → p-ee2469c1.entry.js} +1 -1
- package/dist/node_modules/ionicons/dist/collection/components/icon/icon.css +1 -0
- package/hydrate/index.js +17 -26
- package/package.json +3 -4
- package/dist/collection/components/accordion/test/accordion.spec.js +0 -195
- package/dist/collection/components/action-sheet/test/action-sheet-id.spec.js +0 -32
- package/dist/collection/components/action-sheet/test/basic/action-sheet.spec.js +0 -18
- package/dist/collection/components/alert/test/alert-id.spec.js +0 -32
- package/dist/collection/components/alert/test/alert.spec.js +0 -37
- package/dist/collection/components/back-button/test/back-button.spec.js +0 -86
- package/dist/collection/components/breadcrumb/test/aria.spec.js +0 -22
- package/dist/collection/components/breadcrumbs/test/breadcrumbs.spec.js +0 -58
- package/dist/collection/components/button/test/form-reference/button.spec.js +0 -26
- package/dist/collection/components/card/test/aria.spec.js +0 -16
- package/dist/collection/components/checkbox/test/checkbox.spec.js +0 -20
- package/dist/collection/components/datetime/test/a11y/datetime.spec.js +0 -43
- package/dist/collection/components/datetime/test/comparison.spec.js +0 -43
- package/dist/collection/components/datetime/test/data.spec.js +0 -456
- package/dist/collection/components/datetime/test/format.spec.js +0 -124
- package/dist/collection/components/datetime/test/helpers.spec.js +0 -72
- package/dist/collection/components/datetime/test/manipulation.spec.js +0 -433
- package/dist/collection/components/datetime/test/parse.spec.js +0 -222
- package/dist/collection/components/datetime/test/state.spec.js +0 -114
- package/dist/collection/components/infinite-scroll-content/test/infinite-scroll-content.spec.js +0 -37
- package/dist/collection/components/input/test/input.spec.js +0 -85
- package/dist/collection/components/input/test/item/input.spec.js +0 -24
- package/dist/collection/components/item/test/a11y/item.spec.js +0 -48
- package/dist/collection/components/loading/test/basic/loading.spec.js +0 -16
- package/dist/collection/components/loading/test/loading-id.spec.js +0 -32
- package/dist/collection/components/loading/test/loading.spec.js +0 -37
- package/dist/collection/components/modal/test/a11y/modal.spec.js +0 -22
- package/dist/collection/components/modal/test/basic/modal.spec.js +0 -16
- package/dist/collection/components/modal/test/can-dismiss/modal.spec.js +0 -191
- package/dist/collection/components/modal/test/modal-id.spec.js +0 -32
- package/dist/collection/components/nav/test/nav-controller.spec.js +0 -749
- package/dist/collection/components/picker/test/picker-id.spec.js +0 -32
- package/dist/collection/components/picker-column/test/picker-column-aria.spec.js +0 -35
- package/dist/collection/components/picker-column/test/picker-column-dynamic.spec.js +0 -29
- package/dist/collection/components/picker-column/test/picker-column.spec.js +0 -17
- package/dist/collection/components/popover/test/basic/popover.spec.js +0 -16
- package/dist/collection/components/popover/test/popover-id.spec.js +0 -32
- package/dist/collection/components/popover/test/util.spec.js +0 -53
- package/dist/collection/components/radio/test/radio.spec.js +0 -46
- package/dist/collection/components/range/test/label/range.spec.js +0 -23
- package/dist/collection/components/range/test/range.spec.js +0 -205
- package/dist/collection/components/refresher-content/test/refresher-content.spec.js +0 -46
- package/dist/collection/components/router/test/matching.spec.js +0 -250
- package/dist/collection/components/router/test/parser.spec.js +0 -133
- package/dist/collection/components/router/test/path.spec.js +0 -218
- package/dist/collection/components/router/test/router.spec.js +0 -55
- package/dist/collection/components/searchbar/test/searchbar.spec.js +0 -15
- package/dist/collection/components/segment/test/segment.spec.js +0 -37
- package/dist/collection/components/select/test/select.spec.js +0 -59
- package/dist/collection/components/textarea/test/textarea.spec.js +0 -59
- package/dist/collection/components/toast/test/toast-id.spec.js +0 -32
- package/dist/collection/components/toast/test/toast.spec.js +0 -120
- package/dist/collection/components/toggle/test/toggle.spec.js +0 -55
- package/dist/collection/global/test/config-controller.spec.js +0 -77
- package/dist/collection/utils/animation/test/animation.spec.js +0 -431
- package/dist/collection/utils/keyboard/test/keyboard-controller.spec.js +0 -21
- package/dist/collection/utils/keyboard/test/keyboard.spec.js +0 -214
- package/dist/collection/utils/sanitization/test/sanitization.spec.js +0 -43
- package/dist/collection/utils/test/aria.spec.js +0 -79
- package/dist/collection/utils/test/attributes.spec.js +0 -53
- package/dist/collection/utils/test/hardware-back-button.spec.js +0 -53
- package/dist/collection/utils/test/overlays/overlays.spec.js +0 -102
- package/dist/collection/utils/test/platform.spec.js +0 -132
- package/dist/collection/utils/test/ready.spec.js +0 -39
- package/dist/collection/utils/test/theme.spec.js +0 -56
- package/dist/ionic/p-178fa84b.system.entry.js +0 -4
- package/dist/ionic/p-3cd4001e.system.entry.js +0 -4
- package/dist/ionic/p-7821df39.entry.js +0 -4
- /package/dist/esm-es5/{index-5d8e6a4f.js → index-d1a56aed.js} +0 -0
- /package/dist/ionic/{p-6856db55.js → p-6e383534.js} +0 -0
- /package/dist/ionic/{p-a2e89e43.system.js → p-84c6dece.system.js} +0 -0
|
@@ -1,433 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
|
-
*/
|
|
4
|
-
import { getPreviousYear, getNextYear, getPreviousMonth, getNextMonth, getPreviousDay, getNextDay, getPreviousWeek, getNextWeek, getEndOfWeek, getStartOfWeek, convert12HourTo24Hour, getInternalHourValue, calculateHourFromAMPM, subtractDays, addDays, validateParts, } from "../utils/manipulation";
|
|
5
|
-
describe('addDays()', () => {
|
|
6
|
-
it('should correctly add days', () => {
|
|
7
|
-
expect(addDays({
|
|
8
|
-
day: 1,
|
|
9
|
-
month: 1,
|
|
10
|
-
year: 2021,
|
|
11
|
-
}, 31)).toEqual({
|
|
12
|
-
day: 1,
|
|
13
|
-
month: 2,
|
|
14
|
-
year: 2021,
|
|
15
|
-
});
|
|
16
|
-
expect(addDays({
|
|
17
|
-
day: 31,
|
|
18
|
-
month: 12,
|
|
19
|
-
year: 2021,
|
|
20
|
-
}, 1)).toEqual({
|
|
21
|
-
day: 1,
|
|
22
|
-
month: 1,
|
|
23
|
-
year: 2022,
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
describe('subtractDays()', () => {
|
|
28
|
-
it('should correctly subtract days', () => {
|
|
29
|
-
expect(subtractDays({
|
|
30
|
-
day: 1,
|
|
31
|
-
month: 1,
|
|
32
|
-
year: 2021,
|
|
33
|
-
}, 1)).toEqual({
|
|
34
|
-
day: 31,
|
|
35
|
-
month: 12,
|
|
36
|
-
year: 2020,
|
|
37
|
-
});
|
|
38
|
-
expect(subtractDays({
|
|
39
|
-
day: 1,
|
|
40
|
-
month: 2,
|
|
41
|
-
year: 2021,
|
|
42
|
-
}, 31)).toEqual({
|
|
43
|
-
day: 1,
|
|
44
|
-
month: 1,
|
|
45
|
-
year: 2021,
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
describe('getInternalHourValue()', () => {
|
|
50
|
-
it('should correctly get the internal hour value', () => {
|
|
51
|
-
expect(getInternalHourValue(12, true)).toEqual(12);
|
|
52
|
-
expect(getInternalHourValue(12, true)).toEqual(12);
|
|
53
|
-
expect(getInternalHourValue(12, false, 'am')).toEqual(0);
|
|
54
|
-
expect(getInternalHourValue(12, false, 'pm')).toEqual(12);
|
|
55
|
-
expect(getInternalHourValue(1, true)).toEqual(1);
|
|
56
|
-
expect(getInternalHourValue(1, true)).toEqual(1);
|
|
57
|
-
expect(getInternalHourValue(1, false, 'am')).toEqual(1);
|
|
58
|
-
expect(getInternalHourValue(1, false, 'pm')).toEqual(13);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
describe('calculateHourFromAMPM()', () => {
|
|
62
|
-
it('should correctly convert from AM to PM', () => {
|
|
63
|
-
expect(calculateHourFromAMPM({ hour: 12, ampm: 'am' }, 'pm')).toEqual(12);
|
|
64
|
-
expect(calculateHourFromAMPM({ hour: 1, ampm: 'am' }, 'pm')).toEqual(13);
|
|
65
|
-
expect(calculateHourFromAMPM({ hour: 2, ampm: 'am' }, 'pm')).toEqual(14);
|
|
66
|
-
expect(calculateHourFromAMPM({ hour: 3, ampm: 'am' }, 'pm')).toEqual(15);
|
|
67
|
-
expect(calculateHourFromAMPM({ hour: 4, ampm: 'am' }, 'pm')).toEqual(16);
|
|
68
|
-
expect(calculateHourFromAMPM({ hour: 5, ampm: 'am' }, 'pm')).toEqual(17);
|
|
69
|
-
expect(calculateHourFromAMPM({ hour: 6, ampm: 'am' }, 'pm')).toEqual(18);
|
|
70
|
-
expect(calculateHourFromAMPM({ hour: 7, ampm: 'am' }, 'pm')).toEqual(19);
|
|
71
|
-
expect(calculateHourFromAMPM({ hour: 8, ampm: 'am' }, 'pm')).toEqual(20);
|
|
72
|
-
expect(calculateHourFromAMPM({ hour: 9, ampm: 'am' }, 'pm')).toEqual(21);
|
|
73
|
-
expect(calculateHourFromAMPM({ hour: 10, ampm: 'am' }, 'pm')).toEqual(22);
|
|
74
|
-
expect(calculateHourFromAMPM({ hour: 11, ampm: 'am' }, 'pm')).toEqual(23);
|
|
75
|
-
expect(calculateHourFromAMPM({ hour: 13, ampm: 'pm' }, 'am')).toEqual(1);
|
|
76
|
-
expect(calculateHourFromAMPM({ hour: 14, ampm: 'pm' }, 'am')).toEqual(2);
|
|
77
|
-
expect(calculateHourFromAMPM({ hour: 15, ampm: 'pm' }, 'am')).toEqual(3);
|
|
78
|
-
expect(calculateHourFromAMPM({ hour: 16, ampm: 'pm' }, 'am')).toEqual(4);
|
|
79
|
-
expect(calculateHourFromAMPM({ hour: 17, ampm: 'pm' }, 'am')).toEqual(5);
|
|
80
|
-
expect(calculateHourFromAMPM({ hour: 18, ampm: 'pm' }, 'am')).toEqual(6);
|
|
81
|
-
expect(calculateHourFromAMPM({ hour: 19, ampm: 'pm' }, 'am')).toEqual(7);
|
|
82
|
-
expect(calculateHourFromAMPM({ hour: 20, ampm: 'pm' }, 'am')).toEqual(8);
|
|
83
|
-
expect(calculateHourFromAMPM({ hour: 21, ampm: 'pm' }, 'am')).toEqual(9);
|
|
84
|
-
expect(calculateHourFromAMPM({ hour: 22, ampm: 'pm' }, 'am')).toEqual(10);
|
|
85
|
-
expect(calculateHourFromAMPM({ hour: 23, ampm: 'pm' }, 'am')).toEqual(11);
|
|
86
|
-
expect(calculateHourFromAMPM({ hour: 0, ampm: 'pm' }, 'am')).toEqual(12);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
describe('convert12HourTo24Hour()', () => {
|
|
90
|
-
it('should correctly convert 12 hour to 24 hour', () => {
|
|
91
|
-
expect(convert12HourTo24Hour(12, 'am')).toEqual(0);
|
|
92
|
-
expect(convert12HourTo24Hour(1, 'am')).toEqual(1);
|
|
93
|
-
expect(convert12HourTo24Hour(2, 'am')).toEqual(2);
|
|
94
|
-
expect(convert12HourTo24Hour(3, 'am')).toEqual(3);
|
|
95
|
-
expect(convert12HourTo24Hour(4, 'am')).toEqual(4);
|
|
96
|
-
expect(convert12HourTo24Hour(5, 'am')).toEqual(5);
|
|
97
|
-
expect(convert12HourTo24Hour(6, 'am')).toEqual(6);
|
|
98
|
-
expect(convert12HourTo24Hour(7, 'am')).toEqual(7);
|
|
99
|
-
expect(convert12HourTo24Hour(8, 'am')).toEqual(8);
|
|
100
|
-
expect(convert12HourTo24Hour(9, 'am')).toEqual(9);
|
|
101
|
-
expect(convert12HourTo24Hour(10, 'am')).toEqual(10);
|
|
102
|
-
expect(convert12HourTo24Hour(11, 'am')).toEqual(11);
|
|
103
|
-
expect(convert12HourTo24Hour(12, 'pm')).toEqual(12);
|
|
104
|
-
expect(convert12HourTo24Hour(1, 'pm')).toEqual(13);
|
|
105
|
-
expect(convert12HourTo24Hour(2, 'pm')).toEqual(14);
|
|
106
|
-
expect(convert12HourTo24Hour(3, 'pm')).toEqual(15);
|
|
107
|
-
expect(convert12HourTo24Hour(4, 'pm')).toEqual(16);
|
|
108
|
-
expect(convert12HourTo24Hour(5, 'pm')).toEqual(17);
|
|
109
|
-
expect(convert12HourTo24Hour(6, 'pm')).toEqual(18);
|
|
110
|
-
expect(convert12HourTo24Hour(7, 'pm')).toEqual(19);
|
|
111
|
-
expect(convert12HourTo24Hour(8, 'pm')).toEqual(20);
|
|
112
|
-
expect(convert12HourTo24Hour(9, 'pm')).toEqual(21);
|
|
113
|
-
expect(convert12HourTo24Hour(10, 'pm')).toEqual(22);
|
|
114
|
-
expect(convert12HourTo24Hour(11, 'pm')).toEqual(23);
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
describe('getStartOfWeek()', () => {
|
|
118
|
-
it('should correctly return the start of the week', () => {
|
|
119
|
-
expect(getStartOfWeek({
|
|
120
|
-
month: 5,
|
|
121
|
-
day: 17,
|
|
122
|
-
year: 2021,
|
|
123
|
-
dayOfWeek: 1,
|
|
124
|
-
})).toEqual({
|
|
125
|
-
month: 5,
|
|
126
|
-
day: 16,
|
|
127
|
-
year: 2021,
|
|
128
|
-
});
|
|
129
|
-
expect(getStartOfWeek({
|
|
130
|
-
month: 5,
|
|
131
|
-
day: 1,
|
|
132
|
-
year: 2021,
|
|
133
|
-
dayOfWeek: 6,
|
|
134
|
-
})).toEqual({
|
|
135
|
-
month: 4,
|
|
136
|
-
day: 25,
|
|
137
|
-
year: 2021,
|
|
138
|
-
});
|
|
139
|
-
expect(getStartOfWeek({
|
|
140
|
-
month: 1,
|
|
141
|
-
day: 2,
|
|
142
|
-
year: 2021,
|
|
143
|
-
dayOfWeek: 6,
|
|
144
|
-
})).toEqual({
|
|
145
|
-
month: 12,
|
|
146
|
-
day: 27,
|
|
147
|
-
year: 2020,
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
describe('getEndOfWeek()', () => {
|
|
152
|
-
it('should correctly return the end of the week', () => {
|
|
153
|
-
expect(getEndOfWeek({
|
|
154
|
-
month: 5,
|
|
155
|
-
day: 17,
|
|
156
|
-
year: 2021,
|
|
157
|
-
dayOfWeek: 1,
|
|
158
|
-
})).toEqual({
|
|
159
|
-
month: 5,
|
|
160
|
-
day: 22,
|
|
161
|
-
year: 2021,
|
|
162
|
-
});
|
|
163
|
-
expect(getEndOfWeek({
|
|
164
|
-
month: 5,
|
|
165
|
-
day: 31,
|
|
166
|
-
year: 2021,
|
|
167
|
-
dayOfWeek: 1,
|
|
168
|
-
})).toEqual({
|
|
169
|
-
month: 6,
|
|
170
|
-
day: 5,
|
|
171
|
-
year: 2021,
|
|
172
|
-
});
|
|
173
|
-
expect(getEndOfWeek({
|
|
174
|
-
month: 12,
|
|
175
|
-
day: 29,
|
|
176
|
-
year: 2021,
|
|
177
|
-
dayOfWeek: 3,
|
|
178
|
-
})).toEqual({
|
|
179
|
-
month: 1,
|
|
180
|
-
day: 1,
|
|
181
|
-
year: 2022,
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
describe('getNextWeek()', () => {
|
|
186
|
-
it('should correctly return the next week', () => {
|
|
187
|
-
expect(getNextWeek({
|
|
188
|
-
month: 5,
|
|
189
|
-
day: 17,
|
|
190
|
-
year: 2021,
|
|
191
|
-
})).toEqual({
|
|
192
|
-
month: 5,
|
|
193
|
-
day: 24,
|
|
194
|
-
year: 2021,
|
|
195
|
-
});
|
|
196
|
-
expect(getNextWeek({
|
|
197
|
-
month: 5,
|
|
198
|
-
day: 31,
|
|
199
|
-
year: 2021,
|
|
200
|
-
})).toEqual({
|
|
201
|
-
month: 6,
|
|
202
|
-
day: 7,
|
|
203
|
-
year: 2021,
|
|
204
|
-
});
|
|
205
|
-
expect(getNextWeek({
|
|
206
|
-
month: 12,
|
|
207
|
-
day: 29,
|
|
208
|
-
year: 2021,
|
|
209
|
-
})).toEqual({
|
|
210
|
-
month: 1,
|
|
211
|
-
day: 5,
|
|
212
|
-
year: 2022,
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
describe('getPreviousWeek()', () => {
|
|
217
|
-
it('should correctly return the previous week', () => {
|
|
218
|
-
expect(getPreviousWeek({
|
|
219
|
-
month: 5,
|
|
220
|
-
day: 17,
|
|
221
|
-
year: 2021,
|
|
222
|
-
})).toEqual({
|
|
223
|
-
month: 5,
|
|
224
|
-
day: 10,
|
|
225
|
-
year: 2021,
|
|
226
|
-
});
|
|
227
|
-
expect(getPreviousWeek({
|
|
228
|
-
month: 5,
|
|
229
|
-
day: 1,
|
|
230
|
-
year: 2021,
|
|
231
|
-
})).toEqual({
|
|
232
|
-
month: 4,
|
|
233
|
-
day: 24,
|
|
234
|
-
year: 2021,
|
|
235
|
-
});
|
|
236
|
-
expect(getPreviousWeek({
|
|
237
|
-
month: 1,
|
|
238
|
-
day: 4,
|
|
239
|
-
year: 2021,
|
|
240
|
-
})).toEqual({
|
|
241
|
-
month: 12,
|
|
242
|
-
day: 28,
|
|
243
|
-
year: 2020,
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
describe('getNextDay()', () => {
|
|
248
|
-
it('should correctly return the next day', () => {
|
|
249
|
-
expect(getNextDay({
|
|
250
|
-
month: 5,
|
|
251
|
-
day: 17,
|
|
252
|
-
year: 2021,
|
|
253
|
-
})).toEqual({
|
|
254
|
-
month: 5,
|
|
255
|
-
day: 18,
|
|
256
|
-
year: 2021,
|
|
257
|
-
});
|
|
258
|
-
expect(getNextDay({
|
|
259
|
-
month: 5,
|
|
260
|
-
day: 31,
|
|
261
|
-
year: 2021,
|
|
262
|
-
})).toEqual({
|
|
263
|
-
month: 6,
|
|
264
|
-
day: 1,
|
|
265
|
-
year: 2021,
|
|
266
|
-
});
|
|
267
|
-
expect(getNextDay({
|
|
268
|
-
month: 12,
|
|
269
|
-
day: 31,
|
|
270
|
-
year: 2021,
|
|
271
|
-
})).toEqual({
|
|
272
|
-
month: 1,
|
|
273
|
-
day: 1,
|
|
274
|
-
year: 2022,
|
|
275
|
-
});
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
describe('getPreviousDay()', () => {
|
|
279
|
-
it('should correctly return the previous day', () => {
|
|
280
|
-
expect(getPreviousDay({
|
|
281
|
-
month: 5,
|
|
282
|
-
day: 17,
|
|
283
|
-
year: 2021,
|
|
284
|
-
})).toEqual({
|
|
285
|
-
month: 5,
|
|
286
|
-
day: 16,
|
|
287
|
-
year: 2021,
|
|
288
|
-
});
|
|
289
|
-
expect(getPreviousDay({
|
|
290
|
-
month: 5,
|
|
291
|
-
day: 1,
|
|
292
|
-
year: 2021,
|
|
293
|
-
})).toEqual({
|
|
294
|
-
month: 4,
|
|
295
|
-
day: 30,
|
|
296
|
-
year: 2021,
|
|
297
|
-
});
|
|
298
|
-
expect(getPreviousDay({
|
|
299
|
-
month: 1,
|
|
300
|
-
day: 1,
|
|
301
|
-
year: 2021,
|
|
302
|
-
})).toEqual({
|
|
303
|
-
month: 12,
|
|
304
|
-
day: 31,
|
|
305
|
-
year: 2020,
|
|
306
|
-
});
|
|
307
|
-
});
|
|
308
|
-
});
|
|
309
|
-
describe('getNextMonth()', () => {
|
|
310
|
-
it('should return correct next month', () => {
|
|
311
|
-
expect(getNextMonth({ month: 5, year: 2021, day: 1 })).toEqual({
|
|
312
|
-
month: 6,
|
|
313
|
-
year: 2021,
|
|
314
|
-
day: 1,
|
|
315
|
-
});
|
|
316
|
-
expect(getNextMonth({ month: 12, year: 2021, day: 30 })).toEqual({
|
|
317
|
-
month: 1,
|
|
318
|
-
year: 2022,
|
|
319
|
-
day: 30,
|
|
320
|
-
});
|
|
321
|
-
expect(getNextMonth({ month: 12, year: 1999, day: 30 })).toEqual({
|
|
322
|
-
month: 1,
|
|
323
|
-
year: 2000,
|
|
324
|
-
day: 30,
|
|
325
|
-
});
|
|
326
|
-
});
|
|
327
|
-
});
|
|
328
|
-
describe('getPreviousMonth()', () => {
|
|
329
|
-
it('should return correct previous month', () => {
|
|
330
|
-
expect(getPreviousMonth({ month: 5, year: 2021, day: 1 })).toEqual({
|
|
331
|
-
month: 4,
|
|
332
|
-
year: 2021,
|
|
333
|
-
day: 1,
|
|
334
|
-
});
|
|
335
|
-
expect(getPreviousMonth({ month: 1, year: 2021, day: 30 })).toEqual({
|
|
336
|
-
month: 12,
|
|
337
|
-
year: 2020,
|
|
338
|
-
day: 30,
|
|
339
|
-
});
|
|
340
|
-
expect(getPreviousMonth({ month: 1, year: 2000, day: 30 })).toEqual({
|
|
341
|
-
month: 12,
|
|
342
|
-
year: 1999,
|
|
343
|
-
day: 30,
|
|
344
|
-
});
|
|
345
|
-
});
|
|
346
|
-
});
|
|
347
|
-
describe('getNextYear()', () => {
|
|
348
|
-
it('should return correct next year', () => {
|
|
349
|
-
expect(getNextYear({ month: 5, year: 2021, day: 1 })).toEqual({
|
|
350
|
-
month: 5,
|
|
351
|
-
year: 2022,
|
|
352
|
-
day: 1,
|
|
353
|
-
});
|
|
354
|
-
expect(getNextYear({ month: 12, year: 1999, day: 30 })).toEqual({
|
|
355
|
-
month: 12,
|
|
356
|
-
year: 2000,
|
|
357
|
-
day: 30,
|
|
358
|
-
});
|
|
359
|
-
// Leap year
|
|
360
|
-
expect(getNextYear({ month: 2, year: 2024, day: 29 })).toEqual({
|
|
361
|
-
month: 2,
|
|
362
|
-
year: 2025,
|
|
363
|
-
day: 28,
|
|
364
|
-
});
|
|
365
|
-
});
|
|
366
|
-
});
|
|
367
|
-
describe('getPreviousYear()', () => {
|
|
368
|
-
it('should return correct next year', () => {
|
|
369
|
-
expect(getPreviousYear({ month: 5, year: 2021, day: 1 })).toEqual({
|
|
370
|
-
month: 5,
|
|
371
|
-
year: 2020,
|
|
372
|
-
day: 1,
|
|
373
|
-
});
|
|
374
|
-
expect(getPreviousYear({ month: 12, year: 1999, day: 30 })).toEqual({
|
|
375
|
-
month: 12,
|
|
376
|
-
year: 1998,
|
|
377
|
-
day: 30,
|
|
378
|
-
});
|
|
379
|
-
// Leap year
|
|
380
|
-
expect(getPreviousYear({ month: 2, year: 2024, day: 29 })).toEqual({
|
|
381
|
-
month: 2,
|
|
382
|
-
year: 2023,
|
|
383
|
-
day: 28,
|
|
384
|
-
});
|
|
385
|
-
});
|
|
386
|
-
});
|
|
387
|
-
describe('validateParts()', () => {
|
|
388
|
-
it('should move day in bounds', () => {
|
|
389
|
-
expect(validateParts({ month: 2, day: 31, year: 2022, hour: 8, minute: 0 })).toEqual({
|
|
390
|
-
month: 2,
|
|
391
|
-
day: 28,
|
|
392
|
-
year: 2022,
|
|
393
|
-
hour: 8,
|
|
394
|
-
minute: 0,
|
|
395
|
-
});
|
|
396
|
-
});
|
|
397
|
-
it('should move the hour back in bounds according to the min', () => {
|
|
398
|
-
expect(validateParts({ month: 1, day: 1, year: 2022, hour: 8, minute: 0 }, { month: 1, day: 1, year: 2022, hour: 9, minute: 0 })).toEqual({ month: 1, day: 1, year: 2022, hour: 9, minute: 0 });
|
|
399
|
-
});
|
|
400
|
-
it('should move the minute back in bounds according to the min', () => {
|
|
401
|
-
expect(validateParts({ month: 1, day: 1, year: 2022, hour: 9, minute: 20 }, { month: 1, day: 1, year: 2022, hour: 9, minute: 30 })).toEqual({ month: 1, day: 1, year: 2022, hour: 9, minute: 30 });
|
|
402
|
-
});
|
|
403
|
-
it('should move the hour and minute back in bounds according to the min', () => {
|
|
404
|
-
expect(validateParts({ month: 1, day: 1, year: 2022, hour: 8, minute: 30 }, { month: 1, day: 1, year: 2022, hour: 9, minute: 0 })).toEqual({ month: 1, day: 1, year: 2022, hour: 9, minute: 0 });
|
|
405
|
-
});
|
|
406
|
-
it('should move the hour back in bounds according to the max', () => {
|
|
407
|
-
expect(validateParts({ month: 1, day: 1, year: 2022, hour: 10, minute: 0 }, undefined, {
|
|
408
|
-
month: 1,
|
|
409
|
-
day: 1,
|
|
410
|
-
year: 2022,
|
|
411
|
-
hour: 9,
|
|
412
|
-
minute: 0,
|
|
413
|
-
})).toEqual({ month: 1, day: 1, year: 2022, hour: 9, minute: 0 });
|
|
414
|
-
});
|
|
415
|
-
it('should move the minute back in bounds according to the max', () => {
|
|
416
|
-
expect(validateParts({ month: 1, day: 1, year: 2022, hour: 9, minute: 40 }, undefined, {
|
|
417
|
-
month: 1,
|
|
418
|
-
day: 1,
|
|
419
|
-
year: 2022,
|
|
420
|
-
hour: 9,
|
|
421
|
-
minute: 30,
|
|
422
|
-
})).toEqual({ month: 1, day: 1, year: 2022, hour: 9, minute: 30 });
|
|
423
|
-
});
|
|
424
|
-
it('should move the hour and minute back in bounds according to the max', () => {
|
|
425
|
-
expect(validateParts({ month: 1, day: 1, year: 2022, hour: 10, minute: 20 }, undefined, {
|
|
426
|
-
month: 1,
|
|
427
|
-
day: 1,
|
|
428
|
-
year: 2022,
|
|
429
|
-
hour: 9,
|
|
430
|
-
minute: 30,
|
|
431
|
-
})).toEqual({ month: 1, day: 1, year: 2022, hour: 9, minute: 30 });
|
|
432
|
-
});
|
|
433
|
-
});
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
|
-
*/
|
|
4
|
-
import { clampDate, getPartsFromCalendarDay, parseAmPm, parseDate, parseMinParts, parseMaxParts } from "../utils/parse";
|
|
5
|
-
describe('getPartsFromCalendarDay()', () => {
|
|
6
|
-
it('should extract DatetimeParts from a calendar day element', () => {
|
|
7
|
-
const div = document.createElement('div');
|
|
8
|
-
div.setAttribute('data-month', '4');
|
|
9
|
-
div.setAttribute('data-day', '15');
|
|
10
|
-
div.setAttribute('data-year', '2010');
|
|
11
|
-
div.setAttribute('data-day-of-week', '5');
|
|
12
|
-
expect(getPartsFromCalendarDay(div)).toEqual({
|
|
13
|
-
day: 15,
|
|
14
|
-
month: 4,
|
|
15
|
-
year: 2010,
|
|
16
|
-
dayOfWeek: 5,
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
describe('parseDate()', () => {
|
|
21
|
-
it('should return undefined when passed undefined', () => {
|
|
22
|
-
expect(parseDate(undefined)).toStrictEqual(undefined);
|
|
23
|
-
});
|
|
24
|
-
it('should return undefined when passed null', () => {
|
|
25
|
-
expect(parseDate(null)).toStrictEqual(undefined);
|
|
26
|
-
});
|
|
27
|
-
it('should return the correct date object when passed a date', () => {
|
|
28
|
-
expect(parseDate('2022-12-15T13:47')).toEqual({
|
|
29
|
-
ampm: 'pm',
|
|
30
|
-
day: 15,
|
|
31
|
-
hour: 13,
|
|
32
|
-
minute: 47,
|
|
33
|
-
month: 12,
|
|
34
|
-
year: 2022,
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
/**
|
|
38
|
-
* Note: As Ionic v7 datetime no longer parses time zone information/
|
|
39
|
-
* See https://github.com/ionic-team/ionic-framework/commit/3fb4caf21ffac12f765c4c80bf1850e05d211c6a
|
|
40
|
-
*/
|
|
41
|
-
it('should return the correct time zone offset', () => {
|
|
42
|
-
var _a;
|
|
43
|
-
// Casting as any since `tzOffset` does not exist on DatetimeParts
|
|
44
|
-
expect((_a = parseDate('2022-12-15T13:47:30-02:00')) === null || _a === void 0 ? void 0 : _a.tzOffset).toEqual(undefined);
|
|
45
|
-
});
|
|
46
|
-
it('should parse an array of dates', () => {
|
|
47
|
-
expect(parseDate(['2022-12-15T13:47', '2023-03-23T20:19:33.517Z'])).toEqual([
|
|
48
|
-
{
|
|
49
|
-
ampm: 'pm',
|
|
50
|
-
day: 15,
|
|
51
|
-
hour: 13,
|
|
52
|
-
minute: 47,
|
|
53
|
-
month: 12,
|
|
54
|
-
year: 2022,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
ampm: 'pm',
|
|
58
|
-
day: 23,
|
|
59
|
-
hour: 20,
|
|
60
|
-
minute: 19,
|
|
61
|
-
month: 3,
|
|
62
|
-
year: 2023,
|
|
63
|
-
},
|
|
64
|
-
]);
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
describe('clampDate()', () => {
|
|
68
|
-
const minParts = {
|
|
69
|
-
year: 2021,
|
|
70
|
-
month: 6,
|
|
71
|
-
day: 5,
|
|
72
|
-
};
|
|
73
|
-
const maxParts = {
|
|
74
|
-
year: 2021,
|
|
75
|
-
month: 8,
|
|
76
|
-
day: 19,
|
|
77
|
-
};
|
|
78
|
-
it('should return the max month when the value is greater than the max', () => {
|
|
79
|
-
const dateParts = {
|
|
80
|
-
year: 2022,
|
|
81
|
-
month: 5,
|
|
82
|
-
day: 24,
|
|
83
|
-
};
|
|
84
|
-
const value = clampDate(dateParts, minParts, maxParts);
|
|
85
|
-
expect(value).toStrictEqual(maxParts);
|
|
86
|
-
});
|
|
87
|
-
it('should return the min month when the value is less than the min', () => {
|
|
88
|
-
const dateParts = {
|
|
89
|
-
year: 2020,
|
|
90
|
-
month: 5,
|
|
91
|
-
day: 24,
|
|
92
|
-
};
|
|
93
|
-
const value = clampDate(dateParts, minParts, maxParts);
|
|
94
|
-
expect(value).toStrictEqual(minParts);
|
|
95
|
-
});
|
|
96
|
-
it('should return the value when the value is greater than the min and less than the max', () => {
|
|
97
|
-
const dateParts = {
|
|
98
|
-
year: 2021,
|
|
99
|
-
month: 7,
|
|
100
|
-
day: 10,
|
|
101
|
-
};
|
|
102
|
-
const value = clampDate(dateParts, minParts, maxParts);
|
|
103
|
-
expect(value).toStrictEqual(dateParts);
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
describe('parseAmPm()', () => {
|
|
107
|
-
it('should return pm when the hour is greater than or equal to 12', () => {
|
|
108
|
-
expect(parseAmPm(12)).toEqual('pm');
|
|
109
|
-
expect(parseAmPm(13)).toEqual('pm');
|
|
110
|
-
});
|
|
111
|
-
it('should return am when the hour is less than 12', () => {
|
|
112
|
-
expect(parseAmPm(11)).toEqual('am');
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
describe('parseMinParts()', () => {
|
|
116
|
-
it('should fill in missing information when not provided', () => {
|
|
117
|
-
const today = {
|
|
118
|
-
day: 14,
|
|
119
|
-
month: 3,
|
|
120
|
-
year: 2022,
|
|
121
|
-
minute: 4,
|
|
122
|
-
hour: 2,
|
|
123
|
-
};
|
|
124
|
-
expect(parseMinParts('2012', today)).toEqual({
|
|
125
|
-
month: 1,
|
|
126
|
-
day: 1,
|
|
127
|
-
year: 2012,
|
|
128
|
-
hour: 0,
|
|
129
|
-
minute: 0,
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
it('should default to current year when only given HH:mm', () => {
|
|
133
|
-
const today = {
|
|
134
|
-
day: 14,
|
|
135
|
-
month: 3,
|
|
136
|
-
year: 2022,
|
|
137
|
-
minute: 4,
|
|
138
|
-
hour: 2,
|
|
139
|
-
};
|
|
140
|
-
expect(parseMinParts('04:30', today)).toEqual({
|
|
141
|
-
month: 1,
|
|
142
|
-
day: 1,
|
|
143
|
-
year: 2022,
|
|
144
|
-
hour: 4,
|
|
145
|
-
minute: 30,
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
it('should return undefined when given invalid info', () => {
|
|
149
|
-
const today = {
|
|
150
|
-
day: 14,
|
|
151
|
-
month: 3,
|
|
152
|
-
year: 2022,
|
|
153
|
-
minute: 4,
|
|
154
|
-
hour: 2,
|
|
155
|
-
};
|
|
156
|
-
expect(parseMinParts(undefined, today)).toEqual(undefined);
|
|
157
|
-
expect(parseMinParts(null, today)).toEqual(undefined);
|
|
158
|
-
expect(parseMinParts('foo', today)).toEqual(undefined);
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
describe('parseMaxParts()', () => {
|
|
162
|
-
it('should fill in missing information when not provided', () => {
|
|
163
|
-
const today = {
|
|
164
|
-
day: 14,
|
|
165
|
-
month: 3,
|
|
166
|
-
year: 2022,
|
|
167
|
-
minute: 4,
|
|
168
|
-
hour: 2,
|
|
169
|
-
};
|
|
170
|
-
expect(parseMaxParts('2012', today)).toEqual({
|
|
171
|
-
month: 12,
|
|
172
|
-
day: 31,
|
|
173
|
-
year: 2012,
|
|
174
|
-
hour: 23,
|
|
175
|
-
minute: 59,
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
it('should default to current year when only given HH:mm', () => {
|
|
179
|
-
const today = {
|
|
180
|
-
day: 14,
|
|
181
|
-
month: 3,
|
|
182
|
-
year: 2022,
|
|
183
|
-
minute: 4,
|
|
184
|
-
hour: 2,
|
|
185
|
-
};
|
|
186
|
-
expect(parseMaxParts('04:30', today)).toEqual({
|
|
187
|
-
month: 12,
|
|
188
|
-
day: 31,
|
|
189
|
-
year: 2022,
|
|
190
|
-
hour: 4,
|
|
191
|
-
minute: 30,
|
|
192
|
-
});
|
|
193
|
-
});
|
|
194
|
-
it('should fill in correct day during a leap year', () => {
|
|
195
|
-
const today = {
|
|
196
|
-
day: 14,
|
|
197
|
-
month: 3,
|
|
198
|
-
year: 2022,
|
|
199
|
-
minute: 4,
|
|
200
|
-
hour: 2,
|
|
201
|
-
};
|
|
202
|
-
expect(parseMaxParts('2012-02', today)).toEqual({
|
|
203
|
-
month: 2,
|
|
204
|
-
day: 29,
|
|
205
|
-
year: 2012,
|
|
206
|
-
hour: 23,
|
|
207
|
-
minute: 59,
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
it('should return undefined when given invalid info', () => {
|
|
211
|
-
const today = {
|
|
212
|
-
day: 14,
|
|
213
|
-
month: 3,
|
|
214
|
-
year: 2022,
|
|
215
|
-
minute: 4,
|
|
216
|
-
hour: 2,
|
|
217
|
-
};
|
|
218
|
-
expect(parseMaxParts(undefined, today)).toEqual(undefined);
|
|
219
|
-
expect(parseMaxParts(null, today)).toEqual(undefined);
|
|
220
|
-
expect(parseMaxParts('foo', today)).toEqual(undefined);
|
|
221
|
-
});
|
|
222
|
-
});
|