@forsakringskassan/vue-lib-template 1.6.3 → 1.7.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/files/package.json +1 -1
- package/files/src/components/guide/cat-info/cat-api.spec.ts +4 -1
- package/files/src/components/guide/cat-info/examples/cat-info-example.vue +1 -1
- package/files/src/components/guide/cat-info/examples/cat-info-live-example.vue +1 -3
- package/hooks/install.mjs +10 -0
- package/index.js +1 -1
- package/package.json +2 -2
- package/files/src/vite-dev/app.vue +0 -15
package/files/package.json
CHANGED
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"@forsakringskassan/stylelint-config": "3.5.1",
|
|
112
112
|
"@forsakringskassan/vite-lib-config": "5.13.0",
|
|
113
113
|
"@forsakringskassan/vitest-config-jsdom": "5.0.1",
|
|
114
|
-
"@forsakringskassan/vue-lib-template": "1.
|
|
114
|
+
"@forsakringskassan/vue-lib-template": "1.7.1",
|
|
115
115
|
"@html-validate/release-scripts": "7.6.12",
|
|
116
116
|
"@types/node": "24.19.1",
|
|
117
117
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
-
import { catGetById } from "./cat-api";
|
|
3
2
|
|
|
4
3
|
describe("catGetById", () => {
|
|
5
4
|
vi.stubEnv("VITE_CAT_API_URL", "/api/cat");
|
|
@@ -10,6 +9,7 @@ describe("catGetById", () => {
|
|
|
10
9
|
|
|
11
10
|
it("should return a cat when the response is ok", async () => {
|
|
12
11
|
expect.assertions(2);
|
|
12
|
+
const { catGetById } = await import("./cat-api");
|
|
13
13
|
const mockCat = {
|
|
14
14
|
id: "whiskers-001",
|
|
15
15
|
name: "Whiskers McFluffington",
|
|
@@ -32,6 +32,7 @@ describe("catGetById", () => {
|
|
|
32
32
|
|
|
33
33
|
it("should throw an error with API message when response is not ok", async () => {
|
|
34
34
|
expect.assertions(1);
|
|
35
|
+
const { catGetById } = await import("./cat-api");
|
|
35
36
|
const errorResponse = { error: "Cat with ID 'unknown' not found" };
|
|
36
37
|
|
|
37
38
|
vi.mocked(fetch).mockResolvedValue({
|
|
@@ -46,6 +47,7 @@ describe("catGetById", () => {
|
|
|
46
47
|
|
|
47
48
|
it("should throw a generic error when response is not ok and no error message is provided", async () => {
|
|
48
49
|
expect.assertions(1);
|
|
50
|
+
const { catGetById } = await import("./cat-api");
|
|
49
51
|
vi.mocked(fetch).mockResolvedValue({
|
|
50
52
|
ok: false,
|
|
51
53
|
json: () => Promise.resolve({}),
|
|
@@ -58,6 +60,7 @@ describe("catGetById", () => {
|
|
|
58
60
|
|
|
59
61
|
it("should throw an error when fetch fails", async () => {
|
|
60
62
|
expect.assertions(1);
|
|
63
|
+
const { catGetById } = await import("./cat-api");
|
|
61
64
|
vi.mocked(fetch).mockRejectedValue(new Error("Network failure"));
|
|
62
65
|
|
|
63
66
|
await expect(catGetById("whiskers-001")).rejects.toThrow(
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import { defineComponent } from "vue";
|
|
3
3
|
import { FCheckboxField, FSelectField } from "@fkui/vue";
|
|
4
4
|
import { LiveExample } from "@forsakringskassan/docs-live-example";
|
|
5
|
-
import {
|
|
6
|
-
import FcCatInfo from "../cat-info.vue";
|
|
5
|
+
import { FcCatInfo } from "@forsakringskassan/vue-lib-template";
|
|
7
6
|
|
|
8
7
|
export default defineComponent({
|
|
9
8
|
name: "FcCatInfoLiveExample",
|
|
@@ -12,7 +11,6 @@ export default defineComponent({
|
|
|
12
11
|
return {
|
|
13
12
|
selectedCatId: "whiskers-001",
|
|
14
13
|
isEditable: false,
|
|
15
|
-
catIds: getCatIds(),
|
|
16
14
|
};
|
|
17
15
|
},
|
|
18
16
|
computed: {
|
package/hooks/install.mjs
CHANGED
|
@@ -38,6 +38,16 @@ export async function install(context ) {
|
|
|
38
38
|
await replaceInFile("tsconfig.lib.json", placeholder, quotedName);
|
|
39
39
|
await replaceInFile("tsconfig.cypress.json", placeholder, quotedName);
|
|
40
40
|
await replaceInFile("tsconfig.selectors.json", placeholder, quotedName);
|
|
41
|
+
await replaceInFile(
|
|
42
|
+
"src/components/guide/cat-info/examples/cat-info-example.vue",
|
|
43
|
+
placeholder,
|
|
44
|
+
quotedName,
|
|
45
|
+
);
|
|
46
|
+
await replaceInFile(
|
|
47
|
+
"src/components/guide/cat-info/examples/cat-info-live-example.vue",
|
|
48
|
+
placeholder,
|
|
49
|
+
quotedName,
|
|
50
|
+
);
|
|
41
51
|
|
|
42
52
|
/* enable deployment of documentation if a documentation url is provided */
|
|
43
53
|
await enableDeployDocs(context);
|
package/index.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
const options = {
|
|
9
9
|
...packageJson.cloneman,
|
|
10
|
-
fileHash: "
|
|
10
|
+
fileHash: "9936efbee4f4c6a825ed9be0159331c8b2cdb765b2c0776a1ae06a226f9e6bc6",
|
|
11
11
|
apiVersion: 0,
|
|
12
12
|
clonemanVersion: "1.27.0",
|
|
13
13
|
filesDir: path.join(import.meta.dirname, "files"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forsakringskassan/vue-lib-template",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"description": "Vue library template based on Cloneman",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"template",
|
|
@@ -101,7 +101,6 @@
|
|
|
101
101
|
"src/selectors/index.ts",
|
|
102
102
|
"src/style.scss",
|
|
103
103
|
"src/theme.scss",
|
|
104
|
-
"src/vite-dev/app.vue",
|
|
105
104
|
"src/vite-env.d.ts",
|
|
106
105
|
"tsconfig.cypress.json",
|
|
107
106
|
"tsconfig.json",
|
|
@@ -202,6 +201,7 @@
|
|
|
202
201
|
"project.code-workspace",
|
|
203
202
|
"tsconfig-consumer.json",
|
|
204
203
|
"vite.config.ts",
|
|
204
|
+
"src/vite-dev/app.vue",
|
|
205
205
|
"cypress/support/commands/forced-colors.ts",
|
|
206
206
|
"cypress/support/component-index.html",
|
|
207
207
|
"cypress/types/cy-mount.d.ts",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { ref } from "vue";
|
|
3
|
-
import { FTextField } from "@fkui/vue";
|
|
4
|
-
|
|
5
|
-
const namn = ref("Vue lib template");
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<template>
|
|
9
|
-
<div class="container">
|
|
10
|
-
<h1>Development application</h1>
|
|
11
|
-
|
|
12
|
-
<f-text-field v-model="namn" v-validation.required maxlength="100"> Namn </f-text-field>
|
|
13
|
-
<pre>Hello {{ namn }}!</pre>
|
|
14
|
-
</div>
|
|
15
|
-
</template>
|