Skip to content

Commit 18aef58

Browse files
committed
poc editable date range input
1 parent 2febfa6 commit 18aef58

18 files changed

+1295
-508
lines changed

src/components/date-range-picker/date-range-input.ts

Lines changed: 442 additions & 0 deletions
Large diffs are not rendered by default.

src/components/date-range-picker/date-range-picker-single.form.spec.ts

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import {
88
runValidationContainerTests,
99
simulateClick,
1010
} from '../common/utils.spec.js';
11-
import IgcInputComponent from '../input/input.js';
11+
import type IgcDateRangeInputComponentComponent from './date-range-input.js';
12+
import IgcDateRangeInputComponent from './date-range-input.js';
1213
import IgcDateRangePickerComponent, {
1314
type DateRangeValue,
1415
} from './date-range-picker.js';
@@ -18,7 +19,7 @@ describe('Date Range Picker Single Input - Form integration', () => {
1819
before(() => defineComponents(IgcDateRangePickerComponent));
1920

2021
let picker: IgcDateRangePickerComponent;
21-
let input: IgcInputComponent;
22+
let input: IgcDateRangeInputComponentComponent;
2223
let startKey = '';
2324
let endKey = '';
2425

@@ -64,24 +65,26 @@ describe('Date Range Picker Single Input - Form integration', () => {
6465
await elementUpdated(spec.element);
6566

6667
input = picker.renderRoot.querySelector(
67-
IgcInputComponent.tagName
68-
) as IgcInputComponent;
68+
IgcDateRangeInputComponent.tagName
69+
) as IgcDateRangeInputComponent;
6970

7071
checkSelectedRange(spec.element, value, false);
7172

7273
spec.reset();
7374
await elementUpdated(spec.element);
7475

7576
expect(spec.element.value).to.deep.equal(initial);
76-
expect(input.value).to.equal('');
77+
expect(input.value).to.deep.equal({ start: null, end: null });
7778
});
7879

7980
it('should not be in invalid state on reset for a required control which previously had value', () => {
8081
spec.setProperties({ value: value });
8182
spec.setProperties({ required: true });
8283

8384
spec.assertSubmitPasses();
84-
const input = picker.renderRoot.querySelector(IgcInputComponent.tagName)!;
85+
const input = picker.renderRoot.querySelector(
86+
IgcDateRangeInputComponent.tagName
87+
)!;
8588
expect(input.invalid).to.be.false;
8689

8790
spec.setProperties({ value: null });
@@ -97,7 +100,7 @@ describe('Date Range Picker Single Input - Form integration', () => {
97100
spec.assertSubmitFails();
98101
await elementUpdated(spec.element);
99102
const input = spec.element.renderRoot.querySelector(
100-
IgcInputComponent.tagName
103+
IgcDateRangeInputComponent.tagName
101104
)!;
102105
expect(input.invalid).to.be.true;
103106

@@ -115,10 +118,10 @@ describe('Date Range Picker Single Input - Form integration', () => {
115118
await elementUpdated(spec.element);
116119

117120
input = spec.element.renderRoot.querySelector(
118-
IgcInputComponent.tagName
119-
) as IgcInputComponent;
121+
IgcDateRangeInputComponent.tagName
122+
) as IgcDateRangeInputComponent;
120123

121-
expect(input.value).to.equal('');
124+
expect(input.value).to.deep.equal({ start: null, end: null });
122125

123126
spec.reset();
124127
await elementUpdated(spec.element);
@@ -143,7 +146,7 @@ describe('Date Range Picker Single Input - Form integration', () => {
143146
spec.assertSubmitFails();
144147
await elementUpdated(spec.element);
145148
const input = spec.element.renderRoot.querySelector(
146-
IgcInputComponent.tagName
149+
IgcDateRangeInputComponent.tagName
147150
)!;
148151
expect(input.invalid).to.be.true;
149152

@@ -159,7 +162,7 @@ describe('Date Range Picker Single Input - Form integration', () => {
159162
spec.assertSubmitPasses();
160163
await elementUpdated(spec.element);
161164
const input = spec.element.renderRoot.querySelector(
162-
IgcInputComponent.tagName
165+
IgcDateRangeInputComponent.tagName
163166
)!;
164167
expect(input.invalid).to.be.false;
165168

@@ -202,7 +205,7 @@ describe('Date Range Picker Single Input - Form integration', () => {
202205
spec.assertSubmitPasses();
203206
await elementUpdated(spec.element);
204207
const input = spec.element.renderRoot.querySelector(
205-
IgcInputComponent.tagName
208+
IgcDateRangeInputComponent.tagName
206209
)!;
207210
expect(input.invalid).to.be.false;
208211

@@ -243,7 +246,7 @@ describe('Date Range Picker Single Input - Form integration', () => {
243246
spec.assertSubmitPasses();
244247
await elementUpdated(spec.element);
245248
const input = spec.element.renderRoot.querySelector(
246-
IgcInputComponent.tagName
249+
IgcDateRangeInputComponent.tagName
247250
)!;
248251
expect(input.invalid).to.be.false;
249252

@@ -276,7 +279,7 @@ describe('Date Range Picker Single Input - Form integration', () => {
276279
spec.assertSubmitPasses();
277280
await elementUpdated(spec.element);
278281
const input = spec.element.renderRoot.querySelector(
279-
IgcInputComponent.tagName
282+
IgcDateRangeInputComponent.tagName
280283
)!;
281284
expect(input.invalid).to.be.false;
282285

@@ -318,7 +321,7 @@ describe('Date Range Picker Single Input - Form integration', () => {
318321
spec.assertSubmitFails();
319322
await elementUpdated(spec.element);
320323
const input = spec.element.renderRoot.querySelector(
321-
IgcInputComponent.tagName
324+
IgcDateRangeInputComponent.tagName
322325
)!;
323326
expect(input.invalid).to.be.true;
324327

@@ -378,7 +381,7 @@ describe('Date Range Picker Single Input - Form integration', () => {
378381
spec.assertSubmitFails();
379382
await elementUpdated(spec.element);
380383
const input = spec.element.renderRoot.querySelector(
381-
IgcInputComponent.tagName
384+
IgcDateRangeInputComponent.tagName
382385
)!;
383386
expect(input.invalid).to.be.true;
384387

@@ -411,8 +414,8 @@ describe('Date Range Picker Single Input - Form integration', () => {
411414
html`<igc-date-range-picker required></igc-date-range-picker>`
412415
);
413416
const input = picker.renderRoot.querySelector(
414-
IgcInputComponent.tagName
415-
) as IgcInputComponent;
417+
IgcDateRangeInputComponent.tagName
418+
) as IgcDateRangeInputComponent;
416419

417420
expect(picker.invalid).to.be.false;
418421
expect(input.invalid).to.be.false;

0 commit comments

Comments
 (0)