-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow plugins to specify if they should be transformed (#469)
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
- Loading branch information
1 parent
51397ee
commit f1b5474
Showing
10 changed files
with
322 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "sb-vue", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"test": "vitest" | ||
}, | ||
"devDependencies": { | ||
"@vitejs/plugin-vue": "^2.0.1", | ||
"@vitejs/plugin-vue-jsx": "^1.3.3", | ||
"@vue/test-utils": "^2.0.0-rc.18", | ||
"happy-dom": "*", | ||
"vite": "^2.7.10", | ||
"vue": "^3.2.26", | ||
"vitest": "workspace:*" | ||
} | ||
} |
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,30 @@ | ||
import { defineComponent, ref, watchEffect } from 'vue' | ||
|
||
export default defineComponent({ | ||
name: 'TestComponent', | ||
props: { | ||
value: String, | ||
}, | ||
emits: ['update:value'], | ||
setup(props, { emit }) { | ||
const local = ref('') | ||
|
||
watchEffect(() => { | ||
emit('update:value', local) | ||
}) | ||
watchEffect(() => { | ||
local.value = props.value! | ||
}) | ||
|
||
return { | ||
local, | ||
} | ||
}, | ||
render() { | ||
return ( | ||
<a-select v-model={[this.local, 'value']}> | ||
<a-select-option value="aaa">aaa</a-select-option> | ||
</a-select> | ||
) | ||
}, | ||
}) |
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,3 @@ | ||
// Vitest Snapshot v1 | ||
|
||
exports[`mount component 1`] = `"<a-select-stub value=\\"test\\"></a-select-stub>"`; |
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,16 @@ | ||
import { shallowMount } from '@vue/test-utils' | ||
import { expect, test } from 'vitest' | ||
import Case from '../src/Case' | ||
|
||
test('mount component', () => { | ||
const wrapper = shallowMount(Case, { | ||
props: { | ||
value: 'test', | ||
}, | ||
global: { | ||
stubs: ['a-select', 'a-select-option'], | ||
}, | ||
}) | ||
|
||
expect(wrapper.html()).toMatchSnapshot() | ||
}) |
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,19 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "esnext", | ||
"module": "esnext", | ||
"lib": ["esnext", "dom"], | ||
"moduleResolution": "node", | ||
"esModuleInterop": true, | ||
"strict": true, | ||
"strictNullChecks": true, | ||
"resolveJsonModule": true, | ||
"skipDefaultLibCheck": true, | ||
"skipLibCheck": true, | ||
"outDir": "./dist", | ||
"declaration": true, | ||
"inlineSourceMap": true, | ||
"jsx": "preserve" | ||
}, | ||
"exclude": ["node_modules"] | ||
} |
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,14 @@ | ||
import { defineConfig } from 'vite' | ||
import Vue from '@vitejs/plugin-vue' | ||
import Jsx from '@vitejs/plugin-vue-jsx' | ||
|
||
export default defineConfig({ | ||
plugins: [Vue(), Jsx()], | ||
test: { | ||
global: true, | ||
environment: 'happy-dom', | ||
transformMode: { | ||
web: [/.[tj]sx$/], | ||
}, | ||
}, | ||
}) |
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
Oops, something went wrong.