Skip to content

Commit 8ba52ea

Browse files
chore: wip
1 parent a098844 commit 8ba52ea

File tree

7 files changed

+105
-0
lines changed

7 files changed

+105
-0
lines changed

bun.lock

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@
6767
"packages/vue": {
6868
"name": "ts-maps-vue",
6969
"version": "0.1.6",
70+
"dependencies": {
71+
"bun-types": "^1.2.20",
72+
},
7073
"devDependencies": {
74+
"@happy-dom/global-registrator": "^18.0.1",
7175
"@microsoft/api-extractor": "^7.52.5",
7276
"@stacksjs/docs": "^0.70.23",
7377
"@stacksjs/eslint-config": "^4.2.1-beta.1",
@@ -452,6 +456,8 @@
452456

453457
"@floating-ui/utils": ["@floating-ui/[email protected]", "", {}, "sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ=="],
454458

459+
"@happy-dom/global-registrator": ["@happy-dom/[email protected]", "", { "dependencies": { "@types/node": "^20.0.0", "happy-dom": "^18.0.1" } }, "sha512-xCy/cpEP8xyJ6u0eokYgaQxeUmcKqHx/+aC3R0DLa7/S38efhZAVDQqLJ5zzTguLFS0gvAzZHP40NGaLwRyapQ=="],
460+
455461
"@humanfs/core": ["@humanfs/[email protected]", "", {}, "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA=="],
456462

457463
"@humanfs/node": ["@humanfs/[email protected]", "", { "dependencies": { "@humanfs/core": "^0.19.1", "@humanwhocodes/retry": "^0.3.0" } }, "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw=="],
@@ -3138,6 +3144,8 @@
31383144

31393145
"@eslint/plugin-kit/@eslint/core": ["@eslint/[email protected]", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-78Md3/Rrxh83gCxoUc0EiciuOHsIITzLy53m3d9UyiW8y9Dj2D29FeETqyKA+BRK76tnTp6RXWb3pCay8Oyomg=="],
31403146

3147+
"@happy-dom/global-registrator/@types/node": ["@types/[email protected]", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-uug3FEEGv0r+jrecvUUpbY8lLisvIjg6AAic6a2bSP5OEOLeJsDSnvhCDov7ipFFMXS3orMpzlmi0ZcuGkBbow=="],
3148+
31413149
"@humanfs/node/@humanwhocodes/retry": ["@humanwhocodes/[email protected]", "", {}, "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA=="],
31423150

31433151
"@iconify/utils/@antfu/utils": ["@antfu/[email protected]", "", {}, "sha512-Mex9nXf9vR6AhcXmMrlz/HVgYYZpVGJ6YlPgwl7UnaFpnshXs6EK/oa5Gpf3CzENMjkvEx2tQtntGnb7UtSTOQ=="],
@@ -3566,6 +3574,8 @@
35663574

35673575
"@electron/get/fs-extra/universalify": ["[email protected]", "", {}, "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="],
35683576

3577+
"@happy-dom/global-registrator/@types/node/undici-types": ["[email protected]", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
3578+
35693579
"@isaacs/cliui/string-width/emoji-regex": ["[email protected]", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
35703580

35713581
"@isaacs/cliui/wrap-ansi/ansi-styles": ["[email protected]", "", {}, "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug=="],

bunfig.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
[install]
22
registry = { url = "https://registry.npmjs.org/", token = "$BUN_AUTH_TOKEN" }
3+
4+
[test]
5+
preload = [ "./packages/vue/happydom.ts" ]

packages/vue/.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# dependencies (bun install)
2+
node_modules
3+
4+
# output
5+
out
6+
dist
7+
*.tgz
8+
9+
# code coverage
10+
coverage
11+
*.lcov
12+
13+
# logs
14+
logs
15+
_.log
16+
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
17+
18+
# dotenv environment variable files
19+
.env
20+
.env.development.local
21+
.env.test.local
22+
.env.production.local
23+
.env.local
24+
25+
# caches
26+
.eslintcache
27+
.cache
28+
*.tsbuildinfo
29+
30+
# IntelliJ based IDEs
31+
.idea
32+
33+
# Finder (MacOS) folder config
34+
.DS_Store

packages/vue/bunfig.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[test]
2+
preload = "./happydom.ts"

packages/vue/happydom.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { GlobalRegistrator } from '@happy-dom/global-registrator'
2+
3+
GlobalRegistrator.register()

packages/vue/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@
3838
"lint:fix": "bunx --bun eslint . --fix",
3939
"test": "bun test"
4040
},
41+
"dependencies": {
42+
"bun-types": "^1.2.20"
43+
},
4144
"devDependencies": {
45+
"@happy-dom/global-registrator": "^18.0.1",
4246
"@microsoft/api-extractor": "^7.52.5",
4347
"@stacksjs/docs": "^0.70.23",
4448
"@stacksjs/eslint-config": "^4.2.1-beta.1",

packages/vue/test/dom.test.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/// <reference lib="dom" />
2+
3+
import { expect, test } from 'bun:test'
4+
5+
test('DOM environment is working', () => {
6+
document.body.innerHTML = `<button>My button</button>`
7+
const button = document.querySelector('button')
8+
expect(button?.textContent).toEqual('My button')
9+
})
10+
11+
test('can create and manipulate DOM elements', () => {
12+
const container = document.createElement('div')
13+
container.id = 'map-container'
14+
container.style.width = '800px'
15+
container.style.height = '600px'
16+
container.style.position = 'relative'
17+
18+
document.body.appendChild(container)
19+
20+
expect(container).toBeDefined()
21+
expect(container.id).toBe('map-container')
22+
expect(container.style.width).toBe('800px')
23+
expect(container.style.height).toBe('600px')
24+
expect(container.style.position).toBe('relative')
25+
})
26+
27+
test('can handle map container styling', () => {
28+
const mapDiv = document.createElement('div')
29+
mapDiv.setAttribute('data-testid', 'map-container')
30+
mapDiv.style.width = '100%'
31+
mapDiv.style.height = '400px'
32+
33+
document.body.appendChild(mapDiv)
34+
35+
expect(mapDiv.getAttribute('data-testid')).toBe('map-container')
36+
expect(mapDiv.style.width).toBe('100%')
37+
expect(mapDiv.style.height).toBe('400px')
38+
})
39+
40+
test('can create loading state element', () => {
41+
const loadingDiv = document.createElement('div')
42+
loadingDiv.className = 'ts-maps-loading'
43+
loadingDiv.textContent = 'Loading map...'
44+
45+
document.body.appendChild(loadingDiv)
46+
47+
expect(loadingDiv.className).toBe('ts-maps-loading')
48+
expect(loadingDiv.textContent).toBe('Loading map...')
49+
})

0 commit comments

Comments
 (0)