Skip to content

Commit

Permalink
fix(ellipsis): fix invalid styles in multi-line
Browse files Browse the repository at this point in the history
  • Loading branch information
drakang4 authored and bhough committed Oct 8, 2020
1 parent fa58fb2 commit 0da1850
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/mixins/ellipsis.js
Expand Up @@ -39,9 +39,10 @@ export default function ellipsis(width?: ?string | ?number, lines?: number = 1):
return lines > 1
? {
...styles,
WebkitBoxOrient: 'vertical',
WebkitLineClamp: lines,
display: '-webkit-box',
webkitLineClamp: lines,
webkitBoxOrient: 'vertical',
whiteSpace: 'normal',
}
: styles
}
12 changes: 6 additions & 6 deletions src/mixins/test/ellipsis.test.js
Expand Up @@ -37,26 +37,26 @@ describe('ellipsis', () => {

it('should truncate text after 3 lines', () => {
expect(ellipsis(null, 3)).toEqual({
WebkitBoxOrient: 'vertical',
WebkitLineClamp: 3,
display: '-webkit-box',
maxWidth: '100%',
overflow: 'hidden',
textOverflow: 'ellipsis',
webkitBoxOrient: 'vertical',
webkitLineClamp: 3,
whiteSpace: 'nowrap',
whiteSpace: 'normal',
wordWrap: 'normal',
})
})

it('should truncate text after 3 lines and 500px max-width', () => {
expect(ellipsis('500px', 3)).toEqual({
WebkitBoxOrient: 'vertical',
WebkitLineClamp: 3,
display: '-webkit-box',
maxWidth: '500px',
overflow: 'hidden',
textOverflow: 'ellipsis',
webkitBoxOrient: 'vertical',
webkitLineClamp: 3,
whiteSpace: 'nowrap',
whiteSpace: 'normal',
wordWrap: 'normal',
})
})
Expand Down

0 comments on commit 0da1850

Please sign in to comment.