truncate.js
✓ truncates nothing when content fits (52ms)
1) truncate correctly with default options
✓ truncate correctly word with no space
2) truncate correctly white space
3) truncate correctly when container has no margin or padding
4) truncate correctly when container has margin
5) truncate correctly when container has padding
6) truncate correctly when container has margin and padding
7) truncate correctly when container has padding and border
8) truncate correctly based on specified max height
when box sizing is border-box
9) truncate correctly when container has margin
10) truncate correctly when container has padding
11) truncate correctly when container has margin and padding
12) truncate correctly when container has padding and border
when children elements are wrapped
13) handles single block element wrap
14) handles double block element wrap
15) handles inline element wrap
16) handles single block element with margin wrap
when children elements are nested
17) ignores comment nodes
✓ handles single break tags
✓ handles double break tags
✓ leaves single level lists intact
✓ leaves double level lists intact
.update()
18) recalculates the existing html
✓ truncates the new HTML
✓ truncates the current HTML if no new HTML specified.
✓ should support empty string
.expand()
when truncation happened
✓ shows the original HTML with show less HTML
✓ should be able to expand after multiple update
when no truncation happened
✓ shows the original HTML with show less HTML
.collapse()
✓ shows the truncated HTML
✓ retruncates if retruncate is true
✓ should keep the collapsed status after multiple update
.isTruncated
✓ is false no truncation happened
✓ is true if truncation happened
.isCollapsed
✓ is true if collapsed
✓ is false if expanded
✓ is false if update is no longer collapsed
position
19) truncate correctly with truncate position at the beginning
20) truncate correctly with truncate position at the end
21) truncate correctly with truncate position at the middle
line-height
22) should lineHeight configuration property be optional
set-options
23) should updates options field
24) should keep the collapsed after update options
25) should expand
20 passing (778ms)
25 failing
1) truncate.js truncate correctly with default options:
AssertionError: expected 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of ty…' to equal 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer too…'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:48
2) truncate.js truncate correctly white space:
AssertionError: expected 'Some text <a href="/foo">with some link</a> and some m…' to equal 'Some text <a href="/foo">with some link</a> and some…'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:66
3) truncate.js truncate correctly when container has no margin or padding:
AssertionError: expected 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galle… <a href="#">More</a>' to equal 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown prin… <a href="#">More</a>'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:73
4) truncate.js truncate correctly when container has margin:
AssertionError: expected 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galle… <a href="#">More</a>' to equal 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown prin… <a href="#">More</a>'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:81
5) truncate.js truncate correctly when container has padding:
AssertionError: expected 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galle… <a href="#">More</a>' to equal 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown prin… <a href="#">More</a>'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:89
6) truncate.js truncate correctly when container has margin and padding:
AssertionError: expected 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galle… <a href="#">More</a>' to equal 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown prin… <a href="#">More</a>'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:97
7) truncate.js truncate correctly when container has padding and border:
AssertionError: expected 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galle… <a href="#">More</a>' to equal 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown prin… <a href="#">More</a>'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:105
8) truncate.js truncate correctly based on specified max height:
AssertionError: expected 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of ty…' to equal 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer too…'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:112
9) truncate.js when box sizing is border-box truncate correctly when container has margin:
AssertionError: expected 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galle… <a href="#">More</a>' to equal 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown prin… <a href="#">More</a>'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:125
10) truncate.js when box sizing is border-box truncate correctly when container has padding:
AssertionError: expected 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, wh… <a href="#">More</a>' to equal 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ev… <a href="#">More</a>'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:132
11) truncate.js when box sizing is border-box truncate correctly when container has margin and padding:
AssertionError: expected 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, wh… <a href="#">More</a>' to equal 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ev… <a href="#">More</a>'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:139
12) truncate.js when box sizing is border-box truncate correctly when container has padding and border:
AssertionError: expected 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text… <a href="#">More</a>' to equal 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard d… <a href="#">More</a>'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:146
13) truncate.js when children elements are wrapped handles single block element wrap:
AssertionError: expected '<div>Members, friends, adversaries,… <a href="#">More</a></div>' to equal '<div>Members, friends, adversarie… <a href="#">More</a></div>'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:157
14) truncate.js when children elements are wrapped handles double block element wrap:
AssertionError: expected '<div><div>Members, friends, adversaries,… <a href="#">More</a></div></div>' to equal '<div><div>Members, friends, adversarie… <a href="#">More</a></div></div>'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:166
15) truncate.js when children elements are wrapped handles inline element wrap:
AssertionError: expected '<span><span>Members, friends, adversaries,… <a href="#">More</a></span></span>' to equal '<span><span>Members, friends, adversarie… <a href="#">More</a></span></span>'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:175
16) truncate.js when children elements are wrapped handles single block element with margin wrap:
AssertionError: expected '<p style="margin: 10px; padding: 0;">Members, friends, adversar… <a href="#">More</a></p>' to equal '<p style="margin: 10px; padding: 0;">Members, friends, adversa… <a href="#">More</a></p>'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:184
17) truncate.js when children elements are nested ignores comment nodes:
AssertionError: expected 'Lorem Ipsum is simply dummy texts of the printing and typesettin<!--- test -->g industry.' to equal 'Lorem Ipsum is simply dummy texts of the printing and typesettin… <a href="#">More</a>'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:195
18) truncate.js .update() recalculates the existing html:
AssertionError: expected 'Lorem Ipsum is simply dummy… <a href="#">More</a>' to equal 'Lorem Ipsum is simply dum… <a href="#">More</a>'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:243
19) truncate.js position truncate correctly with truncate position at the beginning:
AssertionError: expected '…etting, remaining essentially unchanged.' to equal '…ng, remaining essentially unchanged.'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:375
20) truncate.js position truncate correctly with truncate position at the end:
AssertionError: expected 'Lorem Ipsum is simply dummy text of t…' to equal 'Lorem Ipsum is simply dummy text…'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:382
21) truncate.js position truncate correctly with truncate position at the middle:
AssertionError: expected 'Lorem Ipsum is sim…ntially unchanged.' to equal 'Lorem Ipsum is si…tially unchanged.'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:389
22) truncate.js line-height should lineHeight configuration property be optional:
AssertionError: expected 'Lorem Ipsum is simply dummy text of t…' to equal 'Lorem Ipsum is simply dummy text…'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:398
23) truncate.js set-options should updates options field:
AssertionError: expected 'Lorem Ipsum is simply dummy text of t…' to equal 'Lorem Ipsum is simply dummy text…'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:405
24) truncate.js set-options should keep the collapsed after update options:
AssertionError: expected 'Lorem Ipsum is simply dummy text of t…' to equal 'Lorem Ipsum is simply dummy text…'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:413
25) truncate.js set-options should expand:
AssertionError: expected 'Lorem Ipsum is simply dummy text of t…' to equal 'Lorem Ipsum is simply dummy text…'
at file:///D:/github/truncate.js/node_modules/chai/chai.js:210
at file:///D:/github/truncate.js/node_modules/chai/chai.js:2282
at file:///D:/github/truncate.js/test/phantomjs/truncate-test.js:421
Created
May 6, 2017 08:38
-
-
Save Semigradsky/0c0ed78db9269bfc7ea56f633159ee1f to your computer and use it in GitHub Desktop.
truncate.js-tests
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment