-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
4 changed files
with
74 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use strict'; | ||
|
||
const {Stringable} = require('../src/Stringable'); | ||
const {Str} = require('../src/Str'); | ||
const {wordWrap} = require('../src/methods'); | ||
|
||
it('returns a string wrapped to a given number of characters', () => { | ||
expect(Stringable.of('The quick brown fox jumped over the lazy dog.').wordWrap(20, "<br />\n").toString()) | ||
.toBe("The quick brown fox<br />\njumped over the lazy<br />\ndog."); | ||
|
||
expect(Stringable.of('Hello World').wordWrap(3, '<br />').toString()) | ||
.toBe('Hello<br />World'); | ||
|
||
expect(Stringable.of('A very long woooooooooooord.').wordWrap(8, '<br />', true).toString()) | ||
.toBe('A very<br />long<br />wooooooo<br />ooooord.'); | ||
|
||
expect(Stringable.of('A very long woooooooooooooooooord and something').wordWrap(8, '<br />', false).toString()) | ||
.toBe('A very<br />long<br />woooooooooooooooooord<br />and<br />something'); | ||
|
||
expect(Stringable.of('Hello World').wordWrap(3, '<br />', true).toString()) | ||
.toBe('Hel<br />lo<br />Wor<br />ld'); | ||
|
||
expect(Stringable.of('❤Multi Byte☆❤☆❤☆❤').wordWrap(3, '<br />').toString()) | ||
.toBe('❤Multi<br />Byte☆❤☆❤☆❤'); | ||
|
||
expect(Str.wordWrap('❤Multi Byte☆❤☆❤☆❤', 3, '<br />')) | ||
.toBe('❤Multi<br />Byte☆❤☆❤☆❤'); | ||
|
||
expect(wordWrap('❤Multi Byte☆❤☆❤☆❤',3, '<br />')) | ||
.toBe('❤Multi<br />Byte☆❤☆❤☆❤'); | ||
}); |