Skip to content
This repository was archived by the owner on Mar 8, 2019. It is now read-only.

Commit 168f595

Browse files
committed
Updated vue-docgen-api
1 parent b1ec37a commit 168f595

File tree

5 files changed

+37
-9
lines changed

5 files changed

+37
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-docgen-api",
3-
"version": "2.0.8",
3+
"version": "2.0.9",
44
"description": "Toolbox to extract information from Vue component files for documentation generation purposes.",
55
"bugs": {
66
"url": "https://github.com/vue-styleguidist/vue-docgen-api/issues"

src/utils/getProp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default function getProp(prop, docPart){
3434
name: getTypeName(prop.type),
3535
};
3636
obj['required'] = prop.required || EMPTY;
37-
if (prop.default !== UNDEFINED) {
37+
if (typeof prop.default !== UNDEFINED) {
3838
let value;
3939
if (typeof prop.default === 'function') {
4040
obj['type'] = { name: 'func' }

tests/components/button/Button.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,23 @@ export default {
2222
props: {
2323
/**
2424
* The size of the button
25-
* `small, normal, large`
2625
*/
2726
size: {
2827
default: 'normal'
2928
},
29+
/**
30+
* The size of the button
31+
*/
32+
example: {
33+
default: false
34+
},
35+
/**
36+
* The size of the button
37+
*/
38+
example2: {
39+
type: Boolean,
40+
default: true
41+
},
3042
/**
3143
* @ignore
3244
* Add custom click actions.

tests/parse.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,30 @@ describe('tests button', () => {
9898
expect(typeof docButton['tags']['version'] !== 'undefined').to.be.true
9999
})
100100

101-
it('should the component have five props', () => {
102-
expect(Object.keys(docButton['props']).length).to.equal(5)
101+
it('should the component have seven props', () => {
102+
expect(Object.keys(docButton['props']).length).to.equal(7)
103103
})
104104

105105
it('should prop1 to be string', () => {
106106
expect(docButton['props']['prop1']['type']['name']).to.equal('string')
107107
})
108108

109+
it('should example to be boolean', () => {
110+
expect(docButton['props']['example']['type']['name']).to.equal('boolean')
111+
})
112+
113+
it('should value default example to be boolean', () => {
114+
expect(docButton['props']['example']['defaultValue']['value']).to.equal('false')
115+
})
116+
117+
it('should example2 to be boolean', () => {
118+
expect(docButton['props']['example2']['type']['name']).to.equal('boolean')
119+
})
120+
121+
it('should value default example2 to be boolean', () => {
122+
expect(docButton['props']['example2']['defaultValue']['value']).to.equal('true')
123+
})
124+
109125
it('should onCustomClick to be ignored', () => {
110126
expect(docButton['props']['onCustomClick']['tags']['ignore']).to.be.an('array')
111127
})

tests/parseWebpack.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ describe('tests parseWebpack button', () => {
8585
expect(docButton['props']['color']['defaultValue']['value']).to.equal('"#333"')
8686
})
8787

88-
it('should the component have size prop description equal The size of the button\n`small, normal, large`', () => {
89-
expect(docButton['props']['size']['description']).to.equal('The size of the button\n`small, normal, large`')
88+
it('should the component have size prop description equal The size of the button', () => {
89+
expect(docButton['props']['size']['description']).to.equal('The size of the button')
9090
})
9191

9292
it('should the component have authors', () => {
@@ -105,8 +105,8 @@ describe('tests parseWebpack button', () => {
105105
expect(typeof docButton['tags']['version'] !== 'undefined').to.be.true
106106
})
107107

108-
it('should the component have five props', () => {
109-
expect(Object.keys(docButton['props']).length).to.equal(5)
108+
it('should the component have seven props', () => {
109+
expect(Object.keys(docButton['props']).length).to.equal(7)
110110
})
111111

112112
it('should prop1 to be string', () => {

0 commit comments

Comments
 (0)