Skip to content

Commit

Permalink
Merge pull request #1095 from openkraken/fix/textOverflow_is_null
Browse files Browse the repository at this point in the history
Fix/text overflow is null
  • Loading branch information
temper357 committed Jan 13, 2022
2 parents 6a3bbba + 843a1bc commit 04def9f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 22 additions & 2 deletions integration_tests/specs/css/css-text/text-overflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,26 @@ describe('Text Overflow', () => {
return snapshot();
});

it('should work with empty string', () => {
const cont = createElementWithStyle(
'div',
{
width: '50px',
backgroundColor: '#f40',
overflow: 'hidden',
whiteSpace: 'nowrap',
textOverflow: ''
},
[
createText('text is cliped'),
]
);

append(BODY, cont);

return snapshot();
});

it('should not work with ellipsis when overflow visible', () => {

const cont = createElementWithStyle(
Expand Down Expand Up @@ -161,7 +181,7 @@ describe('Text Overflow', () => {
await snapshot();
});

it('should works with ellipsis of one line and lineHeight exists',() => {
it('should works with ellipsis of one line and lineHeight exists', () => {
const cont = createElementWithStyle(
'div',
{
Expand All @@ -181,7 +201,7 @@ describe('Text Overflow', () => {
return snapshot();
});

it('should works with ellipsis of two line and lineHeight exists',() => {
it('should works with ellipsis of two line and lineHeight exists', () => {
const cont = createElementWithStyle(
'div',
{
Expand Down
4 changes: 2 additions & 2 deletions kraken/lib/src/css/text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ mixin CSSTextMixin on RenderStyle {
TextOverflow get textOverflow {
return _textOverflow;
}
set textOverflow(TextOverflow value) {
set textOverflow(TextOverflow? value) {
if (_textOverflow == value) return;
_textOverflow = value;
_textOverflow = value ?? TextOverflow.clip;
// Non inheritable style change should only update text node in direct children.
_markTextNeedsLayout();
}
Expand Down

0 comments on commit 04def9f

Please sign in to comment.