diff --git a/lib/src/builtins/styled_element_builtin.dart b/lib/src/builtins/styled_element_builtin.dart index 038962e276..67e5b29e61 100644 --- a/lib/src/builtins/styled_element_builtin.dart +++ b/lib/src/builtins/styled_element_builtin.dart @@ -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, diff --git a/test/whitespace_test.dart b/test/whitespace_test.dart index 39fe5fc42e..640ceed929 100644 --- a/test/whitespace_test.dart +++ b/test/whitespace_test.dart @@ -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: """ + + + +
+

Header

+

These are the details.

+
+ + +""", + ); + + expect( + tree.getWhitespace(), + equals( + "

Header

These◦are◦the◦details.

")); + }, + ); + // See https://github.com/Sub6Resources/flutter_html/issues/1251 testWidgets( 'test that preserved whitespace is actually preserved',