vueless 1.4.6 → 1.4.7
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/icons/internal/home.svg +1 -0
- package/icons/storybook/keep.svg +1 -0
- package/package.json +1 -1
- package/ui.form-checkbox/UCheckbox.vue +8 -0
- package/ui.form-checkbox/tests/UCheckbox.test.ts +18 -0
- package/ui.form-checkbox-group/UCheckboxGroup.vue +8 -0
- package/ui.form-checkbox-group/tests/UCheckboxGroup.test.ts +18 -0
- package/ui.form-date-picker/UDatePicker.vue +8 -0
- package/ui.form-date-picker/tests/UDatePicker.test.ts +19 -0
- package/ui.form-date-picker-range/UDatePickerRange.vue +8 -0
- package/ui.form-date-picker-range/tests/UDatePickerRange.test.ts +20 -0
- package/ui.form-input/UInput.vue +8 -0
- package/ui.form-input/tests/UInput.test.ts +18 -0
- package/ui.form-input-file/UInputFile.vue +8 -0
- package/ui.form-input-file/tests/UInputFile.test.ts +18 -0
- package/ui.form-input-number/UInputNumber.vue +8 -0
- package/ui.form-input-number/tests/UInputNumber.test.ts +18 -0
- package/ui.form-input-password/UInputPassword.vue +8 -0
- package/ui.form-input-password/tests/UInputPassword.test.ts +18 -0
- package/ui.form-input-search/UInputSearch.vue +8 -0
- package/ui.form-input-search/tests/UInputSearch.test.ts +18 -0
- package/ui.form-label/ULabel.vue +30 -14
- package/ui.form-label/tests/ULabel.test.ts +19 -0
- package/ui.form-radio/URadio.vue +8 -0
- package/ui.form-radio/tests/URadio.test.ts +18 -0
- package/ui.form-radio-group/URadioGroup.vue +8 -0
- package/ui.form-radio-group/tests/URadioGroup.test.ts +19 -0
- package/ui.form-select/USelect.vue +8 -0
- package/ui.form-select/tests/USelect.test.ts +19 -0
- package/ui.form-textarea/UTextarea.vue +8 -0
- package/ui.form-textarea/tests/UTextarea.test.ts +18 -0
package/icons/internal/home.svg
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="M222.15-182.15h143.78v-251.92h228.14v251.92h143.78v-386.89L480-762.37 222.15-568.96v386.81Zm-68.13 68.13v-489.09L480-847.65l326.22 244.54v489.09H528.57v-254.55h-97.14v254.55H154.02ZM480-472.76Z"/></svg>
|
package/icons/storybook/keep.svg
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 -960 960 960"><path d="m640.22-454.22 86 77v68.37H514.07v240.28L480-34.5l-34.07-34.07v-240.28H234.02v-68.37l80-77v-327.45h-50v-68.13h426.2v68.13h-50v327.45Zm-313.96 77h301.48l-55.89-51.89v-352.56h-189.7v352.56l-55.89 51.89Zm150.74 0Z"/></svg>
|
package/package.json
CHANGED
|
@@ -173,6 +173,14 @@ const {
|
|
|
173
173
|
<slot name="description" :description="description" />
|
|
174
174
|
</template>
|
|
175
175
|
|
|
176
|
+
<template #error>
|
|
177
|
+
<!--
|
|
178
|
+
@slot Use this to add custom content instead of the error message.
|
|
179
|
+
@binding {string | boolean} error
|
|
180
|
+
-->
|
|
181
|
+
<slot name="error" :error="error" />
|
|
182
|
+
</template>
|
|
183
|
+
|
|
176
184
|
<input
|
|
177
185
|
:id="elementId"
|
|
178
186
|
type="checkbox"
|
|
@@ -302,6 +302,24 @@ describe("UCheckbox.vue", () => {
|
|
|
302
302
|
expect(descriptionElement.text()).toBe(customDescription);
|
|
303
303
|
});
|
|
304
304
|
|
|
305
|
+
it("Error – renders custom content from error slot", () => {
|
|
306
|
+
const customError = "Custom error content";
|
|
307
|
+
|
|
308
|
+
const component = mount(UCheckbox, {
|
|
309
|
+
props: {
|
|
310
|
+
error: "Default error message",
|
|
311
|
+
},
|
|
312
|
+
slots: {
|
|
313
|
+
error: customError,
|
|
314
|
+
},
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
const labelComponent = component.getComponent(ULabel);
|
|
318
|
+
const errorElement = labelComponent.find("[vl-child-key='error']");
|
|
319
|
+
|
|
320
|
+
expect(errorElement.text()).toBe(customError);
|
|
321
|
+
});
|
|
322
|
+
|
|
305
323
|
it("Bottom – renders custom content from bottom slot", () => {
|
|
306
324
|
const customBottomContent = "Custom Bottom Content";
|
|
307
325
|
|
|
@@ -104,6 +104,14 @@ const { getDataTest, groupLabelAttrs, groupCheckboxAttrs, listAttrs } =
|
|
|
104
104
|
<slot name="description" :description="description" />
|
|
105
105
|
</template>
|
|
106
106
|
|
|
107
|
+
<template #error>
|
|
108
|
+
<!--
|
|
109
|
+
@slot Use this to add custom content instead of the error message.
|
|
110
|
+
@binding {string | boolean} error
|
|
111
|
+
-->
|
|
112
|
+
<slot name="error" :error="error" />
|
|
113
|
+
</template>
|
|
114
|
+
|
|
107
115
|
<div ref="list" v-bind="listAttrs">
|
|
108
116
|
<!-- @slot Use it to add UCheckbox directly. -->
|
|
109
117
|
<slot>
|
|
@@ -307,6 +307,24 @@ describe("UCheckboxGroup.vue", () => {
|
|
|
307
307
|
expect(descriptionElement.text()).toBe(customDescription);
|
|
308
308
|
});
|
|
309
309
|
|
|
310
|
+
it("Error – renders custom content from error slot", () => {
|
|
311
|
+
const customError = "Custom error content";
|
|
312
|
+
|
|
313
|
+
const component = mount(UCheckboxGroup, {
|
|
314
|
+
props: {
|
|
315
|
+
error: "Default error message",
|
|
316
|
+
},
|
|
317
|
+
slots: {
|
|
318
|
+
error: customError,
|
|
319
|
+
},
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
const labelComponent = component.getComponent(ULabel);
|
|
323
|
+
const errorElement = labelComponent.find("[vl-child-key='error']");
|
|
324
|
+
|
|
325
|
+
expect(errorElement.text()).toBe(customError);
|
|
326
|
+
});
|
|
327
|
+
|
|
310
328
|
it("Default slot – renders custom UCheckbox components", () => {
|
|
311
329
|
const component = mount(UCheckboxGroup, {
|
|
312
330
|
props: {
|
|
@@ -312,6 +312,14 @@ watchEffect(() => {
|
|
|
312
312
|
<slot name="description" :description="description" />
|
|
313
313
|
</template>
|
|
314
314
|
|
|
315
|
+
<template #error>
|
|
316
|
+
<!--
|
|
317
|
+
@slot Use this to add custom content instead of the error message.
|
|
318
|
+
@binding {string | boolean} error
|
|
319
|
+
-->
|
|
320
|
+
<slot name="error" :error="error" />
|
|
321
|
+
</template>
|
|
322
|
+
|
|
315
323
|
<template #left="{ iconName }">
|
|
316
324
|
<!--
|
|
317
325
|
@slot Use it add something before the date.
|
|
@@ -496,6 +496,25 @@ describe("UDatePicker.vue", () => {
|
|
|
496
496
|
|
|
497
497
|
expect(descriptionElement.text()).toBe(customDescription);
|
|
498
498
|
});
|
|
499
|
+
|
|
500
|
+
it("Error – renders custom content from error slot", () => {
|
|
501
|
+
const customError = "Custom error content";
|
|
502
|
+
|
|
503
|
+
const component = mount(UDatePicker, {
|
|
504
|
+
props: {
|
|
505
|
+
modelValue: new Date(),
|
|
506
|
+
error: "Default error message",
|
|
507
|
+
},
|
|
508
|
+
slots: {
|
|
509
|
+
error: customError,
|
|
510
|
+
},
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
const labelComponent = component.getComponent(UInput).getComponent(ULabel);
|
|
514
|
+
const errorElement = labelComponent.find("[vl-child-key='error']");
|
|
515
|
+
|
|
516
|
+
expect(errorElement.text()).toBe(customError);
|
|
517
|
+
});
|
|
499
518
|
});
|
|
500
519
|
|
|
501
520
|
describe("Exposed Properties", () => {
|
|
@@ -647,6 +647,14 @@ watchEffect(() => {
|
|
|
647
647
|
<slot name="description" :description="description" />
|
|
648
648
|
</template>
|
|
649
649
|
|
|
650
|
+
<template #error>
|
|
651
|
+
<!--
|
|
652
|
+
@slot Use this to add custom content instead of the error message.
|
|
653
|
+
@binding {string | boolean} error
|
|
654
|
+
-->
|
|
655
|
+
<slot name="error" :error="error" />
|
|
656
|
+
</template>
|
|
657
|
+
|
|
650
658
|
<template #left="{ iconName }">
|
|
651
659
|
<!--
|
|
652
660
|
@slot Use it to add something before the date.
|
|
@@ -604,6 +604,26 @@ describe("UDatePickerRange.vue", () => {
|
|
|
604
604
|
|
|
605
605
|
expect(descriptionElement.text()).toBe(customDescription);
|
|
606
606
|
});
|
|
607
|
+
|
|
608
|
+
it("Error – renders custom content from error slot", () => {
|
|
609
|
+
const customError = "Custom error content";
|
|
610
|
+
|
|
611
|
+
const component = mount(UDatePickerRange, {
|
|
612
|
+
props: {
|
|
613
|
+
variant: "input",
|
|
614
|
+
modelValue: { from: null, to: null },
|
|
615
|
+
error: "Default error message",
|
|
616
|
+
},
|
|
617
|
+
slots: {
|
|
618
|
+
error: customError,
|
|
619
|
+
},
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
const labelComponent = component.getComponent(UInput).getComponent(ULabel);
|
|
623
|
+
const errorElement = labelComponent.find("[vl-child-key='error']");
|
|
624
|
+
|
|
625
|
+
expect(errorElement.text()).toBe(customError);
|
|
626
|
+
});
|
|
607
627
|
});
|
|
608
628
|
|
|
609
629
|
describe("Events", () => {
|
package/ui.form-input/UInput.vue
CHANGED
|
@@ -298,6 +298,14 @@ const {
|
|
|
298
298
|
<slot name="description" :description="description" />
|
|
299
299
|
</template>
|
|
300
300
|
|
|
301
|
+
<template #error>
|
|
302
|
+
<!--
|
|
303
|
+
@slot Use this to add custom content instead of the error message.
|
|
304
|
+
@binding {string | boolean} error
|
|
305
|
+
-->
|
|
306
|
+
<slot name="error" :error="error" />
|
|
307
|
+
</template>
|
|
308
|
+
|
|
301
309
|
<div ref="wrapper" v-bind="wrapperAttrs">
|
|
302
310
|
<span
|
|
303
311
|
v-if="hasSlotContent($slots['left'], { iconName: leftIcon }) || leftIcon"
|
|
@@ -359,6 +359,24 @@ describe("UInput.vue", () => {
|
|
|
359
359
|
expect(descriptionElement.text()).toBe(customDescription);
|
|
360
360
|
});
|
|
361
361
|
|
|
362
|
+
it("Error – renders custom content from error slot", () => {
|
|
363
|
+
const customError = "Custom error content";
|
|
364
|
+
|
|
365
|
+
const component = mount(UInput, {
|
|
366
|
+
props: {
|
|
367
|
+
error: "Default error message",
|
|
368
|
+
},
|
|
369
|
+
slots: {
|
|
370
|
+
error: customError,
|
|
371
|
+
},
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
const labelComponent = component.getComponent(ULabel);
|
|
375
|
+
const errorElement = labelComponent.find("[vl-child-key='error']");
|
|
376
|
+
|
|
377
|
+
expect(errorElement.text()).toBe(customError);
|
|
378
|
+
});
|
|
379
|
+
|
|
362
380
|
it("Left – renders custom content from left slot", () => {
|
|
363
381
|
const slotText = "Custom Left Content";
|
|
364
382
|
const slotClass = "custom-left";
|
|
@@ -321,6 +321,14 @@ const {
|
|
|
321
321
|
<slot name="description" :description="description" />
|
|
322
322
|
</template>
|
|
323
323
|
|
|
324
|
+
<template #error>
|
|
325
|
+
<!--
|
|
326
|
+
@slot Use this to add custom content instead of the error message.
|
|
327
|
+
@binding {string | boolean} error
|
|
328
|
+
-->
|
|
329
|
+
<slot name="error" :error="currentError" />
|
|
330
|
+
</template>
|
|
331
|
+
|
|
324
332
|
<div ref="dropZone" :ondrop="onDrop" v-bind="dropzoneAttrs">
|
|
325
333
|
<UText v-if="hasSlotContent($slots['top'])" :size="size" v-bind="descriptionTopAttrs">
|
|
326
334
|
<!-- @slot Use it to add something above the component content. -->
|
|
@@ -310,6 +310,24 @@ describe("UInputFile.vue", () => {
|
|
|
310
310
|
expect(descriptionElement.text()).toBe(customDescription);
|
|
311
311
|
});
|
|
312
312
|
|
|
313
|
+
it("Error – renders custom content from error slot", () => {
|
|
314
|
+
const customError = "Custom error content";
|
|
315
|
+
|
|
316
|
+
const component = mount(UInputFile, {
|
|
317
|
+
props: {
|
|
318
|
+
error: "Default error message",
|
|
319
|
+
},
|
|
320
|
+
slots: {
|
|
321
|
+
error: customError,
|
|
322
|
+
},
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
const labelComponent = component.getComponent(ULabel);
|
|
326
|
+
const errorElement = labelComponent.find("[vl-child-key='error']");
|
|
327
|
+
|
|
328
|
+
expect(errorElement.text()).toBe(customError);
|
|
329
|
+
});
|
|
330
|
+
|
|
313
331
|
it("Top – renders custom content from top slot", () => {
|
|
314
332
|
const testClass = "custom-top";
|
|
315
333
|
|
|
@@ -187,6 +187,14 @@ const { getDataTest, numberInputAttrs } = useUI<Config>(defaultConfig);
|
|
|
187
187
|
<slot name="description" :description="description" />
|
|
188
188
|
</template>
|
|
189
189
|
|
|
190
|
+
<template #error>
|
|
191
|
+
<!--
|
|
192
|
+
@slot Use this to add custom content instead of the error message.
|
|
193
|
+
@binding {string | boolean} error
|
|
194
|
+
-->
|
|
195
|
+
<slot name="error" :error="error" />
|
|
196
|
+
</template>
|
|
197
|
+
|
|
190
198
|
<template #left>
|
|
191
199
|
<!--
|
|
192
200
|
@slot Use it to add something left.
|
|
@@ -431,6 +431,24 @@ describe("UInputNumber.vue", () => {
|
|
|
431
431
|
|
|
432
432
|
expect(descriptionElement.text()).toBe(customDescription);
|
|
433
433
|
});
|
|
434
|
+
|
|
435
|
+
it("Error – renders custom content from error slot", () => {
|
|
436
|
+
const customError = "Custom error content";
|
|
437
|
+
|
|
438
|
+
const component = mount(UInputNumber, {
|
|
439
|
+
props: {
|
|
440
|
+
error: "Default error message",
|
|
441
|
+
},
|
|
442
|
+
slots: {
|
|
443
|
+
error: customError,
|
|
444
|
+
},
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
const labelComponent = component.getComponent(UInput).getComponent(ULabel);
|
|
448
|
+
const errorElement = labelComponent.find("[vl-child-key='error']");
|
|
449
|
+
|
|
450
|
+
expect(errorElement.text()).toBe(customError);
|
|
451
|
+
});
|
|
434
452
|
});
|
|
435
453
|
|
|
436
454
|
describe("Exposed properties", () => {
|
|
@@ -133,6 +133,14 @@ const { getDataTest, config, passwordInputAttrs, passwordIconAttrs, passwordIcon
|
|
|
133
133
|
<slot name="description" :description="description" />
|
|
134
134
|
</template>
|
|
135
135
|
|
|
136
|
+
<template #error>
|
|
137
|
+
<!--
|
|
138
|
+
@slot Use this to add custom content instead of the error message.
|
|
139
|
+
@binding {string | boolean} error
|
|
140
|
+
-->
|
|
141
|
+
<slot name="error" :error="error" />
|
|
142
|
+
</template>
|
|
143
|
+
|
|
136
144
|
<template #right>
|
|
137
145
|
<div v-bind="passwordIconWrapperAttrs" @click="onClickShowPassword">
|
|
138
146
|
<!--
|
|
@@ -318,5 +318,23 @@ describe("UInputPassword.vue", () => {
|
|
|
318
318
|
|
|
319
319
|
expect(descriptionElement.text()).toBe(customDescription);
|
|
320
320
|
});
|
|
321
|
+
|
|
322
|
+
it("Error – renders custom content from error slot", () => {
|
|
323
|
+
const customError = "Custom error content";
|
|
324
|
+
|
|
325
|
+
const component = mount(UInputPassword, {
|
|
326
|
+
props: {
|
|
327
|
+
error: "Default error message",
|
|
328
|
+
},
|
|
329
|
+
slots: {
|
|
330
|
+
error: customError,
|
|
331
|
+
},
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
const labelComponent = component.getComponent(UInput).getComponent(ULabel);
|
|
335
|
+
const errorElement = labelComponent.find("[vl-child-key='error']");
|
|
336
|
+
|
|
337
|
+
expect(errorElement.text()).toBe(customError);
|
|
338
|
+
});
|
|
321
339
|
});
|
|
322
340
|
});
|
|
@@ -152,6 +152,14 @@ const {
|
|
|
152
152
|
<slot name="description" :description="description" />
|
|
153
153
|
</template>
|
|
154
154
|
|
|
155
|
+
<template #error>
|
|
156
|
+
<!--
|
|
157
|
+
@slot Use this to add custom content instead of the error message.
|
|
158
|
+
@binding {string | boolean} error
|
|
159
|
+
-->
|
|
160
|
+
<slot name="error" :error="error" />
|
|
161
|
+
</template>
|
|
162
|
+
|
|
155
163
|
<template #left>
|
|
156
164
|
<!-- @slot Use it to add something before the text. -->
|
|
157
165
|
<slot name="left" />
|
|
@@ -320,6 +320,24 @@ describe("UInputSearch.vue", () => {
|
|
|
320
320
|
|
|
321
321
|
expect(descriptionElement.text()).toBe(customDescription);
|
|
322
322
|
});
|
|
323
|
+
|
|
324
|
+
it("Error – renders custom content from error slot", () => {
|
|
325
|
+
const customError = "Custom error content";
|
|
326
|
+
|
|
327
|
+
const component = mount(UInputSearch, {
|
|
328
|
+
props: {
|
|
329
|
+
error: "Default error message",
|
|
330
|
+
},
|
|
331
|
+
slots: {
|
|
332
|
+
error: customError,
|
|
333
|
+
},
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
const labelComponent = component.getComponent(UInput).getComponent(ULabel);
|
|
337
|
+
const errorElement = labelComponent.find("[vl-child-key='error']");
|
|
338
|
+
|
|
339
|
+
expect(errorElement.text()).toBe(customError);
|
|
340
|
+
});
|
|
323
341
|
});
|
|
324
342
|
|
|
325
343
|
describe("Events", () => {
|
package/ui.form-label/ULabel.vue
CHANGED
|
@@ -55,8 +55,17 @@ const hasErrorState = computed(() => {
|
|
|
55
55
|
return Boolean(props.error) && !props.disabled;
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
const
|
|
59
|
-
return
|
|
58
|
+
const errorFallbackText = computed(() => {
|
|
59
|
+
return typeof props.error === "string" ? props.error : "";
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const showErrorBlock = computed(() => {
|
|
63
|
+
if (!hasErrorState.value) return false;
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
hasSlotContent(slots["error"], { error: props.error }) ||
|
|
67
|
+
(typeof props.error !== "boolean" && Boolean(props.error))
|
|
68
|
+
);
|
|
60
69
|
});
|
|
61
70
|
|
|
62
71
|
function onClick(event: MouseEvent) {
|
|
@@ -112,6 +121,7 @@ const { getDataTest, wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs, e
|
|
|
112
121
|
label ||
|
|
113
122
|
hasSlotContent(slots['label'], { label }) ||
|
|
114
123
|
error ||
|
|
124
|
+
hasSlotContent(slots['error'], { error }) ||
|
|
115
125
|
description ||
|
|
116
126
|
hasSlotContent(slots['description'], { description })
|
|
117
127
|
"
|
|
@@ -135,12 +145,15 @@ const { getDataTest, wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs, e
|
|
|
135
145
|
</slot>
|
|
136
146
|
</component>
|
|
137
147
|
|
|
138
|
-
<div
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
148
|
+
<div v-if="showErrorBlock" v-bind="errorAttrs" :data-test="getDataTest('error')">
|
|
149
|
+
<!--
|
|
150
|
+
@slot Use this to add custom content instead of the error message.
|
|
151
|
+
@binding {string | boolean} error
|
|
152
|
+
-->
|
|
153
|
+
<slot name="error" :error="error">
|
|
154
|
+
{{ errorFallbackText }}
|
|
155
|
+
</slot>
|
|
156
|
+
</div>
|
|
144
157
|
|
|
145
158
|
<div
|
|
146
159
|
v-if="
|
|
@@ -188,12 +201,15 @@ const { getDataTest, wrapperAttrs, contentAttrs, labelAttrs, descriptionAttrs, e
|
|
|
188
201
|
<slot />
|
|
189
202
|
</div>
|
|
190
203
|
|
|
191
|
-
<div
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
204
|
+
<div v-if="showErrorBlock" v-bind="errorAttrs" :data-test="getDataTest('error')">
|
|
205
|
+
<!--
|
|
206
|
+
@slot Use this to add custom content instead of the error message.
|
|
207
|
+
@binding {string | boolean} error
|
|
208
|
+
-->
|
|
209
|
+
<slot name="error" :error="error">
|
|
210
|
+
{{ errorFallbackText }}
|
|
211
|
+
</slot>
|
|
212
|
+
</div>
|
|
197
213
|
|
|
198
214
|
<div
|
|
199
215
|
v-if="
|
|
@@ -111,6 +111,25 @@ describe("ULabel.vue", () => {
|
|
|
111
111
|
expect(component.find("[vl-key='error']").exists()).toBe(false);
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
+
it("Error – renders content from error slot", () => {
|
|
115
|
+
const slotContent = "Custom error from slot";
|
|
116
|
+
const defaultError = "Default error";
|
|
117
|
+
|
|
118
|
+
const component = mount(ULabel, {
|
|
119
|
+
props: {
|
|
120
|
+
error: defaultError,
|
|
121
|
+
},
|
|
122
|
+
slots: {
|
|
123
|
+
error: slotContent,
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
const errorElement = component.find("[vl-key='error']");
|
|
128
|
+
|
|
129
|
+
expect(errorElement.text()).toBe(slotContent);
|
|
130
|
+
expect(errorElement.text()).not.toContain(defaultError);
|
|
131
|
+
});
|
|
132
|
+
|
|
114
133
|
it("Align – applies correct classes for align prop", () => {
|
|
115
134
|
const alignCases = {
|
|
116
135
|
top: "flex-col",
|
package/ui.form-radio/URadio.vue
CHANGED
|
@@ -132,6 +132,14 @@ const { getDataTest, radioLabelAttrs, radioAttrs } = useUI<Config>(defaultConfig
|
|
|
132
132
|
<slot name="description" :description="description" />
|
|
133
133
|
</template>
|
|
134
134
|
|
|
135
|
+
<template #error>
|
|
136
|
+
<!--
|
|
137
|
+
@slot Use this to add custom content instead of the error message.
|
|
138
|
+
@binding {string | boolean} error
|
|
139
|
+
-->
|
|
140
|
+
<slot name="error" :error="error" />
|
|
141
|
+
</template>
|
|
142
|
+
|
|
135
143
|
<input
|
|
136
144
|
:id="elementId"
|
|
137
145
|
type="radio"
|
|
@@ -224,6 +224,24 @@ describe("URadio.vue", () => {
|
|
|
224
224
|
expect(descriptionElement.text()).toBe(customDescription);
|
|
225
225
|
});
|
|
226
226
|
|
|
227
|
+
it("Error – renders custom content from error slot", () => {
|
|
228
|
+
const customError = "Custom error content";
|
|
229
|
+
|
|
230
|
+
const component = mount(URadio, {
|
|
231
|
+
props: {
|
|
232
|
+
error: "Default error message",
|
|
233
|
+
},
|
|
234
|
+
slots: {
|
|
235
|
+
error: customError,
|
|
236
|
+
},
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
const labelComponent = component.getComponent(ULabel);
|
|
240
|
+
const errorElement = labelComponent.find("[vl-child-key='error']");
|
|
241
|
+
|
|
242
|
+
expect(errorElement.text()).toBe(customError);
|
|
243
|
+
});
|
|
244
|
+
|
|
227
245
|
it("Bottom – renders custom content from bottom slot", () => {
|
|
228
246
|
const customBottomContent = "Custom Bottom Content";
|
|
229
247
|
|
|
@@ -87,6 +87,14 @@ const { getDataTest, groupLabelAttrs, listAttrs, groupRadioAttrs } = useUI<Confi
|
|
|
87
87
|
<slot name="description" :description="description" />
|
|
88
88
|
</template>
|
|
89
89
|
|
|
90
|
+
<template #error>
|
|
91
|
+
<!--
|
|
92
|
+
@slot Use this to add custom content instead of the error message.
|
|
93
|
+
@binding {string | boolean} error
|
|
94
|
+
-->
|
|
95
|
+
<slot name="error" :error="error" />
|
|
96
|
+
</template>
|
|
97
|
+
|
|
90
98
|
<div ref="list" v-bind="listAttrs">
|
|
91
99
|
<!-- @slot Use it to add URadio directly. -->
|
|
92
100
|
<slot>
|
|
@@ -322,6 +322,25 @@ describe("URadioGroup.vue", () => {
|
|
|
322
322
|
expect(descriptionElement.text()).toBe(customDescription);
|
|
323
323
|
});
|
|
324
324
|
|
|
325
|
+
it("Error – renders custom content from error slot", () => {
|
|
326
|
+
const customError = "Custom error content";
|
|
327
|
+
|
|
328
|
+
const component = mount(URadioGroup, {
|
|
329
|
+
props: {
|
|
330
|
+
error: "Default error message",
|
|
331
|
+
name: defaultName,
|
|
332
|
+
},
|
|
333
|
+
slots: {
|
|
334
|
+
error: customError,
|
|
335
|
+
},
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
const labelComponent = component.getComponent(ULabel);
|
|
339
|
+
const errorElement = labelComponent.find("[vl-child-key='error']");
|
|
340
|
+
|
|
341
|
+
expect(errorElement.text()).toBe(customError);
|
|
342
|
+
});
|
|
343
|
+
|
|
325
344
|
it("Default slot – renders custom URadio components", () => {
|
|
326
345
|
const component = mount(URadioGroup, {
|
|
327
346
|
props: {
|
|
@@ -546,6 +546,14 @@ const {
|
|
|
546
546
|
<slot name="description" :description="description" />
|
|
547
547
|
</template>
|
|
548
548
|
|
|
549
|
+
<template #error>
|
|
550
|
+
<!--
|
|
551
|
+
@slot Use this to add custom content instead of the error message.
|
|
552
|
+
@binding {string | boolean} error
|
|
553
|
+
-->
|
|
554
|
+
<slot name="error" :error="error" />
|
|
555
|
+
</template>
|
|
556
|
+
|
|
549
557
|
<div
|
|
550
558
|
ref="wrapper"
|
|
551
559
|
:tabindex="searchable || disabled ? -1 : 0"
|
|
@@ -606,6 +606,25 @@ describe("USelect.vue", () => {
|
|
|
606
606
|
expect(descriptionElement.text()).toBe(customDescription);
|
|
607
607
|
});
|
|
608
608
|
|
|
609
|
+
it("Error – renders custom content from error slot", () => {
|
|
610
|
+
const customError = "Custom error content";
|
|
611
|
+
|
|
612
|
+
const component = mount(USelect, {
|
|
613
|
+
props: {
|
|
614
|
+
error: "Default error message",
|
|
615
|
+
options: defaultOptions,
|
|
616
|
+
},
|
|
617
|
+
slots: {
|
|
618
|
+
error: customError,
|
|
619
|
+
},
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
const labelComponent = component.getComponent(ULabel);
|
|
623
|
+
const errorElement = labelComponent.find("[vl-child-key='error']");
|
|
624
|
+
|
|
625
|
+
expect(errorElement.text()).toBe(customError);
|
|
626
|
+
});
|
|
627
|
+
|
|
609
628
|
it("Left – renders custom content from left slot", () => {
|
|
610
629
|
const slotContent = "Left Slot Content";
|
|
611
630
|
|
|
@@ -258,6 +258,14 @@ const {
|
|
|
258
258
|
<slot name="description" :description="description" />
|
|
259
259
|
</template>
|
|
260
260
|
|
|
261
|
+
<template #error>
|
|
262
|
+
<!--
|
|
263
|
+
@slot Use this to add custom content instead of the error message.
|
|
264
|
+
@binding {string | boolean} error
|
|
265
|
+
-->
|
|
266
|
+
<slot name="error" :error="error" />
|
|
267
|
+
</template>
|
|
268
|
+
|
|
261
269
|
<div ref="wrapper" v-bind="wrapperAttrs">
|
|
262
270
|
<span
|
|
263
271
|
v-if="hasSlotContent($slots['left'])"
|
|
@@ -448,6 +448,24 @@ describe("UTextarea.vue", () => {
|
|
|
448
448
|
expect(descriptionElement.text()).toBe(customDescription);
|
|
449
449
|
});
|
|
450
450
|
|
|
451
|
+
it("Error – renders custom content from error slot", () => {
|
|
452
|
+
const customError = "Custom error content";
|
|
453
|
+
|
|
454
|
+
const component = mount(UTextarea, {
|
|
455
|
+
props: {
|
|
456
|
+
error: "Default error message",
|
|
457
|
+
},
|
|
458
|
+
slots: {
|
|
459
|
+
error: customError,
|
|
460
|
+
},
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
const labelComponent = component.getComponent(ULabel);
|
|
464
|
+
const errorElement = labelComponent.find("[vl-child-key='error']");
|
|
465
|
+
|
|
466
|
+
expect(errorElement.text()).toBe(customError);
|
|
467
|
+
});
|
|
468
|
+
|
|
451
469
|
it("Left – renders custom content from left slot", () => {
|
|
452
470
|
const slotText = "Custom Left Content";
|
|
453
471
|
const testClass = "custom-left";
|