diff --git a/packages/varlet-cli/src/commands/create.ts b/packages/varlet-cli/src/commands/create.ts
index 4147550ded7..5d74f6802f1 100644
--- a/packages/varlet-cli/src/commands/create.ts
+++ b/packages/varlet-cli/src/commands/create.ts
@@ -40,11 +40,18 @@ export default ${bigCamelize(name)}
const testsTemplate = `\
import example from '../example'
-import { render } from '@testing-library/vue'
+import ${bigCamelize(name)} from '..'
+import { mount } from '@vue/test-utils'
+import { createApp } from 'vue'
+
+test('test ${camelize(name)} example', () => {
+ const wrapper = mount(example)
+ expect(wrapper.html()).toMatchSnapshot()
+})
-test('test ${camelize(name)} example', async () => {
- const wrapper = render(example)
- console.log(wrapper)
+test('test ${camelize(name)} plugin', () => {
+ const app = createApp({}).use(${bigCamelize(name)})
+ expect(app.component(${bigCamelize(name)}.name)).toBeTruthy()
})
`
diff --git a/packages/varlet-ui/src/button/__tests__/__snapshots__/index.spec.js.snap b/packages/varlet-ui/src/button/__tests__/__snapshots__/index.spec.js.snap
index c4d406a6856..8f75ef5e655 100644
--- a/packages/varlet-ui/src/button/__tests__/__snapshots__/index.spec.js.snap
+++ b/packages/varlet-ui/src/button/__tests__/__snapshots__/index.spec.js.snap
@@ -154,9 +154,9 @@ exports[`test button example 1`] = `
"
`;
-exports[`test button size & text & block & round 1`] = `
+exports[`test button styles 1`] = `
""
`;
diff --git a/packages/varlet-ui/src/button/__tests__/index.spec.js b/packages/varlet-ui/src/button/__tests__/index.spec.js
index e506ca9d911..3fba5ce72e8 100644
--- a/packages/varlet-ui/src/button/__tests__/index.spec.js
+++ b/packages/varlet-ui/src/button/__tests__/index.spec.js
@@ -14,7 +14,7 @@ test('test button plugin', () => {
expect(app.component(Button.name)).toBeTruthy()
})
-test('test button click & touchstart', () => {
+test('test button onClick & onTouchstart null callback', () => {
const wrapper = mount(VarButton)
wrapper.trigger('click')
wrapper.trigger('touchstart')
@@ -82,7 +82,7 @@ test('test button color & textColor', () => {
expect(wrapper.html()).toMatchSnapshot()
})
-test('test button size & text & block & round', () => {
+test('test button styles', () => {
const wrapper = mount(VarButton, {
props: {
size: 'large',
@@ -90,6 +90,9 @@ test('test button size & text & block & round', () => {
text: true,
block: true,
},
+ slots: {
+ default: () => 'button text',
+ },
})
expect(wrapper.html()).toMatchSnapshot()
diff --git a/packages/varlet-ui/src/input/Input.vue b/packages/varlet-ui/src/input/Input.vue
index c97584e8e5a..5d339011d58 100644
--- a/packages/varlet-ui/src/input/Input.vue
+++ b/packages/varlet-ui/src/input/Input.vue
@@ -48,8 +48,11 @@
@change="handleChange"
/>