@@ -380,6 +380,57 @@ Future<void> main() async {
380380 });
381381 });
382382
383+ group ('width' , () {
384+ testWidgets ('renders without width' , (WidgetTester tester) async {
385+ const html = '<table><tr><td>Foo</td></tr></table>' ;
386+ final e = await explain (tester, html, useExplainer: false );
387+ expect (e, contains ('└HtmlTableCell(columnStart: 0, rowStart: 0)' ));
388+ });
389+
390+ testWidgets ('renders width: 50px' , (WidgetTester tester) async {
391+ const html = '<table><tr><td style="width: 50px">Foo</td></tr></table>' ;
392+ final explained = await explain (tester, html, useExplainer: false );
393+ expect (
394+ explained,
395+ isNot (contains ('└HtmlTableCell(columnStart: 0, rowStart: 0)' )),
396+ );
397+ expect (
398+ explained,
399+ contains ('└HtmlTableCell(columnStart: 0, rowStart: 0, width: 50.0)' ),
400+ );
401+ });
402+
403+ testWidgets ('renders width: 100%' , (WidgetTester tester) async {
404+ const html = '<table><tr><td style="width: 100%">Foo</td></tr></table>' ;
405+ final explained = await explain (tester, html, useExplainer: false );
406+ expect (
407+ explained,
408+ isNot (contains ('└HtmlTableCell(columnStart: 0, rowStart: 0)' )),
409+ );
410+ expect (
411+ explained,
412+ contains ('└HtmlTableCell(columnStart: 0, rowStart: 0, width: 100.0%)' ),
413+ );
414+ });
415+
416+ testWidgets ('renders width: 100% within TABLE' , (tester) async {
417+ const html = '<table><tr><td>'
418+ '<table><tr><td style="width: 100%">'
419+ 'Foo'
420+ '</td></tr></table>'
421+ '</td></tr></table>' ;
422+ final explained = await explain (tester, html, useExplainer: false );
423+ expect (
424+ explained,
425+ contains ('└HtmlTableCell(columnStart: 0, rowStart: 0)' ),
426+ );
427+ expect (
428+ explained,
429+ contains ('└HtmlTableCell(columnStart: 0, rowStart: 0, width: 100.0%)' ),
430+ );
431+ });
432+ });
433+
383434 group ('error handling' , () {
384435 testWidgets ('missing header' , (WidgetTester tester) async {
385436 const html = '<table><tbody>'
@@ -857,6 +908,18 @@ Future<void> main() async {
857908 <td style="background: red; width: 30%">Foo</td>
858909 <td style="background: green; width: 70%">Bar</td>
859910 </tr>
911+ </table>''' ,
912+ 'width_in_percent_100_nested' : '''
913+ <table border="1">
914+ <tr>
915+ <td>
916+ <table border="1">
917+ <tr>
918+ <td style="width: 100%">Foo</td>
919+ </tr>
920+ </table>
921+ </td>
922+ </tr>
860923</table>''' ,
861924 'width_in_px' : '''
862925<table border="1">
0 commit comments