@forsakringskassan/vue-lib-template 1.2.11 → 1.3.0

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.
@@ -4,7 +4,9 @@ import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import {
6
6
  Generator,
7
+ extractMarkdownProcessor,
7
8
  frontMatterFileReader,
9
+ manifestProcessor,
8
10
  vueFileReader,
9
11
  } from "@forsakringskassan/docs-generator";
10
12
  import pkg from "../package.json" with { type: "json" };
@@ -24,6 +26,12 @@ const docs = new Generator(import.meta.url, {
24
26
  "@fkui/logic",
25
27
  "@fkui/vue",
26
28
  ],
29
+ processors: [
30
+ extractMarkdownProcessor({
31
+ outputFolder: path.join(import.meta.dirname, "../dist/docs"),
32
+ }),
33
+ manifestProcessor(),
34
+ ],
27
35
  });
28
36
 
29
37
  docs.compileScript("main", "./src/main.js", {
@@ -10,11 +10,11 @@
10
10
  "@fkui/icon-lib-default": "6.58.0",
11
11
  "@fkui/vue": "6.58.0",
12
12
  "@forsakringskassan/apimock-express": "4.1.0",
13
- "@forsakringskassan/docs-generator": "3.10.1",
13
+ "@forsakringskassan/docs-generator": "3.11.1",
14
14
  "@tsconfig/node24": "24.0.5",
15
15
  "@tsconfig/recommended": "1.0.13",
16
16
  "http-server": "14.1.1",
17
17
  "msw": "2.15.0",
18
- "vue": "3.5.42"
18
+ "vue": "3.5.43"
19
19
  }
20
20
  }
@@ -20,6 +20,13 @@
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "import": "./dist/esm/index.esm.js"
22
22
  },
23
+ "./docs": {
24
+ "types": "./dist/docs/index.d.mts",
25
+ "import": "./dist/docs/index.mjs"
26
+ },
27
+ "./docs/links.json": {
28
+ "default": "./dist/docs/links.json"
29
+ },
23
30
  "./selectors": {
24
31
  "types": "./dist/types/selectors.d.ts",
25
32
  "import": "./dist/esm/selectors.esm.js"
@@ -57,7 +64,7 @@
57
64
  "postpublish": "release-postpublish",
58
65
  "start": "vite --",
59
66
  "start:docs": "npm start -w docs",
60
- "stylelint": "stylelint \"src/**/*.{css,scss}\"",
67
+ "stylelint": "stylelint \"src/**/*.{css,scss,vue}\"",
61
68
  "stylelint:fix": "npm run stylelint -- --fix",
62
69
  "pretest": "npm run lint",
63
70
  "test": "vitest run",
@@ -91,40 +98,40 @@
91
98
  "@forsakringskassan/commitlint-config": "4.2.8",
92
99
  "@forsakringskassan/cypress-config": "1.10.0",
93
100
  "@forsakringskassan/cypress-visual-regression": "5.2.0",
94
- "@forsakringskassan/docs-generator": "3.10.1",
101
+ "@forsakringskassan/docs-generator": "3.11.1",
95
102
  "@forsakringskassan/docs-live-example": "3.0.2",
96
- "@forsakringskassan/eslint-config": "15.9.10",
97
- "@forsakringskassan/eslint-config-cli": "15.9.3",
98
- "@forsakringskassan/eslint-config-cypress": "15.9.9",
99
- "@forsakringskassan/eslint-config-jest": "15.9.2",
100
- "@forsakringskassan/eslint-config-typescript": "15.9.8",
101
- "@forsakringskassan/eslint-config-typescript-typeinfo": "15.9.8",
102
- "@forsakringskassan/eslint-config-vitest": "15.9.4",
103
- "@forsakringskassan/eslint-config-vue": "15.9.8",
104
- "@forsakringskassan/prettier-config": "3.7.8",
105
- "@forsakringskassan/stylelint-config": "3.4.6",
103
+ "@forsakringskassan/eslint-config": "15.10.0",
104
+ "@forsakringskassan/eslint-config-cli": "15.10.0",
105
+ "@forsakringskassan/eslint-config-cypress": "15.10.0",
106
+ "@forsakringskassan/eslint-config-jest": "15.10.0",
107
+ "@forsakringskassan/eslint-config-typescript": "15.10.0",
108
+ "@forsakringskassan/eslint-config-typescript-typeinfo": "15.10.0",
109
+ "@forsakringskassan/eslint-config-vitest": "15.10.0",
110
+ "@forsakringskassan/eslint-config-vue": "15.10.0",
111
+ "@forsakringskassan/prettier-config": "3.7.10",
112
+ "@forsakringskassan/stylelint-config": "3.5.0",
106
113
  "@forsakringskassan/vite-lib-config": "5.12.4",
107
114
  "@forsakringskassan/vitest-config-jsdom": "5.0.0",
108
- "@forsakringskassan/vue-lib-template": "1.2.11",
109
- "@html-validate/release-scripts": "7.6.11",
110
- "@types/node": "24.13.4",
115
+ "@forsakringskassan/vue-lib-template": "1.3.0",
116
+ "@html-validate/release-scripts": "7.6.12",
117
+ "@types/node": "24.13.5",
111
118
  "@typescript/native": "npm:typescript@7.0.2",
112
- "@vue/server-renderer": "3.5.42",
113
- "@vue/test-utils": "2.5.0",
119
+ "@vue/server-renderer": "3.5.43",
120
+ "@vue/test-utils": "2.5.1",
114
121
  "cloneman": "1.24.1",
115
122
  "core-js": "3.50.0",
116
- "cypress": "16.0.0",
117
- "html-validate": "11.15.0",
123
+ "cypress": "16.1.0",
124
+ "html-validate": "11.16.0",
118
125
  "html-validate-markdown": "6.0.0",
119
126
  "html-validate-vue": "9.3.1",
120
127
  "mocha-junit-reporter": "2.2.1",
121
- "npm-pkg-lint": "5.2.5",
128
+ "npm-pkg-lint": "5.3.1",
122
129
  "npm-run-all2": "9.0.3",
123
130
  "rimraf": "6.1.3",
124
131
  "typescript": "npm:@typescript/typescript6@6.0.2",
125
132
  "vite": "8.3.0",
126
- "vitest": "5.0.0",
127
- "vue": "3.5.42",
133
+ "vitest": "5.0.1",
134
+ "vue": "3.5.43",
128
135
  "vue-tsc": "3.3.11"
129
136
  },
130
137
  "peerDependencies": {
@@ -0,0 +1,111 @@
1
+ import { TestPlugin, ValidationPlugin } from "@fkui/vue";
2
+ import { mount } from "@vue/test-utils";
3
+ import { beforeEach, expect, it, vi } from "vitest";
4
+ import FcCatInfoComponent from "../../components/guide/FcCatInfo/FcCatInfoComponent.vue";
5
+ import { catGetById } from "../../components/guide/FcCatInfo/cat-api";
6
+ import { cats } from "../../components/guide/FcCatInfo/cat-data";
7
+ import { FcCatInfoComponentSelectors } from "./FcCatInfoComponent.selectors";
8
+
9
+ vi.mock(import("../../components/guide/FcCatInfo/cat-api"));
10
+
11
+ beforeEach(() => {
12
+ vi.mocked(catGetById).mockResolvedValue(cats[0]);
13
+ });
14
+
15
+ it("should use the default selector", () => {
16
+ expect.assertions(2);
17
+ const wrapper = mount(FcCatInfoComponent, {
18
+ props: { catId: cats[0].id },
19
+ });
20
+ const { selector } = FcCatInfoComponentSelectors();
21
+
22
+ expect(selector).toBe(":scope");
23
+ expect(wrapper.find(selector).exists()).toBe(true);
24
+ });
25
+
26
+ it("should find the component with an explicit selector", () => {
27
+ expect.assertions(2);
28
+ const wrapper = mount(FcCatInfoComponent, {
29
+ attrs: { "data-test": "my-cat-info" },
30
+ props: { catId: cats[0].id },
31
+ });
32
+ const { selector } = FcCatInfoComponentSelectors(
33
+ '[data-test="my-cat-info"]',
34
+ );
35
+
36
+ expect(selector).toBe('[data-test="my-cat-info"]');
37
+ expect(wrapper.find(selector).exists()).toBe(true);
38
+ });
39
+
40
+ it("should find the loading container", () => {
41
+ expect.assertions(1);
42
+ const wrapper = mount(FcCatInfoComponent, {
43
+ props: { catId: cats[0].id },
44
+ });
45
+ const { loadingContainer } = FcCatInfoComponentSelectors();
46
+
47
+ expect(wrapper.get(loadingContainer()).text()).toContain(
48
+ "Hämtar kattinformation...",
49
+ );
50
+ });
51
+
52
+ it("should find all view mode elements", async () => {
53
+ expect.assertions(5);
54
+ const wrapper = mount(FcCatInfoComponent, {
55
+ props: { catId: cats[0].id, isEditable: false },
56
+ });
57
+ const selectors = FcCatInfoComponentSelectors();
58
+
59
+ await vi.waitFor(() => {
60
+ if (!wrapper.find(selectors.viewContainer()).exists()) {
61
+ throw new Error("View container has not been rendered yet");
62
+ }
63
+ });
64
+
65
+ const view = wrapper.get(selectors.viewContainer());
66
+ expect(view.text()).toContain(cats[0].name);
67
+ expect(view.text()).toContain(`${cats[0].age} år`);
68
+ expect(view.text()).toContain(cats[0].breed);
69
+ expect(view.text()).toContain(cats[0].color);
70
+ expect(view.text()).toContain(cats[0].favoriteFood);
71
+ });
72
+
73
+ it("should find all edit mode inputs", async () => {
74
+ expect.assertions(6);
75
+ const wrapper = mount(FcCatInfoComponent, {
76
+ props: { catId: cats[0].id, isEditable: true },
77
+ global: {
78
+ plugins: [TestPlugin, ValidationPlugin],
79
+ },
80
+ });
81
+ const selectors = FcCatInfoComponentSelectors();
82
+
83
+ await vi.waitFor(() => {
84
+ if (!wrapper.find(selectors.editContainer()).exists()) {
85
+ throw new Error("Edit container has not been rendered yet");
86
+ }
87
+ });
88
+
89
+ expect(wrapper.find(selectors.editContainer()).exists()).toBe(true);
90
+
91
+ expect(
92
+ wrapper.get<HTMLInputElement>(selectors.nameInput()).element.value,
93
+ ).toBe(cats[0].name);
94
+
95
+ expect(
96
+ wrapper.get<HTMLInputElement>(selectors.ageInput()).element.value,
97
+ ).toBe(cats[0].age.toString());
98
+
99
+ expect(
100
+ wrapper.get<HTMLInputElement>(selectors.breedInput()).element.value,
101
+ ).toBe(cats[0].breed);
102
+
103
+ expect(
104
+ wrapper.get<HTMLInputElement>(selectors.colorInput()).element.value,
105
+ ).toBe(cats[0].color);
106
+
107
+ expect(
108
+ wrapper.get<HTMLInputElement>(selectors.favoriteFoodInput()).element
109
+ .value,
110
+ ).toBe(cats[0].favoriteFood);
111
+ });
package/index.js CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  const options = {
9
9
  ...packageJson.cloneman,
10
- fileHash: "c8696b477625b5dc20f234843d09017230ad3dbd962739042e8d0f82b0166b2a",
10
+ fileHash: "3ed96f7ccd01c366c430cf3081cbf47d160888c6d793dc177709a483b78000f9",
11
11
  filesDir: path.join(import.meta.dirname, "files"),
12
12
  hooksDir: path.join(import.meta.dirname, "hooks"),
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/vue-lib-template",
3
- "version": "1.2.11",
3
+ "version": "1.3.0",
4
4
  "description": "Vue library template based on Cloneman",
5
5
  "keywords": [
6
6
  "template",
@@ -91,6 +91,7 @@
91
91
  "src/mocks/guide/cat-api.mock.mts",
92
92
  "src/mocks/guide/index.mts",
93
93
  "src/mocks/index.mts",
94
+ "src/selectors/guide/FcCatInfoComponent.selectors.spec.ts",
94
95
  "src/selectors/guide/FcCatInfoComponent.selectors.ts",
95
96
  "src/selectors/guide/index.ts",
96
97
  "src/selectors/index.ts",