Skip to content

Commit 7d826de

Browse files
committed
✨ Infer component name from class
1 parent 95ab564 commit 7d826de

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ function ComponentOption(cons: Cons, extend?: any) {
3939
return optionBuilder.setup!(props, ctx)
4040
} : undefined
4141
const raw = {
42+
name: cons.name,
4243
setup: setupFunction,
4344
data() {
4445
delete optionBuilder.data

test/component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ describe('Component',
6868
expect(true).to.equal(isEmptyObject(EmptyContext[key]()))
6969
} else if (key === '__vfdConstructor') {
7070
expect('function').to.equal(typeof EmptyContext[key])
71+
} else if (key === 'name') {
72+
expect(EmptyContext[key]).to.equal('Empty')
7173
} else {
7274

7375
expect(true).to.equal(isEmptyObject(EmptyContext[key]))
@@ -104,4 +106,4 @@ describe('Component',
104106
})
105107
}
106108
)
107-
export default {}
109+
export default {}

0 commit comments

Comments
 (0)