aloha-vue 2.74.0 → 2.75.1
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/CHANGELOG.md +12 -0
- package/LICENSE +22 -21
- package/dist/aloha-vue.css +105 -105
- package/dist/aloha-vue.css.map +1 -1
- package/dist/aloha-vue.es.js +59267 -64918
- package/dist/aloha-vue.umd.js +338 -211
- package/package.json +27 -34
- package/scss/components/ATable.scss +2 -2
- package/scss/utils/button.scss +362 -362
- package/scss/utils/funktions.scss +162 -162
- package/src/AAccordion/AAccordionItem/AAccordionItem.js +235 -230
- package/src/ACarousel/ACarousel.js +7 -2
- package/src/ADropdown/ADropdown.js +4 -1
- package/src/AFilters/AFilterCenter/AFilterCenter.js +5 -1
- package/src/AFilters/AFilterCenter/AFilterCenterItem/AFilterCenterItem.js +7 -2
- package/src/AFilters/AFiltersHorizontal/AFiltersHorizontal.js +412 -396
- package/src/AFilters/AFiltersHorizontal/AFiltersHorizontalFilter/AFiltersHorizontalFilter.js +102 -99
- package/src/AFilters/AFiltersHorizontal/compositionAPI/FiltersSavedDeleteAPI.js +108 -108
- package/src/AFilters/AFiltersMain/AFiltersMain.js +114 -111
- package/src/AFilters/AFiltersSaveModal/compositionAPI/SaveAPI.js +65 -65
- package/src/ALinkCopy/ALinkCopy.js +98 -95
- package/src/ALinkCopy/compositionAPI/CopyAPI.js +48 -48
- package/src/AList/__tests__/AList.test.js +33 -33
- package/src/AList/compositionAPI/__tests__/TagAPI.test.js +43 -43
- package/src/AMenu/AMenu.js +4 -1
- package/src/AMenu/AMenuBreadcrumbs/AMenuBreadcrumbs.js +240 -237
- package/src/AMenu/AMenuPanelLink/AMenuPanelLink.js +4 -1
- package/src/AMenu/AMenuSearchPanelBreadcrumbs/AMenuSearchPanelBreadcrumbs.js +122 -119
- package/src/AModalWizard/AModalWizard.js +58 -53
- package/src/AModalWizard/compositionAPI/__tests__/ScrollAPI.test.js +46 -46
- package/src/APagination/APaginationPages/APaginationPages.js +15 -4
- package/src/ARate/ARate.js +254 -249
- package/src/ARate/ARateIcon/ADecimalIcon/ADecimalIcon.js +53 -50
- package/src/ARate/ARateIcon/ARateIcon.js +109 -104
- package/src/AResizer/AResizer.js +167 -162
- package/src/ATable/ATableHeaderTh/compositionAPI/SortAPI.js +172 -167
- package/src/ATable/ATableHeaderThAction/ATableHeaderThAction.js +14 -4
- package/src/ATable/ATableHeaderThAction/ATableHeaderThActionItem/ATableHeaderThActionItem.js +191 -184
- package/src/ATable/ATablePreviewDown/ATablePreviewDown.js +72 -69
- package/src/ATable/ATablePreviewRight/ATablePreviewRight.js +265 -258
- package/src/ATable/ATableSortingAdditional/ATableSortingAdditional.js +224 -219
- package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.AttributesAPI.test.js +39 -39
- package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.ColumnsAPI.test.js +68 -68
- package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.DropdownAPI.test.js +45 -45
- package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.FormAPI.test.js +95 -95
- package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.ModelAPI.test.js +1 -1
- package/src/ATable/ATableTd/ATableTd.js +4 -1
- package/src/ATable/ATableTdAction/ATableTdAction.js +19 -12
- package/src/ATable/ATableTopPanel/ATableTopPanel.js +11 -3
- package/src/ATable/ATableTr/ATableTr.js +408 -405
- package/src/ATable/__tests__/ATable.HeaderSlot.test.js +102 -97
- package/src/ATable/__tests__/ATable.RowIdsAPI.test.js +66 -66
- package/src/ATableForm/ATableForm.js +88 -85
- package/src/ATableForm/ATableFormCellAction/ATableFormCellAction.js +14 -4
- package/src/ATableForm/ATableFormCellDnd/ATableFormCellDnd.js +196 -187
- package/src/ATableForm/ATableFormRow/compositionAPI/EditAPI.js +104 -104
- package/src/ATableForm/__tests__/ATableForm.DragAndDropAPI.test.js +200 -212
- package/src/ATableForm/__tests__/ATableForm.ListView.test.js +134 -174
- package/src/ATableForm/compositionAPI/IconsAPI.js +24 -21
- package/src/AVerticalScroll/AVerticalScroll.js +182 -177
- package/src/AWizard/AWizard.js +26 -21
- package/src/AWizard/AWizardStep/AWizardStep.js +275 -270
- package/src/AWizard/compositionAPI/__tests__/ChangeStepAPI.test.js +32 -32
- package/src/AWizard/compositionAPI/__tests__/LocalAPI.test.js +55 -55
- package/src/PuxDatepicker/PuxDatepickerCalendarPanel/PuxDatepickerCalendarPanel.js +646 -648
- package/src/PuxDatepicker/panel/PanelDate/PanelDate.js +300 -301
- package/src/PuxDatepicker/panel/PanelMonth/PanelMonth.js +148 -149
- package/src/PuxDatepicker/panel/PanelTime/PanelTime.js +256 -257
- package/src/PuxDatepicker/panel/PanelYear/PanelYear.js +136 -137
- package/src/PuxDatepicker/utils/index.js +100 -100
- package/src/compositionAPI/AHttpAPI.js +593 -593
- package/src/compositionAPI/__tests__/AHttpAPI.test.js +42 -42
- package/src/filters/__tests__/filterBoolean.test.js +38 -38
- package/src/filters/__tests__/filterCapitalize.test.js +38 -38
- package/src/filters/__tests__/filterCurrency.test.js +21 -21
- package/src/filters/__tests__/filterDate.test.js +42 -42
- package/src/filters/__tests__/filterDefaultForEmpty.test.js +24 -24
- package/src/filters/__tests__/filterEmail.test.js +42 -42
- package/src/filters/__tests__/filterEscapeHtml.test.js +45 -45
- package/src/filters/__tests__/filterFileSize.test.js +45 -45
- package/src/filters/__tests__/filterFloat.test.js +74 -74
- package/src/filters/__tests__/filterJson.test.js +74 -74
- package/src/filters/__tests__/filterKeyValue.test.js +50 -50
- package/src/filters/__tests__/filterLimitTo.test.js +39 -39
- package/src/filters/__tests__/filterLink.test.js +41 -41
- package/src/filters/__tests__/filterList.test.js +149 -149
- package/src/filters/__tests__/filterLowerCase.test.js +38 -38
- package/src/filters/__tests__/filterMask.test.js +80 -80
- package/src/filters/__tests__/filterPropertyByValue.test.js +27 -27
- package/src/filters/__tests__/filterSearchHighlight.test.js +129 -129
- package/src/filters/__tests__/filterUpperCase.test.js +38 -38
- package/src/filters/__tests__/filterValueByCondition.test.js +3 -3
- package/src/filters/filterJson.js +39 -39
- package/src/filters/filterValueByCondition.js +2 -2
- package/src/plugins/AAlertPlugin.js +16 -5
- package/src/plugins/AMultiselectOrderedPlugin.js +88 -81
- package/src/plugins/ASelectPlugin.js +12 -10
- package/src/ui/ACheckbox/ACheckbox.js +82 -79
- package/src/ui/ADatepicker/ADatepicker.js +6 -5
- package/src/ui/ADatepicker/compositionAPI/EventsAPI.js +297 -297
- package/src/ui/ADatepicker/utils/index.js +76 -76
- package/src/ui/ADatepickerAlt/ADatepicker.js +912 -912
- package/src/ui/ADatepickerAlt/utils/index.js +98 -98
- package/src/ui/AFieldset/__tests__/AFieldset.ClassColumn.test.js +113 -114
- package/src/ui/AFormElementBtnClear/AFormElementBtnClear.js +4 -1
- package/src/ui/AInputCurrency/AInputCurrency.js +20 -15
- package/src/ui/AInputCurrency/__tests__/AInputCurrency.ModelAPI.test.js +73 -73
- package/src/ui/AInputNumber/AInputNumber.js +17 -12
- package/src/ui/AJson/AJson.js +12 -3
- package/src/ui/AJson/compositionAPI/JsonAPI.js +116 -116
- package/src/ui/ALabel/__tests__/ALabel.IdAPI.test.js +42 -42
- package/src/ui/ALabel/__tests__/ALabel.LabelAPI.test.js +33 -33
- package/src/ui/ARadio/ARadio.js +80 -77
- package/src/ui/ASelect/ASelect.js +390 -383
- package/src/ui/ASelect/ASelectElement/ASelectElement.js +179 -176
- package/src/ui/ASelect/ASelectValueCloseable/ASelectValueCloseable.js +143 -141
- package/src/ui/ASelect/__tests__/SelectedFirstAPI.test.js +101 -101
- package/src/ui/ASelect/__tests__/SelectedVisibleAPI.test.js +98 -98
- package/src/ui/ASlider/compositionAPI/SliderAPI.js +23 -23
- package/src/ui/AValidatedJson/AValidatedJson.js +4 -1
- package/src/ui/AValidatedJson/AValidatedJsonItem/AValidatedJsonItem.js +308 -298
- package/src/ui/compositionApi/UiCollapseAPI.js +68 -63
- package/src/ui/compositionApi/UiInputAutofillAPI.js +41 -41
- package/src/ui/compositionApi/__tests__/UIDataGroupAPI.test.js +106 -106
- package/src/ui/compositionApi/__tests__/UIExcludeRenderAttributesAPI.test.js +39 -39
- package/src/ui/compositionApi/__tests__/UiDataWithKeyIdAndLabelAPI.test.js +128 -128
- package/src/ui/compositionApi/__tests__/UiSearchAPI.test.js +71 -71
- package/src/utils/EventBus.js +51 -8
- package/src/utils/__tests__/EventBus.test.js +138 -0
- package/src/utils/__tests__/utils.aOrderBy.test.js +1 -1
- package/src/utils/__tests__/utils.aSortBy.test.js +1 -1
- package/src/utils/__tests__/utils.getTotalNestedCount.test.js +56 -56
- package/src/utils/__tests__/utils.isArrayOfArrays.test.js +44 -44
- package/src/utils/__tests__/utils.isArrayOfStrings.test.js +36 -36
- package/src/utils/__tests__/utilsArray.aFirst.test.js +1 -1
- package/src/utils/__tests__/utilsArray.aLast.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isArguments.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isArray.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isArrayBuffer.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isBoolean.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isBuffer.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isDate.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isElement.test.js +5 -3
- package/src/utils/__tests__/utilsLang.isError.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isFinite.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isFunction.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isInteger.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isMap.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isNaN.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isNil.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isNull.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isNumber.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isObject.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isObjectLike.test.js +5 -3
- package/src/utils/__tests__/utilsLang.isPlainObject.test.js +3 -2
- package/src/utils/__tests__/utilsLang.isPromise.test.js +5 -2
- package/src/utils/__tests__/utilsLang.isRegExp.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isSet.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isString.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isSymbol.test.js +5 -3
- package/src/utils/__tests__/utilsLang.isUndefined.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isWeakMap.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isWeakSet.test.js +1 -1
- package/src/utils/__tests__/utilsMath.isEven.test.js +43 -43
- package/src/utils/__tests__/utilsMath.isOdd.test.js +43 -43
- package/src/utils/__tests__/utilsUi.isModelForFilterNotEmpty.test.js +65 -65
- package/src/utils/autosize.js +1 -1
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
describe,
|
|
3
|
-
expect,
|
|
4
|
-
it,
|
|
5
|
-
} from "
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
getUrlParams,
|
|
9
|
-
} from "../AHttpAPI";
|
|
10
|
-
|
|
11
|
-
describe("getUrlParams", () => {
|
|
12
|
-
it("simple", () => {
|
|
13
|
-
const URL = "x=false&y=100&z=aloha";
|
|
14
|
-
|
|
15
|
-
expect(getUrlParams({ url: URL })).toStrictEqual({ x: "false", y: "100", z: "aloha" });
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it("Array", () => {
|
|
19
|
-
const URL = "x=false&x=100&z=aloha&x=aloha";
|
|
20
|
-
|
|
21
|
-
expect(getUrlParams({ url: URL })).toStrictEqual({ x: ["false", "100", "aloha"], z: "aloha" });
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it("value with comma", () => {
|
|
25
|
-
const URL = "x=a,b,c,d&y=100&z=aloha";
|
|
26
|
-
|
|
27
|
-
expect(getUrlParams({ url: URL })).toStrictEqual({ x: "a,b,c,d", y: "100", z: "aloha" });
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it("allCommasToArray", () => {
|
|
31
|
-
const URL = "x=aloha,holla&z=aloha";
|
|
32
|
-
|
|
33
|
-
expect(getUrlParams({ url: URL, allCommasToArray: true })).toStrictEqual({ x: ["aloha", "holla"], z: "aloha" });
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("keysCommaToArray", () => {
|
|
37
|
-
const URL = "x=aloha,holla&z=aloha";
|
|
38
|
-
|
|
39
|
-
expect(getUrlParams({ url: URL, keysCommaToArray: ["x"] })).toStrictEqual({ x: ["aloha", "holla"], z: "aloha" });
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
1
|
+
import {
|
|
2
|
+
describe,
|
|
3
|
+
expect,
|
|
4
|
+
it,
|
|
5
|
+
} from "vitest";
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
getUrlParams,
|
|
9
|
+
} from "../AHttpAPI";
|
|
10
|
+
|
|
11
|
+
describe("getUrlParams", () => {
|
|
12
|
+
it("simple", () => {
|
|
13
|
+
const URL = "x=false&y=100&z=aloha";
|
|
14
|
+
|
|
15
|
+
expect(getUrlParams({ url: URL })).toStrictEqual({ x: "false", y: "100", z: "aloha" });
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("Array", () => {
|
|
19
|
+
const URL = "x=false&x=100&z=aloha&x=aloha";
|
|
20
|
+
|
|
21
|
+
expect(getUrlParams({ url: URL })).toStrictEqual({ x: ["false", "100", "aloha"], z: "aloha" });
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("value with comma", () => {
|
|
25
|
+
const URL = "x=a,b,c,d&y=100&z=aloha";
|
|
26
|
+
|
|
27
|
+
expect(getUrlParams({ url: URL })).toStrictEqual({ x: "a,b,c,d", y: "100", z: "aloha" });
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("allCommasToArray", () => {
|
|
31
|
+
const URL = "x=aloha,holla&z=aloha";
|
|
32
|
+
|
|
33
|
+
expect(getUrlParams({ url: URL, allCommasToArray: true })).toStrictEqual({ x: ["aloha", "holla"], z: "aloha" });
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("keysCommaToArray", () => {
|
|
37
|
+
const URL = "x=aloha,holla&z=aloha";
|
|
38
|
+
|
|
39
|
+
expect(getUrlParams({ url: URL, keysCommaToArray: ["x"] })).toStrictEqual({ x: ["aloha", "holla"], z: "aloha" });
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
describe,
|
|
3
|
-
expect,
|
|
4
|
-
it,
|
|
5
|
-
} from "
|
|
6
|
-
|
|
7
|
-
import filterBoolean from "../filterBoolean";
|
|
8
|
-
|
|
9
|
-
describe("filterBoolean", () => {
|
|
10
|
-
it("value=true", () => {
|
|
11
|
-
expect(filterBoolean(true)).toBe("_YES_");
|
|
12
|
-
expect(filterBoolean(123)).toBe("_YES_");
|
|
13
|
-
expect(filterBoolean("1")).toBe("_YES_");
|
|
14
|
-
expect(filterBoolean(true, { trueValue: "yes" })).toBe("yes");
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it("value=false", () => {
|
|
18
|
-
expect(filterBoolean(false)).toBe("_NO_");
|
|
19
|
-
expect(filterBoolean(0)).toBe("_NO_");
|
|
20
|
-
expect(filterBoolean("")).toBe("_NO_");
|
|
21
|
-
expect(filterBoolean(false, { falseValue: "no" })).toBe("no");
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it("useNil=true", () => {
|
|
25
|
-
expect(filterBoolean(undefined, { useNil: true })).toBe("");
|
|
26
|
-
expect(filterBoolean(null, { useNil: true })).toBe("");
|
|
27
|
-
expect(filterBoolean(false, { useNil: true })).toBe("_NO_");
|
|
28
|
-
expect(filterBoolean(true, { useNil: true })).toBe("_YES_");
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it("useNil=false", () => {
|
|
32
|
-
expect(filterBoolean(undefined, { useNil: false })).toBe("_NO_");
|
|
33
|
-
expect(filterBoolean(null, { useNil: false })).toBe("_NO_");
|
|
34
|
-
expect(filterBoolean(false, { useNil: false })).toBe("_NO_");
|
|
35
|
-
expect(filterBoolean(true, { useNil: false })).toBe("_YES_");
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
|
|
1
|
+
import {
|
|
2
|
+
describe,
|
|
3
|
+
expect,
|
|
4
|
+
it,
|
|
5
|
+
} from "vitest";
|
|
6
|
+
|
|
7
|
+
import filterBoolean from "../filterBoolean";
|
|
8
|
+
|
|
9
|
+
describe("filterBoolean", () => {
|
|
10
|
+
it("value=true", () => {
|
|
11
|
+
expect(filterBoolean(true)).toBe("_YES_");
|
|
12
|
+
expect(filterBoolean(123)).toBe("_YES_");
|
|
13
|
+
expect(filterBoolean("1")).toBe("_YES_");
|
|
14
|
+
expect(filterBoolean(true, { trueValue: "yes" })).toBe("yes");
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("value=false", () => {
|
|
18
|
+
expect(filterBoolean(false)).toBe("_NO_");
|
|
19
|
+
expect(filterBoolean(0)).toBe("_NO_");
|
|
20
|
+
expect(filterBoolean("")).toBe("_NO_");
|
|
21
|
+
expect(filterBoolean(false, { falseValue: "no" })).toBe("no");
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("useNil=true", () => {
|
|
25
|
+
expect(filterBoolean(undefined, { useNil: true })).toBe("");
|
|
26
|
+
expect(filterBoolean(null, { useNil: true })).toBe("");
|
|
27
|
+
expect(filterBoolean(false, { useNil: true })).toBe("_NO_");
|
|
28
|
+
expect(filterBoolean(true, { useNil: true })).toBe("_YES_");
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("useNil=false", () => {
|
|
32
|
+
expect(filterBoolean(undefined, { useNil: false })).toBe("_NO_");
|
|
33
|
+
expect(filterBoolean(null, { useNil: false })).toBe("_NO_");
|
|
34
|
+
expect(filterBoolean(false, { useNil: false })).toBe("_NO_");
|
|
35
|
+
expect(filterBoolean(true, { useNil: false })).toBe("_YES_");
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import {
|
|
2
|
-
describe,
|
|
3
|
-
expect,
|
|
4
|
-
it,
|
|
5
|
-
} from "
|
|
6
|
-
|
|
7
|
-
import filterCapitalize from "../filterCapitalize";
|
|
8
|
-
|
|
9
|
-
describe("filterCapitalize", () => {
|
|
10
|
-
it("should capitalize a lowercase string", () => {
|
|
11
|
-
expect(filterCapitalize("foobar")).toBe("Foobar");
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it("should capitalize an uppercase string", () => {
|
|
15
|
-
expect(filterCapitalize("FOOBAR")).toBe("Foobar");
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it("should capitalize a mixed case string", () => {
|
|
19
|
-
expect(filterCapitalize("fOoBaR")).toBe("Foobar");
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it("should handle an empty string", () => {
|
|
23
|
-
expect(filterCapitalize("")).toBe("");
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("should handle a string with one character", () => {
|
|
27
|
-
expect(filterCapitalize("a")).toBe("A");
|
|
28
|
-
expect(filterCapitalize("A")).toBe("A");
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it("should handle strings with spaces", () => {
|
|
32
|
-
expect(filterCapitalize(" foo bar ")).toBe(" foo bar ");
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("should not change already capitalized strings", () => {
|
|
36
|
-
expect(filterCapitalize("Foobar")).toBe("Foobar");
|
|
37
|
-
});
|
|
38
|
-
});
|
|
1
|
+
import {
|
|
2
|
+
describe,
|
|
3
|
+
expect,
|
|
4
|
+
it,
|
|
5
|
+
} from "vitest";
|
|
6
|
+
|
|
7
|
+
import filterCapitalize from "../filterCapitalize";
|
|
8
|
+
|
|
9
|
+
describe("filterCapitalize", () => {
|
|
10
|
+
it("should capitalize a lowercase string", () => {
|
|
11
|
+
expect(filterCapitalize("foobar")).toBe("Foobar");
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("should capitalize an uppercase string", () => {
|
|
15
|
+
expect(filterCapitalize("FOOBAR")).toBe("Foobar");
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("should capitalize a mixed case string", () => {
|
|
19
|
+
expect(filterCapitalize("fOoBaR")).toBe("Foobar");
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("should handle an empty string", () => {
|
|
23
|
+
expect(filterCapitalize("")).toBe("");
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("should handle a string with one character", () => {
|
|
27
|
+
expect(filterCapitalize("a")).toBe("A");
|
|
28
|
+
expect(filterCapitalize("A")).toBe("A");
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("should handle strings with spaces", () => {
|
|
32
|
+
expect(filterCapitalize(" foo bar ")).toBe(" foo bar ");
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("should not change already capitalized strings", () => {
|
|
36
|
+
expect(filterCapitalize("Foobar")).toBe("Foobar");
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
describe,
|
|
3
|
-
expect,
|
|
4
|
-
it,
|
|
5
|
-
} from "
|
|
6
|
-
|
|
7
|
-
import filterCurrency from "../filterCurrency";
|
|
8
|
-
|
|
9
|
-
describe("filterCurrency", () => {
|
|
10
|
-
it("should properly format a given number with default parameters", () => {
|
|
11
|
-
expect(filterCurrency(1234.5678)).toEqual("1.234,57 €");
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it("should properly format a given number with custom parameters", () => {
|
|
15
|
-
expect(filterCurrency(1234.5678, { suffix: "$", digits: 3, digitGrouping: false })).toEqual("1234,568 $");
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it("should return undefined when a non-number value is passed", () => {
|
|
19
|
-
expect(filterCurrency(null)).toEqual("");
|
|
20
|
-
});
|
|
21
|
-
});
|
|
1
|
+
import {
|
|
2
|
+
describe,
|
|
3
|
+
expect,
|
|
4
|
+
it,
|
|
5
|
+
} from "vitest";
|
|
6
|
+
|
|
7
|
+
import filterCurrency from "../filterCurrency";
|
|
8
|
+
|
|
9
|
+
describe("filterCurrency", () => {
|
|
10
|
+
it("should properly format a given number with default parameters", () => {
|
|
11
|
+
expect(filterCurrency(1234.5678)).toEqual("1.234,57 €");
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("should properly format a given number with custom parameters", () => {
|
|
15
|
+
expect(filterCurrency(1234.5678, { suffix: "$", digits: 3, digitGrouping: false })).toEqual("1234,568 $");
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("should return undefined when a non-number value is passed", () => {
|
|
19
|
+
expect(filterCurrency(null)).toEqual("");
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
describe,
|
|
3
|
-
expect,
|
|
4
|
-
it,
|
|
5
|
-
} from "
|
|
6
|
-
|
|
7
|
-
import filterDate from "../filterDate";
|
|
8
|
-
import moment from "moment";
|
|
9
|
-
|
|
10
|
-
describe("filterDate function", () => {
|
|
11
|
-
it("returns empty string when input is null, undefined or an empty string", () => {
|
|
12
|
-
const testCases = [null, undefined, ""];
|
|
13
|
-
testCases.forEach(tc => {
|
|
14
|
-
expect(filterDate(tc)).toEqual("");
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it("returns the original value when the input is not a valid date", () => {
|
|
19
|
-
const testCases = ["abc", "a123", "12a3", "123a"];
|
|
20
|
-
testCases.forEach(tc => {
|
|
21
|
-
expect(filterDate(tc)).toEqual(tc);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it("returns the formatted date when the input is a valid date", () => {
|
|
26
|
-
const testCases = [
|
|
27
|
-
{
|
|
28
|
-
input: "2023-03-01",
|
|
29
|
-
format: "YYYY-MM-DD",
|
|
30
|
-
expected: "2023-03-01",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
input: "2023-03-01",
|
|
34
|
-
format: "date",
|
|
35
|
-
expected: moment("2023-03-01").format("DD.MM.YYYY"),
|
|
36
|
-
},
|
|
37
|
-
];
|
|
38
|
-
testCases.forEach(tc => {
|
|
39
|
-
expect(filterDate(tc.input, { format: tc.format })).toEqual(tc.expected);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
});
|
|
1
|
+
import {
|
|
2
|
+
describe,
|
|
3
|
+
expect,
|
|
4
|
+
it,
|
|
5
|
+
} from "vitest";
|
|
6
|
+
|
|
7
|
+
import filterDate from "../filterDate";
|
|
8
|
+
import moment from "moment";
|
|
9
|
+
|
|
10
|
+
describe("filterDate function", () => {
|
|
11
|
+
it("returns empty string when input is null, undefined or an empty string", () => {
|
|
12
|
+
const testCases = [null, undefined, ""];
|
|
13
|
+
testCases.forEach(tc => {
|
|
14
|
+
expect(filterDate(tc)).toEqual("");
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("returns the original value when the input is not a valid date", () => {
|
|
19
|
+
const testCases = ["abc", "a123", "12a3", "123a"];
|
|
20
|
+
testCases.forEach(tc => {
|
|
21
|
+
expect(filterDate(tc)).toEqual(tc);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("returns the formatted date when the input is a valid date", () => {
|
|
26
|
+
const testCases = [
|
|
27
|
+
{
|
|
28
|
+
input: "2023-03-01",
|
|
29
|
+
format: "YYYY-MM-DD",
|
|
30
|
+
expected: "2023-03-01",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
input: "2023-03-01",
|
|
34
|
+
format: "date",
|
|
35
|
+
expected: moment("2023-03-01").format("DD.MM.YYYY"),
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
testCases.forEach(tc => {
|
|
39
|
+
expect(filterDate(tc.input, { format: tc.format })).toEqual(tc.expected);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
describe,
|
|
3
|
-
expect,
|
|
4
|
-
it,
|
|
5
|
-
} from "
|
|
6
|
-
|
|
7
|
-
import filterDefaultForEmpty from "../filterDefaultForEmpty";
|
|
8
|
-
|
|
9
|
-
describe("filterDefaultForEmpty Function", () => {
|
|
10
|
-
it("should return 'emptyValue', when the input is null", () => {
|
|
11
|
-
expect(filterDefaultForEmpty(null)).toBe("-");
|
|
12
|
-
expect(filterDefaultForEmpty(null, { emptyValue: "default" })).toBe("default");
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("should return 'emptyValue', when the input is an empty string", () => {
|
|
16
|
-
expect(filterDefaultForEmpty("")).toBe("-");
|
|
17
|
-
expect(filterDefaultForEmpty("", { emptyValue: "default" })).toBe("default");
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it("should return the inputted value, when it is not null or an empty string", () => {
|
|
21
|
-
expect(filterDefaultForEmpty("Non-empty value")).toBe("Non-empty value");
|
|
22
|
-
expect(filterDefaultForEmpty(123)).toBe(123);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
1
|
+
import {
|
|
2
|
+
describe,
|
|
3
|
+
expect,
|
|
4
|
+
it,
|
|
5
|
+
} from "vitest";
|
|
6
|
+
|
|
7
|
+
import filterDefaultForEmpty from "../filterDefaultForEmpty";
|
|
8
|
+
|
|
9
|
+
describe("filterDefaultForEmpty Function", () => {
|
|
10
|
+
it("should return 'emptyValue', when the input is null", () => {
|
|
11
|
+
expect(filterDefaultForEmpty(null)).toBe("-");
|
|
12
|
+
expect(filterDefaultForEmpty(null, { emptyValue: "default" })).toBe("default");
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it("should return 'emptyValue', when the input is an empty string", () => {
|
|
16
|
+
expect(filterDefaultForEmpty("")).toBe("-");
|
|
17
|
+
expect(filterDefaultForEmpty("", { emptyValue: "default" })).toBe("default");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("should return the inputted value, when it is not null or an empty string", () => {
|
|
21
|
+
expect(filterDefaultForEmpty("Non-empty value")).toBe("Non-empty value");
|
|
22
|
+
expect(filterDefaultForEmpty(123)).toBe(123);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
describe,
|
|
3
|
-
expect,
|
|
4
|
-
it,
|
|
5
|
-
} from "
|
|
6
|
-
|
|
7
|
-
import filterEmail from "../filterEmail";
|
|
8
|
-
|
|
9
|
-
describe("filterEmail", () => {
|
|
10
|
-
it("basic email", () => {
|
|
11
|
-
expect(filterEmail("user@aloha.com")).toBe("<a href=\"mailto:user@aloha.com\">user@aloha.com</a>");
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it("email with CSS class", () => {
|
|
15
|
-
expect(filterEmail("contact@aloha.com", { linkClass: "email-link" })).toBe("<a href=\"mailto:contact@aloha.com\" class=\"email-link\">contact@aloha.com</a>");
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it("empty email", () => {
|
|
19
|
-
expect(filterEmail("")).toBe("");
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it("null email", () => {
|
|
23
|
-
expect(filterEmail(null)).toBe("");
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it("undefined email", () => {
|
|
27
|
-
expect(filterEmail(undefined)).toBe("");
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it("numeric value (invalid email)", () => {
|
|
31
|
-
expect(filterEmail(12345)).toBe("");
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it("email with special characters", () => {
|
|
35
|
-
expect(filterEmail("name.surname+filter@company.org")).toBe("<a href=\"mailto:name.surname+filter@company.org\">name.surname+filter@company.org</a>");
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it("email with combined class attribute", () => {
|
|
39
|
-
expect(filterEmail("hr@enterprise.net", { linkClass: "external contact" })).toBe("<a href=\"mailto:hr@enterprise.net\" class=\"external contact\">hr@enterprise.net</a>");
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
|
|
1
|
+
import {
|
|
2
|
+
describe,
|
|
3
|
+
expect,
|
|
4
|
+
it,
|
|
5
|
+
} from "vitest";
|
|
6
|
+
|
|
7
|
+
import filterEmail from "../filterEmail";
|
|
8
|
+
|
|
9
|
+
describe("filterEmail", () => {
|
|
10
|
+
it("basic email", () => {
|
|
11
|
+
expect(filterEmail("user@aloha.com")).toBe("<a href=\"mailto:user@aloha.com\">user@aloha.com</a>");
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("email with CSS class", () => {
|
|
15
|
+
expect(filterEmail("contact@aloha.com", { linkClass: "email-link" })).toBe("<a href=\"mailto:contact@aloha.com\" class=\"email-link\">contact@aloha.com</a>");
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("empty email", () => {
|
|
19
|
+
expect(filterEmail("")).toBe("");
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("null email", () => {
|
|
23
|
+
expect(filterEmail(null)).toBe("");
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("undefined email", () => {
|
|
27
|
+
expect(filterEmail(undefined)).toBe("");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("numeric value (invalid email)", () => {
|
|
31
|
+
expect(filterEmail(12345)).toBe("");
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("email with special characters", () => {
|
|
35
|
+
expect(filterEmail("name.surname+filter@company.org")).toBe("<a href=\"mailto:name.surname+filter@company.org\">name.surname+filter@company.org</a>");
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it("email with combined class attribute", () => {
|
|
39
|
+
expect(filterEmail("hr@enterprise.net", { linkClass: "external contact" })).toBe("<a href=\"mailto:hr@enterprise.net\" class=\"external contact\">hr@enterprise.net</a>");
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
describe,
|
|
3
|
-
expect,
|
|
4
|
-
it,
|
|
5
|
-
} from "
|
|
6
|
-
|
|
7
|
-
import filterEscapeHtml from "../filterEscapeHtml";
|
|
8
|
-
|
|
9
|
-
describe("filterEscapeHtml", () => {
|
|
10
|
-
it("should escape HTML special characters", () => {
|
|
11
|
-
const input = "<script>alert(\"XSS Attack\")</script>";
|
|
12
|
-
const expectedOutput = "<script>alert(\"XSS Attack\")</script>";
|
|
13
|
-
expect(filterEscapeHtml(input)).toBe(expectedOutput);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("should return the same string if no special characters", () => {
|
|
17
|
-
const input = "Hello, World!";
|
|
18
|
-
const expectedOutput = "Hello, World!";
|
|
19
|
-
expect(filterEscapeHtml(input)).toBe(expectedOutput);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it("should return an empty string if input is empty", () => {
|
|
23
|
-
const input = "";
|
|
24
|
-
const expectedOutput = "";
|
|
25
|
-
expect(filterEscapeHtml(input)).toBe(expectedOutput);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it("should escape only special HTML characters and leave the rest", () => {
|
|
29
|
-
const input = "Hello <strong>world</strong>";
|
|
30
|
-
const expectedOutput = "Hello <strong>world</strong>";
|
|
31
|
-
expect(filterEscapeHtml(input)).toBe(expectedOutput);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it("should handle special characters like &, \", '", () => {
|
|
35
|
-
const input = "Fish & Chips \"Delicious\"";
|
|
36
|
-
const expectedOutput = "Fish & Chips \"Delicious\"";
|
|
37
|
-
expect(filterEscapeHtml(input)).toBe(expectedOutput);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it("should escape HTML list tags", () => {
|
|
41
|
-
const input = "<ul><li>test</li></ul>";
|
|
42
|
-
const expectedOutput = "<ul><li>test</li></ul>";
|
|
43
|
-
expect(filterEscapeHtml(input)).toBe(expectedOutput);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
1
|
+
import {
|
|
2
|
+
describe,
|
|
3
|
+
expect,
|
|
4
|
+
it,
|
|
5
|
+
} from "vitest";
|
|
6
|
+
|
|
7
|
+
import filterEscapeHtml from "../filterEscapeHtml";
|
|
8
|
+
|
|
9
|
+
describe("filterEscapeHtml", () => {
|
|
10
|
+
it("should escape HTML special characters", () => {
|
|
11
|
+
const input = "<script>alert(\"XSS Attack\")</script>";
|
|
12
|
+
const expectedOutput = "<script>alert(\"XSS Attack\")</script>";
|
|
13
|
+
expect(filterEscapeHtml(input)).toBe(expectedOutput);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should return the same string if no special characters", () => {
|
|
17
|
+
const input = "Hello, World!";
|
|
18
|
+
const expectedOutput = "Hello, World!";
|
|
19
|
+
expect(filterEscapeHtml(input)).toBe(expectedOutput);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("should return an empty string if input is empty", () => {
|
|
23
|
+
const input = "";
|
|
24
|
+
const expectedOutput = "";
|
|
25
|
+
expect(filterEscapeHtml(input)).toBe(expectedOutput);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("should escape only special HTML characters and leave the rest", () => {
|
|
29
|
+
const input = "Hello <strong>world</strong>";
|
|
30
|
+
const expectedOutput = "Hello <strong>world</strong>";
|
|
31
|
+
expect(filterEscapeHtml(input)).toBe(expectedOutput);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("should handle special characters like &, \", '", () => {
|
|
35
|
+
const input = "Fish & Chips \"Delicious\"";
|
|
36
|
+
const expectedOutput = "Fish & Chips \"Delicious\"";
|
|
37
|
+
expect(filterEscapeHtml(input)).toBe(expectedOutput);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("should escape HTML list tags", () => {
|
|
41
|
+
const input = "<ul><li>test</li></ul>";
|
|
42
|
+
const expectedOutput = "<ul><li>test</li></ul>";
|
|
43
|
+
expect(filterEscapeHtml(input)).toBe(expectedOutput);
|
|
44
|
+
});
|
|
45
|
+
});
|