@@ -70,34 +70,54 @@ void main() {
70
70
_expectTextStrings (widgets, < String > ['strikethrough' ]);
71
71
});
72
72
73
- testWidgets ('Single line break' , (WidgetTester tester) async {
74
- await tester
75
- .pumpWidget (_boilerplate (const MarkdownBody (data: 'line 1 \n line 2' )));
73
+ group ('Line Breaks' , () {
74
+ testWidgets (
75
+ // Example 654 from the GitHub Flavored Markdown specification.
76
+ 'Two spaces at end of line inside a block element' ,
77
+ (WidgetTester tester) async {
78
+ await tester.pumpWidget (
79
+ _boilerplate (const MarkdownBody (data: 'line 1 \n line 2' )));
80
+
81
+ final Iterable <Widget > widgets = tester.allWidgets;
82
+ _expectWidgetTypes (widgets,
83
+ < Type > [Directionality , MarkdownBody , Column , Wrap , RichText ]);
84
+ _expectTextStrings (widgets, < String > ['line 1\n line 2' ]);
85
+ },
86
+ );
76
87
77
- final Iterable <Widget > widgets = tester.allWidgets;
78
- _expectWidgetTypes (
79
- widgets, < Type > [Directionality , MarkdownBody , Column , Wrap , RichText ]);
80
- _expectTextStrings (widgets, < String > ['line 1\n line 2' ]);
81
- });
88
+ testWidgets (
89
+ // Example 655 from the GitHub Flavored Markdown specification.
90
+ 'Backslash at end of line inside a block element' ,
91
+ (WidgetTester tester) async {
92
+ await tester.pumpWidget (
93
+ _boilerplate (const MarkdownBody (data: 'line 1\\\n line 2' )));
94
+
95
+ final Iterable <Widget > widgets = tester.allWidgets;
96
+ _expectWidgetTypes (widgets,
97
+ < Type > [Directionality , MarkdownBody , Column , Wrap , RichText ]);
98
+ _expectTextStrings (widgets, < String > ['line 1\n line 2' ]);
99
+ },
100
+ );
82
101
83
- testWidgets ('Multiple line breaks ' , (WidgetTester tester) async {
84
- await tester. pumpWidget (
85
- _boilerplate (const MarkdownBody (data : 'line 1 \n \n line 2' ) ));
102
+ testWidgets ('Non-applicable line break ' , (WidgetTester tester) async {
103
+ final body = MarkdownBody (data : 'line 1. \n line 2.' );
104
+ await tester. pumpWidget ( _boilerplate (body ));
86
105
87
- final Iterable <Widget > widgets = tester.allWidgets;
88
- _expectWidgetTypes (
89
- widgets, < Type > [Directionality , MarkdownBody , Column , Wrap , RichText ]);
90
- _expectTextStrings (widgets, < String > ['line 1\n\n line 2 ' ]);
91
- });
106
+ final Iterable <Widget > widgets = tester.allWidgets;
107
+ _expectWidgetTypes (widgets,
108
+ < Type > [Directionality , MarkdownBody , Column , Wrap , RichText ]);
109
+ _expectTextStrings (widgets, < String > ['line 1. line 2. ' ]);
110
+ });
92
111
93
- testWidgets ('Non-applicable line break' , (WidgetTester tester) async {
94
- final body = MarkdownBody (data: 'line 1.\n line 2.' );
95
- await tester.pumpWidget (_boilerplate (body));
112
+ testWidgets ('Non-applicable line break' , (WidgetTester tester) async {
113
+ final body = MarkdownBody (data: 'line 1.\n line 2.' );
114
+ await tester.pumpWidget (_boilerplate (body));
96
115
97
- final Iterable <Widget > widgets = tester.allWidgets;
98
- _expectWidgetTypes (
99
- widgets, < Type > [Directionality , MarkdownBody , Column , Wrap , RichText ]);
100
- _expectTextStrings (widgets, < String > ['line 1. line 2.' ]);
116
+ final Iterable <Widget > widgets = tester.allWidgets;
117
+ _expectWidgetTypes (widgets,
118
+ < Type > [Directionality , MarkdownBody , Column , Wrap , RichText ]);
119
+ _expectTextStrings (widgets, < String > ['line 1. line 2.' ]);
120
+ });
101
121
});
102
122
103
123
testWidgets ('Empty string' , (WidgetTester tester) async {
0 commit comments