Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/src/builtins/styled_element_builtin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,11 @@ class StyledElementBuiltIn extends HtmlExtension {
verticalAlign: VerticalAlign.sub,
);
break;
case "summary":
styledElement.style = Style(
display: Display.block,
);
break;
case "sup":
styledElement.style = Style(
fontSize: FontSize.smaller,
Expand Down
26 changes: 26 additions & 0 deletions test/whitespace_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,32 @@ void main() {
},
);

//See https://github.com/Sub6Resources/flutter_html/issues/1275
testWidgets(
"test that extra newlines aren't added unnecessarily for details/summary tags",
(tester) async {
final tree = await generateStyledElementTreeFromHtml(
tester,
html: """
<!DOCTYPE html>
<html>
<body>
<details>
<summary><h1>Header</h1></summary>
<p>These are the details.</p>
</details>
</body>
</html>
""",
);

expect(
tree.getWhitespace(),
equals(
"<body><details><summary><h1>Header</h1></summary><p>These◦are◦the◦details.</p></details></body>"));
},
);

// See https://github.com/Sub6Resources/flutter_html/issues/1251
testWidgets(
'test that preserved whitespace is actually preserved',
Expand Down