Skip to content

Commit 68c4fa2

Browse files
authored
Fix backward compatibility with Flutter@master & beta (#1367)
1 parent 96079bb commit 68c4fa2

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

packages/core/test/src/core_legacy_test.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,15 @@ void main() {
5959

6060
testWidgets('tsb.build', (tester) async {
6161
const html = '<span class="build-op">Foo</span>';
62+
const abcdef = Color(0x00abcdef);
6263
final buildOp = BuildOp(
6364
onTree: (_, tree) => tree.append(
6465
WidgetBit.block(
6566
tree,
6667
WidgetPlaceholder(
6768
builder: (context, child) {
6869
final style = tree.tsb.build(context).style;
69-
final colored = style.copyWith(color: const Color(0x00abcdef));
70+
final colored = style.copyWith(color: abcdef);
7071
return Text('hi', style: colored);
7172
},
7273
),
@@ -83,7 +84,10 @@ void main() {
8384
),
8485
useExplainer: false,
8586
);
86-
expect(explained, contains('0x00abcdef'));
87+
88+
// TODO: use hard coded value when our minimum Flutter version > 3.24
89+
final abcdefString = abcdef.toString().replaceAll('ColorSpace.', '');
90+
expect(explained, contains(abcdefString));
8791
});
8892
});
8993

packages/core/test/tag_li_test.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,14 +1000,20 @@ Future<void> main() async {
10001000
'<ul style="color: #f00"><li>Foo</li></ul>',
10011001
useExplainer: false,
10021002
);
1003-
expect(disc, contains('Color(0xffff0000)'));
1003+
1004+
// TODO: use hard coded value when our minimum Flutter version > 3.24
1005+
const red = Color(0xffff0000);
1006+
expect(disc, contains(red.toString().replaceAll('ColorSpace.', '')));
10041007

10051008
final circle = await explain(
10061009
tester,
10071010
'<ul style="color: #0f0"><li>Foo</li></ul>',
10081011
useExplainer: false,
10091012
);
1010-
expect(circle, contains('Color(0xff00ff00)'));
1013+
1014+
// TODO: use hard coded value when our minimum Flutter version > 3.24
1015+
const green = Color(0xff00ff00);
1016+
expect(circle, contains(green.toString().replaceAll('ColorSpace.', '')));
10111017
});
10121018
});
10131019
}

0 commit comments

Comments
 (0)