-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
Showing
6 changed files
with
160 additions
and
38 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
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 |
---|---|---|
|
@@ -5,4 +5,5 @@ | |
|参数名|说明| | ||
|-----|---| | ||
|rows|表格数据| | ||
|options|选项| | ||
|返回值|表格字符串| |
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
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,19 +1,50 @@ | ||
test([ | ||
[ | ||
['', 'firstName', 'lastName'], | ||
['daughter', 'Emily', 'Smith'], | ||
['father', 'John', 'Smith'], | ||
['mother', 'Jane', 'Smith'] | ||
], | ||
util.stripIndent` | ||
┌──────────┬───────────┬──────────┐ | ||
│ │ firstName │ lastName │ | ||
├──────────┼───────────┼──────────┤ | ||
│ daughter │ Emily │ Smith │ | ||
├──────────┼───────────┼──────────┤ | ||
│ father │ John │ Smith │ | ||
├──────────┼───────────┼──────────┤ | ||
│ mother │ Jane │ Smith │ | ||
└──────────┴───────────┴──────────┘ | ||
` | ||
]); | ||
const stripIndent = util.stripIndent; | ||
|
||
const data = [ | ||
['', 'firstName', 'lastName'], | ||
['daughter', 'Emily', 'Smith'], | ||
['father', 'John', 'Smith'], | ||
['mother', 'Jane', 'Smith'] | ||
]; | ||
|
||
it('stringify', () => { | ||
test([ | ||
data, | ||
stripIndent` | ||
┌──────────┬───────────┬──────────┐ | ||
│ │ firstName │ lastName │ | ||
├──────────┼───────────┼──────────┤ | ||
│ daughter │ Emily │ Smith │ | ||
├──────────┼───────────┼──────────┤ | ||
│ father │ John │ Smith │ | ||
├──────────┼───────────┼──────────┤ | ||
│ mother │ Jane │ Smith │ | ||
└──────────┴───────────┴──────────┘ | ||
` | ||
]); | ||
}); | ||
|
||
it('custom table borders', () => { | ||
test([ | ||
data, | ||
{ | ||
border: { | ||
topJoin: '─', | ||
bodyJoin: ' ', | ||
joinJoin: '─', | ||
bottomJoin: '─' | ||
} | ||
}, | ||
stripIndent` | ||
┌─────────────────────────────────┐ | ||
│ firstName lastName │ | ||
├─────────────────────────────────┤ | ||
│ daughter Emily Smith │ | ||
├─────────────────────────────────┤ | ||
│ father John Smith │ | ||
├─────────────────────────────────┤ | ||
│ mother Jane Smith │ | ||
└─────────────────────────────────┘ | ||
` | ||
]); | ||
}); |