Skip to content

Commit 95b9bff

Browse files
committed
Update tests
1 parent 8d97533 commit 95b9bff

File tree

1 file changed

+23
-85
lines changed

1 file changed

+23
-85
lines changed

packages/core/test/tag_table_test.dart

Lines changed: 23 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -653,81 +653,6 @@ Future<void> main() async {
653653
});
654654
});
655655

656-
group('background', () {
657-
testWidgets('cell color', (WidgetTester tester) async {
658-
// https://github.com/daohoangson/flutter_widget_from_html/issues/171
659-
const html = '<table><tr>'
660-
'<td style="background-color: #f00">Foo</td>'
661-
'</tr></table>';
662-
final explained = await explain(tester, html);
663-
expect(
664-
explained,
665-
equals(
666-
'[SingleChildScrollView:child=[HtmlTable:children='
667-
'[HtmlTableCell:child='
668-
'[Container:color=#FFFF0000,child='
669-
'[Padding:(1,1,1,1),child='
670-
'[Align:alignment=centerLeft,widthFactor=1.0,child='
671-
'[RichText:(:Foo)]'
672-
']]]]]]',
673-
),
674-
);
675-
});
676-
677-
testWidgets('row color', (WidgetTester tester) async {
678-
// https://github.com/daohoangson/flutter_widget_from_html/issues/1028
679-
const html = '<table><tr style="background-color: #f00">'
680-
'<td>Foo</td><td>Bar</td>'
681-
'</tr></table>';
682-
final explained = await explain(tester, html);
683-
expect(
684-
explained,
685-
equals(
686-
'[SingleChildScrollView:child=[HtmlTable:children='
687-
'[HtmlTableCell:child='
688-
'[Container:color=#FFFF0000,child='
689-
'[Padding:(1,1,1,1),child='
690-
'[Align:alignment=centerLeft,widthFactor=1.0,child='
691-
'[RichText:(:Foo)]'
692-
']]]],'
693-
'[HtmlTableCell:child='
694-
'[Container:color=#FFFF0000,child='
695-
'[Padding:(1,1,1,1),child='
696-
'[Align:alignment=centerLeft,widthFactor=1.0,child='
697-
'[RichText:(:Bar)]'
698-
']]]]'
699-
']]',
700-
),
701-
);
702-
});
703-
704-
testWidgets('overwrites row color', (WidgetTester tester) async {
705-
const html = '<table><tr style="background-color: #f00">'
706-
'<td>Foo</td><td style="background-color: #0f0">Bar</td>'
707-
'</tr></table>';
708-
final explained = await explain(tester, html);
709-
expect(
710-
explained,
711-
equals(
712-
'[SingleChildScrollView:child=[HtmlTable:children='
713-
'[HtmlTableCell:child='
714-
'[Container:color=#FFFF0000,child='
715-
'[Padding:(1,1,1,1),child='
716-
'[Align:alignment=centerLeft,widthFactor=1.0,child='
717-
'[RichText:(:Foo)]'
718-
']]]],'
719-
'[HtmlTableCell:child='
720-
'[Container:color=#FF00FF00,child='
721-
'[Padding:(1,1,1,1),child='
722-
'[Align:alignment=centerLeft,widthFactor=1.0,child='
723-
'[RichText:(:Bar)]'
724-
']]]]'
725-
']]',
726-
),
727-
);
728-
});
729-
});
730-
731656
testWidgets('renders display: table', (WidgetTester tester) async {
732657
const html = '''
733658
<div style="display: table">
@@ -747,10 +672,10 @@ Future<void> main() async {
747672
equals(
748673
'[SingleChildScrollView:child=[HtmlTable:children='
749674
'[HtmlTableCaption:child=[RichText:align=center,(:Caption)]],'
750-
'[HtmlTableCell:child=[RichText:(+b:Header 1)]],'
751-
'[HtmlTableCell:child=[RichText:(+b:Header 2)]],'
752-
'[HtmlTableCell:child=[RichText:(:Value 1)]],'
753-
'[HtmlTableCell:child=[RichText:(:Value 2)]]'
675+
'[HtmlTableCell:child=[CssBlock:child=[RichText:(+b:Header 1)]]],'
676+
'[HtmlTableCell:child=[CssBlock:child=[RichText:(+b:Header 2)]]],'
677+
'[HtmlTableCell:child=[CssBlock:child=[RichText:(:Value 1)]]],'
678+
'[HtmlTableCell:child=[CssBlock:child=[RichText:(:Value 2)]]]'
754679
']]',
755680
),
756681
);
@@ -767,8 +692,8 @@ Future<void> main() async {
767692
explained,
768693
equals(
769694
'[SingleChildScrollView:child=[HtmlTable:children='
770-
'[HtmlTableCell:child=[RichText:(:Foo)]],'
771-
'[HtmlTableCell:child=[RichText:(:Bar)]]'
695+
'[HtmlTableCell:child=[CssBlock:child=[RichText:(:Foo)]]],'
696+
'[HtmlTableCell:child=[CssBlock:child=[RichText:(:Bar)]]]'
772697
']]',
773698
),
774699
);
@@ -1214,8 +1139,9 @@ Future<void> main() async {
12141139
<td valign="baseline">Foo</td>
12151140
</tr>
12161141
</table>''',
1142+
// https://github.com/daohoangson/flutter_widget_from_html/issues/171
1143+
// https://github.com/daohoangson/flutter_widget_from_html/issues/1028
12171144
'row_color': '''
1218-
<!-- https://github.com/daohoangson/flutter_widget_from_html/issues/1028 -->
12191145
<table style="border-collapse: collapse;">
12201146
<tr>
12211147
<th>First Name</th>
@@ -1235,7 +1161,7 @@ Future<void> main() async {
12351161
<tr style="background-color: #f2f2f2;">
12361162
<td>Adam</td>
12371163
<td>Johnson</td>
1238-
<td>67</td>
1164+
<td style="background-color: red;">67</td>
12391165
</tr>
12401166
</table>''',
12411167
'rtl': '''
@@ -1282,6 +1208,18 @@ Future<void> main() async {
12821208
<td>$multiline</td>
12831209
</tr>
12841210
</table>''',
1211+
// https://github.com/daohoangson/flutter_widget_from_html/issues/1322
1212+
// https://github.com/daohoangson/flutter_widget_from_html/issues/1446
1213+
'text_align_center': '''
1214+
<table border="1">
1215+
<tr>
1216+
<td>Long long long text</td>
1217+
</tr>
1218+
<tr>
1219+
<td style="text-align: center;">Short text</td>
1220+
</tr>
1221+
</table>
1222+
''',
12851223
'width_redistribution_wide': '''
12861224
<div style="background: red; width: 400px">
12871225
<table border="1">
@@ -1528,8 +1466,8 @@ Future<String> explain(
15281466

15291467
String _padding(String child) => '[HtmlTableCell:child='
15301468
'[Padding:(1,1,1,1),child='
1531-
'[Align:alignment=centerLeft,widthFactor=1.0,child='
1532-
'$child]]]';
1469+
'[Align:alignment=centerLeft,widthFactor=1.0,child=[CssBlock:child='
1470+
'$child]]]]';
15331471

15341472
final _loggerIsGitHubAction = Platform.environment['GITHUB_ACTIONS'] == 'true';
15351473
final _loggerMessages = [];

0 commit comments

Comments
 (0)