-
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2b6f02d
commit edf9a8d
Showing
9 changed files
with
159 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<template> | ||
<div></div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
// a string | ||
/** | ||
* For input form | ||
* and something | ||
*/ | ||
a: String | ||
} | ||
} | ||
</script> |
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 |
---|---|---|
|
@@ -22,7 +22,7 @@ export default { | |
d: 'null', | ||
e: { | ||
type: Function, | ||
default: function() {} | ||
default () {} | ||
} | ||
} | ||
} | ||
|
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,28 @@ | ||
<template> | ||
<div></div> | ||
</template> | ||
|
||
<script> | ||
const noop = () => {} | ||
export default { | ||
props: { | ||
a: { | ||
type: Function, | ||
// An empty function | ||
default: noop | ||
}, | ||
b: { | ||
type: Number, | ||
default: 1, | ||
// Must be a number greater than 0 | ||
validator (value) { | ||
return value > 0 | ||
} | ||
}, | ||
c: { | ||
// 'TOP' | 'LEFT' | ||
type: String | ||
} | ||
} | ||
} | ||
</script> |
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 |
---|---|---|
@@ -1,9 +1,23 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Get comments as a description 1`] = ` | ||
Array [ | ||
"a string", | ||
"For input form | ||
and something", | ||
] | ||
`; | ||
|
||
exports[`Gets a description of the default value and a description of the validator 1`] = ` | ||
Array [ | ||
"'TOP' | 'LEFT'", | ||
] | ||
`; | ||
|
||
exports[`The validator function should be used as a string representation 1`] = ` | ||
"function () { | ||
return true; | ||
}" | ||
`; | ||
|
||
exports[`When the \`type\` definition contains \`Function\`, you should get a string representation of the \`default\` function. 1`] = `"function () {}"`; | ||
exports[`When the \`type\` definition contains \`Function\`, you should get a string representation of the \`default\` function. 1`] = `""`; |
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,18 @@ | ||
import { isCommentLine, isCommentBlock } from './helpers' | ||
|
||
const commentRE = /\n\s*\*\s*/g | ||
|
||
export function getComments(path: any): string[] { | ||
const commentNodes: [] | undefined = path.node.leadingComments | ||
if (!commentNodes || !commentNodes.length) return [] | ||
return (commentNodes as []).map((node: any) => { | ||
if (isCommentLine(node)) { | ||
return node.value.trim() | ||
} else if (isCommentBlock(node)) { | ||
return node.value | ||
.replace(commentRE, '\n') | ||
.replace(/^\*/, '') | ||
.trim() | ||
} | ||
}) | ||
} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
declare module 'vue-template-compiler' | ||
declare module '@babel/traverse' | ||
declare module '@babel/generator' | ||
declare module 'strip-ansi' |
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