Skip to content

Commit 6c91101

Browse files
committed
test app for vue ts
1 parent e03d133 commit 6c91101

File tree

22 files changed

+643
-5
lines changed

22 files changed

+643
-5
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock.json

src/components/Image.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const imgData = computed(() => {
6363
transformationPosition,
6464
});
6565
66-
return { src: normalSrc, loading };
66+
return { src: normalSrc, loading, width };
6767
}
6868
6969
const widthInt = getInt(width);
@@ -80,7 +80,7 @@ const imgData = computed(() => {
8080
imageBreakpoints,
8181
});
8282
83-
return { responsive, src: newSrc, loading, srcSet, sizes };
83+
return { responsive, src: newSrc, loading, srcSet, sizes, width };
8484
});
8585
8686
/* ------------------------------------------------------------------ */
@@ -97,7 +97,6 @@ const IK_KEYS = [
9797
"responsive",
9898
"deviceBreakpoints",
9999
"imageBreakpoints",
100-
"width",
101100
] as const;
102101
103102
const attrs = useAttrs();
@@ -112,6 +111,7 @@ const nonIKAttrs = computed(() => {
112111
</script>
113112

114113
<template>
115-
<img v-bind="nonIKAttrs" :loading="imgData.loading" :src="imgData.src"
116-
:srcset="imgData.responsive ? imgData.srcSet : undefined" :sizes="imgData.responsive ? imgData.sizes : undefined" />
114+
<img v-bind="nonIKAttrs" :width="width" :loading="imgData.loading"
115+
:sizes="imgData.responsive ? imgData.sizes : undefined" :srcset="imgData.responsive ? imgData.srcSet : undefined"
116+
:src="imgData.src" />
117117
</template>

temp.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
npm run build
2+
cd test-apps/vue-ts
3+
npm i ../../imagekit-vue-4.0.0-beta.1.tgz --no-save

test-apps/vue-ts/.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
.DS_Store
12+
dist
13+
dist-ssr
14+
coverage
15+
*.local
16+
17+
/cypress/videos/
18+
/cypress/screenshots/
19+
20+
# Editor directories and files
21+
.vscode/*
22+
!.vscode/extensions.json
23+
.idea
24+
*.suo
25+
*.ntvs*
26+
*.njsproj
27+
*.sln
28+
*.sw?
29+
30+
*.tsbuildinfo
31+
32+
package-lock.json
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["Vue.volar"]
3+
}

test-apps/vue-ts/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# .
2+
3+
This template should help get you started developing with Vue 3 in Vite.
4+
5+
## Recommended IDE Setup
6+
7+
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
8+
9+
## Type Support for `.vue` Imports in TS
10+
11+
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.
12+
13+
## Customize configuration
14+
15+
See [Vite Configuration Reference](https://vite.dev/config/).
16+
17+
## Project Setup
18+
19+
```sh
20+
npm install
21+
```
22+
23+
### Compile and Hot-Reload for Development
24+
25+
```sh
26+
npm run dev
27+
```
28+
29+
### Type-Check, Compile and Minify for Production
30+
31+
```sh
32+
npm run build
33+
```

test-apps/vue-ts/e2e/test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { test, expect } from "@playwright/test";
2+
3+
test("CSR test case", async ({ page }) => {
4+
await page.goto("/csr");
5+
6+
// Scroll to the bottom of the page
7+
await page.evaluate(() => {
8+
window.scrollTo(0, document.body.scrollHeight);
9+
});
10+
11+
await page.waitForTimeout(2000); // Wait for 2 seconds
12+
13+
14+
// Locate the output element (adjust selector as needed)
15+
const outputElement = page.locator('.container');
16+
17+
// Grab the entire HTML from the element
18+
const outputHtml = await outputElement.evaluate(el => el.outerHTML);
19+
20+
// Compare against a stored snapshot
21+
expect(outputHtml).toMatchSnapshot();
22+
});

test-apps/vue-ts/env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference types="vite/client" />

test-apps/vue-ts/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="">
3+
<head>
4+
<meta charset="UTF-8">
5+
<link rel="icon" href="/favicon.ico">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Vite App</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/main.ts"></script>
12+
</body>
13+
</html>

test-apps/vue-ts/package.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "test",
3+
"version": "0.0.0",
4+
"private": true,
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "run-p type-check \"build-only {@}\" --",
9+
"start": "npm run build && npm run preview",
10+
"preview": "vite preview",
11+
"build-only": "vite build",
12+
"type-check": "vue-tsc --build"
13+
},
14+
"dependencies": {
15+
"@playwright/test": "^1.52.0",
16+
"vue": "^3.5.13"
17+
},
18+
"devDependencies": {
19+
"@tsconfig/node22": "^22.0.1",
20+
"@types/node": "^22.14.0",
21+
"@vitejs/plugin-vue": "^5.2.3",
22+
"@vue/tsconfig": "^0.7.0",
23+
"npm-run-all2": "^7.0.2",
24+
"typescript": "~5.8.0",
25+
"vite": "^6.2.4",
26+
"vite-plugin-vue-devtools": "^7.7.2",
27+
"vue-tsc": "^2.2.8"
28+
}
29+
}

0 commit comments

Comments
 (0)