Skip to content

Commit

Permalink
Fix backward compatibility with Flutter@master & beta (#1367)
Browse files Browse the repository at this point in the history
  • Loading branch information
daohoangson authored Nov 13, 2024
1 parent 96079bb commit 68c4fa2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 6 additions & 2 deletions packages/core/test/src/core_legacy_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,15 @@ void main() {

testWidgets('tsb.build', (tester) async {
const html = '<span class="build-op">Foo</span>';
const abcdef = Color(0x00abcdef);
final buildOp = BuildOp(
onTree: (_, tree) => tree.append(
WidgetBit.block(
tree,
WidgetPlaceholder(
builder: (context, child) {
final style = tree.tsb.build(context).style;
final colored = style.copyWith(color: const Color(0x00abcdef));
final colored = style.copyWith(color: abcdef);
return Text('hi', style: colored);
},
),
Expand All @@ -83,7 +84,10 @@ void main() {
),
useExplainer: false,
);
expect(explained, contains('0x00abcdef'));

// TODO: use hard coded value when our minimum Flutter version > 3.24
final abcdefString = abcdef.toString().replaceAll('ColorSpace.', '');
expect(explained, contains(abcdefString));
});
});

Expand Down
10 changes: 8 additions & 2 deletions packages/core/test/tag_li_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1000,14 +1000,20 @@ Future<void> main() async {
'<ul style="color: #f00"><li>Foo</li></ul>',
useExplainer: false,
);
expect(disc, contains('Color(0xffff0000)'));

// TODO: use hard coded value when our minimum Flutter version > 3.24
const red = Color(0xffff0000);
expect(disc, contains(red.toString().replaceAll('ColorSpace.', '')));

final circle = await explain(
tester,
'<ul style="color: #0f0"><li>Foo</li></ul>',
useExplainer: false,
);
expect(circle, contains('Color(0xff00ff00)'));

// TODO: use hard coded value when our minimum Flutter version > 3.24
const green = Color(0xff00ff00);
expect(circle, contains(green.toString().replaceAll('ColorSpace.', '')));
});
});
}
Expand Down

0 comments on commit 68c4fa2

Please sign in to comment.