Skip to content

Commit 846ae21

Browse files
committed
Add golden tests for all supported html elements
1 parent a7aa1fd commit 846ae21

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+116
-0
lines changed

test/golden_test.dart

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter_html/flutter_html.dart';
3+
import 'package:flutter_test/flutter_test.dart';
4+
5+
import 'test_data.dart';
6+
7+
class TestApp extends StatelessWidget {
8+
final Widget body;
9+
10+
TestApp(this.body);
11+
12+
@override
13+
Widget build(BuildContext context) {
14+
return MaterialApp(
15+
home: Scaffold(
16+
body: body,
17+
appBar: AppBar(title: Text('flutter_html')),
18+
),
19+
);
20+
}
21+
}
22+
23+
void testHtml(String name, String htmlData) {
24+
testWidgets('$name golden test', (WidgetTester tester) async {
25+
await tester.pumpWidget(
26+
TestApp(
27+
Html(
28+
data: htmlData,
29+
),
30+
),
31+
);
32+
await expectLater(find.byType(Html), matchesGoldenFile('goldens/$name.png'));
33+
});
34+
}
35+
36+
void main() {
37+
testData.forEach((key, value) {
38+
testHtml(key, value);
39+
});
40+
}

test/goldens/a.png

3.39 KB

test/goldens/abbr.png

3.48 KB

test/goldens/acronym.png

3.4 KB

test/goldens/address.png

3.68 KB

test/goldens/article.png

3.47 KB

test/goldens/aside.png

3.45 KB

test/goldens/b.png

3.35 KB

test/goldens/bdi.png

3.38 KB

test/goldens/bdo.png

3.3 KB

0 commit comments

Comments
 (0)