-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8762db2
commit b622349
Showing
76 changed files
with
1,796 additions
and
1,299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 4 additions & 3 deletions
7
.../component/state/__tests__/format.spec.ts → ...ls-kit/__tests__/component/format.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
import Name from './components/Name.vue' | ||
const count = ref(0) | ||
const visible = ref(true) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
Hi {{ count }} | ||
|
||
<Name v-if="visible" /> | ||
</div> | ||
</template> |
11 changes: 11 additions & 0 deletions
11
packages/devtools-kit/__tests__/fixtures/components/Name.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
const name = ref('devtools') | ||
</script> | ||
|
||
<template> | ||
<div> | ||
{{ name }} | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { devtools } from '@vue/devtools-kit' | ||
import { mount } from '@vue/test-utils' | ||
import { resetDevToolsState } from '../src/state' | ||
import App from './fixtures/App.vue' | ||
|
||
describe('hook', () => { | ||
beforeAll(() => { | ||
devtools.init() | ||
}) | ||
afterEach(() => { | ||
resetDevToolsState() | ||
}) | ||
it('should work w/ app init hook', async () => { | ||
await new Promise<void>((resolve) => { | ||
devtools.hook.on.vueAppInit((app, version) => { | ||
expect(app).toBeTypeOf('object') | ||
expect(version).toBeTypeOf('string') | ||
resolve() | ||
}) | ||
mount(App, { | ||
attachTo: document.body, | ||
}) | ||
}) | ||
}) | ||
|
||
it('should work w/ component updated hook', async () => { | ||
await new Promise<void>((resolve) => { | ||
devtools.hook.on.componentUpdated((_, __, ___, component) => { | ||
expect(component.setupState.count).toBe(10) | ||
resolve() | ||
}) | ||
|
||
const app = mount<{}, { }, { count: number, visible: boolean }>(App, { | ||
attachTo: document.body, | ||
}) | ||
app.vm.count = 10 | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { devtools } from '@vue/devtools-kit' | ||
import { mount } from '@vue/test-utils' | ||
import { resetDevToolsState } from '../src/state' | ||
import App from './fixtures/App.vue' | ||
|
||
describe('app record', () => { | ||
beforeAll(() => { | ||
devtools.init() | ||
}) | ||
afterEach(() => { | ||
resetDevToolsState() | ||
}) | ||
it('should work', async () => { | ||
await new Promise<void>((resolve) => { | ||
devtools.hook.on.vueAppInit(() => { | ||
const records = devtools.state.appRecords | ||
expect(records.length).toBe(1) | ||
expect(devtools.state.connected).toBe(true) | ||
resolve() | ||
}) | ||
mount(App, { | ||
attachTo: document.body, | ||
}) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { DevToolsContext, DevToolsEnv, DevToolsHook, DevToolsState, Router, RouterInfo } from './src/types' | ||
|
||
/* eslint-disable vars-on-top, no-var */ | ||
declare global { | ||
var __VUE_DEVTOOLS_GLOBAL_HOOK__: DevToolsHook | ||
var __VUE_DEVTOOLS_GLOBAL_STATE__: DevToolsState | ||
var __VUE_DEVTOOLS_CONTEXT__: DevToolsContext | ||
var __VUE_DEVTOOLS_APP_RECROD_INFO__: { | ||
id: number | ||
appIds: Set<string> | ||
} | ||
var __VUE_DEVTOOLS_ROUTER__: Router | null | ||
var __VUE_DEVTOOLS_ROUTER_INFO__: RouterInfo | ||
var __VUE_DEVTOOLS_ENV__: DevToolsEnv | ||
var __VUE_DEVTOOLS_COMPONENT_INSPECTOR_ENABLED__: boolean | ||
var __VUE_DEVTOOLS_VITE_PLUGIN_DETECTED__: boolean | ||
var __VUE_DEVTOOLS_VITE_PLUGIN_CLIENT_URL__: string | ||
var __VUE_DEVTOOLS_BROWSER_EXTENSION_DETECTED__: boolean | ||
} | ||
|
||
export { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.