vueless 1.3.6-beta.1 → 1.3.6-beta.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vueless",
|
|
3
|
-
"version": "1.3.6-beta.
|
|
3
|
+
"version": "1.3.6-beta.2",
|
|
4
4
|
"description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
|
|
5
5
|
"author": "Johnny Grid <hello@vueless.com> (https://vueless.com)",
|
|
6
6
|
"homepage": "https://vueless.com",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@vue/eslint-config-typescript": "^14.6.0",
|
|
58
58
|
"@vue/test-utils": "^2.4.6",
|
|
59
59
|
"@vue/tsconfig": "^0.7.0",
|
|
60
|
-
"@vueless/storybook": "^1.3.
|
|
60
|
+
"@vueless/storybook": "^1.3.6",
|
|
61
61
|
"eslint": "^9.32.0",
|
|
62
62
|
"eslint-plugin-storybook": "^10.0.2",
|
|
63
63
|
"eslint-plugin-vue": "^10.3.0",
|
|
@@ -131,6 +131,31 @@ describe("UCalendar.vue", () => {
|
|
|
131
131
|
expect(rangeUpdate.to).not.toBeNull();
|
|
132
132
|
});
|
|
133
133
|
|
|
134
|
+
it("Range – allows selecting the same day for from and to", async () => {
|
|
135
|
+
const component = mount(UCalendar, {
|
|
136
|
+
props: {
|
|
137
|
+
range: true,
|
|
138
|
+
modelValue: { from: null, to: null },
|
|
139
|
+
dateFormat: "Y-m-d",
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
const dayView = component.findComponent(DayView);
|
|
144
|
+
const days = dayView.findAll('[vl-key="day"]');
|
|
145
|
+
|
|
146
|
+
await days[5].trigger("click");
|
|
147
|
+
await days[5].trigger("click");
|
|
148
|
+
|
|
149
|
+
expect(component.emitted("update:modelValue")).toBeTruthy();
|
|
150
|
+
expect(component.emitted("update:modelValue")).toHaveLength(2);
|
|
151
|
+
|
|
152
|
+
const rangeUpdate = component.emitted("update:modelValue")![1][0] as RangeDate;
|
|
153
|
+
|
|
154
|
+
expect(rangeUpdate.from).not.toBeNull();
|
|
155
|
+
expect(rangeUpdate.to).not.toBeNull();
|
|
156
|
+
expect(rangeUpdate.from).toBe(rangeUpdate.to);
|
|
157
|
+
});
|
|
158
|
+
|
|
134
159
|
it("Timepicker – shows timepicker when enabled", () => {
|
|
135
160
|
const component = mount(UCalendar, {
|
|
136
161
|
props: {
|
|
@@ -518,6 +543,94 @@ describe("UCalendar.vue", () => {
|
|
|
518
543
|
|
|
519
544
|
expect(component.emitted("userDateChange")).toBeTruthy();
|
|
520
545
|
});
|
|
546
|
+
|
|
547
|
+
it("ChangeRange – emits when first date is selected in range mode", async () => {
|
|
548
|
+
const component = mount(UCalendar, {
|
|
549
|
+
props: {
|
|
550
|
+
range: true,
|
|
551
|
+
modelValue: { from: null, to: null },
|
|
552
|
+
dateFormat: "Y-m-d",
|
|
553
|
+
},
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
const dayView = component.findComponent(DayView);
|
|
557
|
+
const days = dayView.findAll('[vl-key="day"]');
|
|
558
|
+
|
|
559
|
+
await days[0].trigger("click");
|
|
560
|
+
|
|
561
|
+
expect(component.emitted("change-range")).toBeTruthy();
|
|
562
|
+
expect(component.emitted("change-range")![0][0]).toHaveProperty("from");
|
|
563
|
+
expect(component.emitted("change-range")![0][0]).toHaveProperty("to");
|
|
564
|
+
});
|
|
565
|
+
|
|
566
|
+
it("ChangeRange – emits when both dates are selected in range mode", async () => {
|
|
567
|
+
const component = mount(UCalendar, {
|
|
568
|
+
props: {
|
|
569
|
+
range: true,
|
|
570
|
+
modelValue: { from: null, to: null },
|
|
571
|
+
dateFormat: "Y-m-d",
|
|
572
|
+
},
|
|
573
|
+
});
|
|
574
|
+
|
|
575
|
+
const dayView = component.findComponent(DayView);
|
|
576
|
+
const days = dayView.findAll('[vl-key="day"]');
|
|
577
|
+
|
|
578
|
+
await days[0].trigger("click");
|
|
579
|
+
await days[3].trigger("click");
|
|
580
|
+
|
|
581
|
+
const changeRangeEvents = component.emitted("change-range");
|
|
582
|
+
|
|
583
|
+
expect(changeRangeEvents).toBeTruthy();
|
|
584
|
+
expect(changeRangeEvents!.length).toBeGreaterThan(0);
|
|
585
|
+
|
|
586
|
+
const lastEvent = changeRangeEvents![changeRangeEvents!.length - 1][0] as RangeDate;
|
|
587
|
+
|
|
588
|
+
expect(lastEvent.from).not.toBeNull();
|
|
589
|
+
expect(lastEvent.to).not.toBeNull();
|
|
590
|
+
});
|
|
591
|
+
|
|
592
|
+
it("ChangeRange – emits when same date is selected twice in range mode", async () => {
|
|
593
|
+
const component = mount(UCalendar, {
|
|
594
|
+
props: {
|
|
595
|
+
range: true,
|
|
596
|
+
modelValue: { from: null, to: null },
|
|
597
|
+
dateFormat: "Y-m-d",
|
|
598
|
+
},
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
const dayView = component.findComponent(DayView);
|
|
602
|
+
const days = dayView.findAll('[vl-key="day"]');
|
|
603
|
+
|
|
604
|
+
await days[5].trigger("click");
|
|
605
|
+
await days[5].trigger("click");
|
|
606
|
+
|
|
607
|
+
const changeRangeEvents = component.emitted("change-range");
|
|
608
|
+
|
|
609
|
+
expect(changeRangeEvents).toBeTruthy();
|
|
610
|
+
|
|
611
|
+
const lastEvent = changeRangeEvents![changeRangeEvents!.length - 1][0] as RangeDate;
|
|
612
|
+
|
|
613
|
+
expect(lastEvent.from).not.toBeNull();
|
|
614
|
+
expect(lastEvent.to).not.toBeNull();
|
|
615
|
+
expect(lastEvent.from).toBe(lastEvent.to);
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
it("ChangeRange – does not emit when range mode is disabled", async () => {
|
|
619
|
+
const component = mount(UCalendar, {
|
|
620
|
+
props: {
|
|
621
|
+
range: false,
|
|
622
|
+
modelValue: null,
|
|
623
|
+
dateFormat: "Y-m-d",
|
|
624
|
+
},
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
const dayView = component.findComponent(DayView);
|
|
628
|
+
const day = dayView.find('[vl-key="day"]');
|
|
629
|
+
|
|
630
|
+
await day.trigger("click");
|
|
631
|
+
|
|
632
|
+
expect(component.emitted("change-range")).toBeFalsy();
|
|
633
|
+
});
|
|
521
634
|
});
|
|
522
635
|
|
|
523
636
|
describe("Exposed Properties", () => {
|
|
@@ -440,6 +440,37 @@ describe("UDatePickerRange.vue", () => {
|
|
|
440
440
|
|
|
441
441
|
expect(component.find("[vl-key='datepickerCalendar']").exists()).toBe(true);
|
|
442
442
|
});
|
|
443
|
+
|
|
444
|
+
it("Menu – allows selecting the same day for from and to in range mode", async () => {
|
|
445
|
+
const component = mount(UDatePickerRange, {
|
|
446
|
+
props: {
|
|
447
|
+
variant: "input",
|
|
448
|
+
modelValue: { from: null, to: null },
|
|
449
|
+
dateFormat: "Y-m-d",
|
|
450
|
+
"onUpdate:modelValue": (value: RangeDate) => {
|
|
451
|
+
component.setProps({ modelValue: value });
|
|
452
|
+
},
|
|
453
|
+
},
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
const input = component.findComponent(UInput).get("input");
|
|
457
|
+
|
|
458
|
+
await input.trigger("focus");
|
|
459
|
+
|
|
460
|
+
const days = component.findAll("[vl-key='day']");
|
|
461
|
+
|
|
462
|
+
await days[10].trigger("click");
|
|
463
|
+
await days[10].trigger("click");
|
|
464
|
+
|
|
465
|
+
expect(component.emitted("update:modelValue")).toBeTruthy();
|
|
466
|
+
|
|
467
|
+
const emittedValues = component.emitted("update:modelValue")!;
|
|
468
|
+
const lastEmittedValue = emittedValues[emittedValues.length - 1][0] as RangeDate;
|
|
469
|
+
|
|
470
|
+
expect(lastEmittedValue.from).not.toBeNull();
|
|
471
|
+
expect(lastEmittedValue.to).not.toBeNull();
|
|
472
|
+
expect(lastEmittedValue.from).toBe(lastEmittedValue.to);
|
|
473
|
+
});
|
|
443
474
|
});
|
|
444
475
|
|
|
445
476
|
describe("Range Navigation", () => {
|
|
@@ -554,6 +585,89 @@ describe("UDatePickerRange.vue", () => {
|
|
|
554
585
|
});
|
|
555
586
|
});
|
|
556
587
|
|
|
588
|
+
describe("Events", () => {
|
|
589
|
+
it("ChangeRange – handles change-range event from calendar when dates are selected", async () => {
|
|
590
|
+
const component = mount(UDatePickerRange, {
|
|
591
|
+
props: {
|
|
592
|
+
variant: "input",
|
|
593
|
+
modelValue: { from: null, to: null },
|
|
594
|
+
dateFormat: "Y-m-d",
|
|
595
|
+
"onUpdate:modelValue": (value: RangeDate) => {
|
|
596
|
+
component.setProps({ modelValue: value });
|
|
597
|
+
},
|
|
598
|
+
},
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
const input = component.findComponent(UInput).find("input");
|
|
602
|
+
|
|
603
|
+
await input.trigger("focus");
|
|
604
|
+
|
|
605
|
+
const days = component.findAll("[vl-key='day']");
|
|
606
|
+
|
|
607
|
+
expect(days.length).toBeGreaterThan(0);
|
|
608
|
+
|
|
609
|
+
await days[0].trigger("click");
|
|
610
|
+
await days[3].trigger("click");
|
|
611
|
+
|
|
612
|
+
expect(component.emitted("update:modelValue")).toBeTruthy();
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
it("ChangeRange – handles change-range event from calendar when both dates are selected", async () => {
|
|
616
|
+
const component = mount(UDatePickerRange, {
|
|
617
|
+
props: {
|
|
618
|
+
variant: "input",
|
|
619
|
+
modelValue: { from: null, to: null },
|
|
620
|
+
dateFormat: "Y-m-d",
|
|
621
|
+
"onUpdate:modelValue": (value: RangeDate) => {
|
|
622
|
+
component.setProps({ modelValue: value });
|
|
623
|
+
},
|
|
624
|
+
},
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
const input = component.findComponent(UInput).find("input");
|
|
628
|
+
|
|
629
|
+
await input.trigger("focus");
|
|
630
|
+
|
|
631
|
+
const days = component.findAll("[vl-key='day']");
|
|
632
|
+
|
|
633
|
+
await days[0].trigger("click");
|
|
634
|
+
await days[3].trigger("click");
|
|
635
|
+
|
|
636
|
+
expect(component.emitted("update:modelValue")).toBeTruthy();
|
|
637
|
+
});
|
|
638
|
+
|
|
639
|
+
it("ChangeRange – handles change-range event from calendar when same date is selected twice", async () => {
|
|
640
|
+
const component = mount(UDatePickerRange, {
|
|
641
|
+
props: {
|
|
642
|
+
variant: "input",
|
|
643
|
+
modelValue: { from: null, to: null },
|
|
644
|
+
dateFormat: "Y-m-d",
|
|
645
|
+
"onUpdate:modelValue": (value: RangeDate) => {
|
|
646
|
+
component.setProps({ modelValue: value });
|
|
647
|
+
},
|
|
648
|
+
},
|
|
649
|
+
});
|
|
650
|
+
|
|
651
|
+
const input = component.findComponent(UInput).find("input");
|
|
652
|
+
|
|
653
|
+
await input.trigger("focus");
|
|
654
|
+
|
|
655
|
+
const days = component.findAll("[vl-key='day']");
|
|
656
|
+
|
|
657
|
+
await days[10].trigger("click");
|
|
658
|
+
await days[10].trigger("click");
|
|
659
|
+
|
|
660
|
+
expect(component.emitted("update:modelValue")).toBeTruthy();
|
|
661
|
+
|
|
662
|
+
const emittedValues = component.emitted("update:modelValue")!;
|
|
663
|
+
const lastEmittedValue = emittedValues[emittedValues.length - 1][0] as RangeDate;
|
|
664
|
+
|
|
665
|
+
expect(lastEmittedValue.from).not.toBeNull();
|
|
666
|
+
expect(lastEmittedValue.to).not.toBeNull();
|
|
667
|
+
expect(lastEmittedValue.from).toBe(lastEmittedValue.to);
|
|
668
|
+
});
|
|
669
|
+
});
|
|
670
|
+
|
|
557
671
|
describe("Exposed Properties", () => {
|
|
558
672
|
it("Exposes wrapper element ref", () => {
|
|
559
673
|
const component = mount(UDatePickerRange, {
|