Skip to content

Commit 0da1850

Browse files
drakang4bhough
authored andcommitted
fix(ellipsis): fix invalid styles in multi-line
1 parent fa58fb2 commit 0da1850

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/mixins/ellipsis.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ export default function ellipsis(width?: ?string | ?number, lines?: number = 1):
3939
return lines > 1
4040
? {
4141
...styles,
42+
WebkitBoxOrient: 'vertical',
43+
WebkitLineClamp: lines,
4244
display: '-webkit-box',
43-
webkitLineClamp: lines,
44-
webkitBoxOrient: 'vertical',
45+
whiteSpace: 'normal',
4546
}
4647
: styles
4748
}

src/mixins/test/ellipsis.test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,26 @@ describe('ellipsis', () => {
3737

3838
it('should truncate text after 3 lines', () => {
3939
expect(ellipsis(null, 3)).toEqual({
40+
WebkitBoxOrient: 'vertical',
41+
WebkitLineClamp: 3,
4042
display: '-webkit-box',
4143
maxWidth: '100%',
4244
overflow: 'hidden',
4345
textOverflow: 'ellipsis',
44-
webkitBoxOrient: 'vertical',
45-
webkitLineClamp: 3,
46-
whiteSpace: 'nowrap',
46+
whiteSpace: 'normal',
4747
wordWrap: 'normal',
4848
})
4949
})
5050

5151
it('should truncate text after 3 lines and 500px max-width', () => {
5252
expect(ellipsis('500px', 3)).toEqual({
53+
WebkitBoxOrient: 'vertical',
54+
WebkitLineClamp: 3,
5355
display: '-webkit-box',
5456
maxWidth: '500px',
5557
overflow: 'hidden',
5658
textOverflow: 'ellipsis',
57-
webkitBoxOrient: 'vertical',
58-
webkitLineClamp: 3,
59-
whiteSpace: 'nowrap',
59+
whiteSpace: 'normal',
6060
wordWrap: 'normal',
6161
})
6262
})

0 commit comments

Comments
 (0)