refactor(createComponent): rename to defineComponent (#549)
This commit is contained in:
@@ -2,7 +2,7 @@ import {
|
||||
createApp,
|
||||
h,
|
||||
nextTick,
|
||||
createComponent,
|
||||
defineComponent,
|
||||
vModelDynamic,
|
||||
withDirectives,
|
||||
VNode
|
||||
@@ -29,7 +29,7 @@ beforeEach(() => {
|
||||
|
||||
describe('vModel', () => {
|
||||
it('should work with text input', async () => {
|
||||
const component = createComponent({
|
||||
const component = defineComponent({
|
||||
data() {
|
||||
return { value: null }
|
||||
},
|
||||
@@ -60,7 +60,7 @@ describe('vModel', () => {
|
||||
})
|
||||
|
||||
it('should work with textarea', async () => {
|
||||
const component = createComponent({
|
||||
const component = defineComponent({
|
||||
data() {
|
||||
return { value: null }
|
||||
},
|
||||
@@ -91,7 +91,7 @@ describe('vModel', () => {
|
||||
})
|
||||
|
||||
it('should support modifiers', async () => {
|
||||
const component = createComponent({
|
||||
const component = defineComponent({
|
||||
data() {
|
||||
return { number: null, trim: null, lazy: null }
|
||||
},
|
||||
@@ -160,7 +160,7 @@ describe('vModel', () => {
|
||||
})
|
||||
|
||||
it('should work with checkbox', async () => {
|
||||
const component = createComponent({
|
||||
const component = defineComponent({
|
||||
data() {
|
||||
return { value: null }
|
||||
},
|
||||
@@ -201,7 +201,7 @@ describe('vModel', () => {
|
||||
})
|
||||
|
||||
it('should work with checkbox and true-value/false-value', async () => {
|
||||
const component = createComponent({
|
||||
const component = defineComponent({
|
||||
data() {
|
||||
return { value: null }
|
||||
},
|
||||
@@ -244,7 +244,7 @@ describe('vModel', () => {
|
||||
})
|
||||
|
||||
it('should work with checkbox and true-value/false-value with object values', async () => {
|
||||
const component = createComponent({
|
||||
const component = defineComponent({
|
||||
data() {
|
||||
return { value: null }
|
||||
},
|
||||
@@ -287,7 +287,7 @@ describe('vModel', () => {
|
||||
})
|
||||
|
||||
it(`should support array as a checkbox model`, async () => {
|
||||
const component = createComponent({
|
||||
const component = defineComponent({
|
||||
data() {
|
||||
return { value: [] }
|
||||
},
|
||||
@@ -357,7 +357,7 @@ describe('vModel', () => {
|
||||
})
|
||||
|
||||
it('should work with radio', async () => {
|
||||
const component = createComponent({
|
||||
const component = defineComponent({
|
||||
data() {
|
||||
return { value: null }
|
||||
},
|
||||
@@ -417,7 +417,7 @@ describe('vModel', () => {
|
||||
})
|
||||
|
||||
it('should work with single select', async () => {
|
||||
const component = createComponent({
|
||||
const component = defineComponent({
|
||||
data() {
|
||||
return { value: null }
|
||||
},
|
||||
@@ -473,7 +473,7 @@ describe('vModel', () => {
|
||||
})
|
||||
|
||||
it('should work with multiple select', async () => {
|
||||
const component = createComponent({
|
||||
const component = defineComponent({
|
||||
data() {
|
||||
return { value: [] }
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
withDirectives,
|
||||
createComponent,
|
||||
defineComponent,
|
||||
h,
|
||||
nextTick,
|
||||
VNode
|
||||
@@ -19,7 +19,7 @@ beforeEach(() => {
|
||||
|
||||
describe('runtime-dom: v-show directive', () => {
|
||||
test('should check show value is truthy', async () => {
|
||||
const component = createComponent({
|
||||
const component = defineComponent({
|
||||
data() {
|
||||
return { value: true }
|
||||
},
|
||||
@@ -35,7 +35,7 @@ describe('runtime-dom: v-show directive', () => {
|
||||
})
|
||||
|
||||
test('should check show value is falsy', async () => {
|
||||
const component = createComponent({
|
||||
const component = defineComponent({
|
||||
data() {
|
||||
return { value: false }
|
||||
},
|
||||
@@ -51,7 +51,7 @@ describe('runtime-dom: v-show directive', () => {
|
||||
})
|
||||
|
||||
it('should update show value changed', async () => {
|
||||
const component = createComponent({
|
||||
const component = defineComponent({
|
||||
data() {
|
||||
return { value: true }
|
||||
},
|
||||
@@ -100,7 +100,7 @@ describe('runtime-dom: v-show directive', () => {
|
||||
})
|
||||
|
||||
test('should respect display value in style attribute', async () => {
|
||||
const component = createComponent({
|
||||
const component = defineComponent({
|
||||
data() {
|
||||
return { value: true }
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// https://github.com/vuejs/vue/blob/dev/test/unit/features/directives/class.spec.js
|
||||
|
||||
import { h, render, createComponent } from '../../src'
|
||||
import { h, render, defineComponent } from '../../src'
|
||||
|
||||
type ClassItem = {
|
||||
value: string | object | string[]
|
||||
@@ -100,21 +100,21 @@ describe('class', () => {
|
||||
})
|
||||
|
||||
test('class merge between multiple nested components sharing same element', () => {
|
||||
const component1 = createComponent({
|
||||
const component1 = defineComponent({
|
||||
props: {},
|
||||
render() {
|
||||
return this.$slots.default()[0]
|
||||
}
|
||||
})
|
||||
|
||||
const component2 = createComponent({
|
||||
const component2 = defineComponent({
|
||||
props: {},
|
||||
render() {
|
||||
return this.$slots.default()[0]
|
||||
}
|
||||
})
|
||||
|
||||
const component3 = createComponent({
|
||||
const component3 = defineComponent({
|
||||
props: {},
|
||||
render() {
|
||||
return h(
|
||||
|
||||
Reference in New Issue
Block a user