-
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
- Loading branch information
1 parent
5f88b63
commit 9555d3f
Showing
11 changed files
with
227 additions
and
31 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
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
Binary file not shown.
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,48 @@ | ||
# Snapshot report for `tests/width-option.js` | ||
|
||
The actual snapshot is saved in `width-option.js.snap`. | ||
|
||
Generated by [AVA](https://avajs.dev). | ||
|
||
## width option works | ||
|
||
> Snapshot 1 | ||
`┌──────────────────┐␊ | ||
│foo │␊ | ||
└──────────────────┘` | ||
|
||
> Snapshot 2 | ||
`┌────────┐␊ | ||
│foo bar │␊ | ||
│foo bar │␊ | ||
└────────┘` | ||
|
||
## width option with padding + margin | ||
|
||
> Snapshot 1 | ||
`␊ | ||
␊ | ||
┌──────────────────┐␊ | ||
│ │␊ | ||
│ foo │␊ | ||
│ │␊ | ||
└──────────────────┘␊ | ||
␊ | ||
` | ||
|
||
## width option with big padding | ||
|
||
> Snapshot 1 | ||
`┌────┐␊ | ||
│ │␊ | ||
│ │␊ | ||
│ │␊ | ||
│foo │␊ | ||
│ │␊ | ||
│ │␊ | ||
│ │␊ | ||
└────┘` |
Binary file not shown.
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,39 @@ | ||
import test from 'ava'; | ||
import boxen from '../index.js'; | ||
|
||
test('width option works', t => { | ||
// Creates a wide box for little text | ||
t.snapshot( | ||
boxen('foo', { | ||
width: 20, | ||
}), | ||
); | ||
|
||
// Creates a small box for a lot of text | ||
t.snapshot( | ||
boxen('foo bar foo bar', { | ||
width: 10, | ||
}), | ||
); | ||
}); | ||
|
||
test('width option with padding + margin', t => { | ||
// Creates a wide box for little text | ||
const box = boxen('foo', { | ||
width: 20, | ||
margin: 2, | ||
padding: 1, | ||
}); | ||
|
||
t.snapshot(box); | ||
}); | ||
|
||
test('width option with big padding', t => { | ||
// Should disable the paddings | ||
const box = boxen('foo', { | ||
width: 6, | ||
padding: 3, | ||
}); | ||
|
||
t.snapshot(box); | ||
}); |