Skip to content

Commit

Permalink
update tests to handle <br> elements for line breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhruv-Maradiya committed Dec 25, 2024
1 parent 90fea07 commit b6126c1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkgs/html/test/parser_feature_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,11 @@ On line 4, column 3 of ParseError: Unexpected DOCTYPE. Ignored.
});

test('Element.text', () {
final doc = parseFragment('<div>foo<div>bar</div>baz</div>');
final doc = parseFragment('<div>foo<div><br>bar</div>baz<br></div>');
final e = doc.firstChild!;
final text = e.firstChild!;
expect((text as Text).data, 'foo');
expect(e.text, 'foobarbaz');
expect(e.text, 'foo\nbarbaz\n');

e.text = 'FOO';
expect(e.nodes.length, 1);
Expand All @@ -279,15 +279,15 @@ On line 4, column 3 of ParseError: Unexpected DOCTYPE. Ignored.
});

test('Text.text', () {
final doc = parseFragment('<div>foo<div>bar</div>baz</div>');
final doc = parseFragment('<div>foo<div>bar</div><br>baz</div>');
final e = doc.firstChild!;
final text = e.firstChild as Text;
expect(text.data, 'foo');
expect(text.text, 'foo');

text.text = 'FOO';
expect(text.data, 'FOO');
expect(e.text, 'FOObarbaz');
expect(e.text, 'FOObar\nbaz');
expect(text.text, 'FOO');
});

Expand Down

0 comments on commit b6126c1

Please sign in to comment.