@@ -38,83 +38,80 @@ void main() {
3838 });
3939
4040 group ('Link Widget' , () {
41- testWidgets (
42- 'creates anchor with correct attributes' ,
43- (WidgetTester tester) async {
44- final Uri uri = Uri .parse ('http://foobar/example?q=1' );
45- await tester.pumpWidget (
46- Directionality (
47- textDirection: TextDirection .ltr,
48- child: WebLinkDelegate (
49- TestLinkInfo (
50- uri: uri,
51- target: LinkTarget .blank,
52- builder: (BuildContext context, FollowLink ? followLink) {
53- return const SizedBox (width: 100 , height: 100 );
54- },
55- ),
41+ testWidgets ('creates anchor with correct attributes' , (
42+ WidgetTester tester,
43+ ) async {
44+ final Uri uri = Uri .parse ('http://foobar/example?q=1' );
45+ await tester.pumpWidget (
46+ Directionality (
47+ textDirection: TextDirection .ltr,
48+ child: WebLinkDelegate (
49+ TestLinkInfo (
50+ uri: uri,
51+ target: LinkTarget .blank,
52+ builder: (BuildContext context, FollowLink ? followLink) {
53+ return const SizedBox (width: 100 , height: 100 );
54+ },
5655 ),
5756 ),
58- );
59- // Platform view creation happens asynchronously.
60- await tester. pumpAndSettle ();
61- await tester.pump ();
62-
63- final html. Element anchor = _findSingleAnchor ();
64- expect ( anchor. getAttribute ( 'href' ), uri. toString () );
65- expect (anchor.getAttribute ('target ' ), '_blank' );
66-
67- final Uri uri2 = Uri . parse ( 'http://foobar2/example?q=2' );
68- await tester. pumpWidget (
69- Directionality (
70- textDirection : TextDirection .ltr,
71- child : WebLinkDelegate (
72- TestLinkInfo (
73- uri : uri2,
74- target : LinkTarget .self ,
75- builder : ( BuildContext context, FollowLink ? followLink) {
76- return const SizedBox (width : 100 , height : 100 );
77- },
78- ) ,
57+ ),
58+ );
59+ // Platform view creation happens asynchronously.
60+ await tester.pumpAndSettle ();
61+ await tester. pump ();
62+
63+ final html. Element anchor = _findSingleAnchor ( );
64+ expect (anchor.getAttribute ('href ' ), uri. toString () );
65+ expect (anchor. getAttribute ( 'target' ), '_blank' );
66+
67+ final Uri uri2 = Uri . parse ( 'http://foobar2/example?q=2' );
68+ await tester. pumpWidget (
69+ Directionality (
70+ textDirection : TextDirection .ltr,
71+ child : WebLinkDelegate (
72+ TestLinkInfo (
73+ uri : uri2 ,
74+ target : LinkTarget .self,
75+ builder : ( BuildContext context, FollowLink ? followLink) {
76+ return const SizedBox (width : 100 , height : 100 );
77+ } ,
7978 ),
8079 ),
81- );
82- await tester. pumpAndSettle ( );
83- await tester.pump ();
84-
85- // Check that the same anchor has been updated.
86- expect ( anchor. getAttribute ( 'href' ), uri2. toString ());
87- expect (anchor.getAttribute ('target ' ), '_self' );
88-
89- final Uri uri3 = Uri . parse ( '/foobar' );
90- await tester. pumpWidget (
91- Directionality (
92- textDirection : TextDirection .ltr,
93- child : WebLinkDelegate (
94- TestLinkInfo (
95- uri : uri3,
96- target : LinkTarget .self ,
97- builder : ( BuildContext context, FollowLink ? followLink) {
98- return const SizedBox (width : 100 , height : 100 );
99- },
100- ) ,
80+ ),
81+ );
82+ await tester.pumpAndSettle ();
83+ await tester. pump ();
84+
85+ // Check that the same anchor has been updated.
86+ expect (anchor.getAttribute ('href ' ), uri2. toString () );
87+ expect (anchor. getAttribute ( 'target' ), '_self' );
88+
89+ final Uri uri3 = Uri . parse ( '/foobar' );
90+ await tester. pumpWidget (
91+ Directionality (
92+ textDirection : TextDirection .ltr,
93+ child : WebLinkDelegate (
94+ TestLinkInfo (
95+ uri : uri3 ,
96+ target : LinkTarget .self,
97+ builder : ( BuildContext context, FollowLink ? followLink) {
98+ return const SizedBox (width : 100 , height : 100 );
99+ } ,
101100 ),
102101 ),
103- );
104- await tester.pumpAndSettle ();
105- await tester.pump ();
106-
107- // Check that internal route properly prepares using the default
108- // [UrlStrategy]
109- expect (
110- anchor.getAttribute ('href' ),
111- ui_web.urlStrategy? .prepareExternalUrl (uri3.toString ()),
112- );
113- expect (anchor.getAttribute ('target' ), '_self' );
114- },
115- // Flaky under WASM: https://github.com/flutter/flutter/issues/182844
116- skip: true ,
117- );
102+ ),
103+ );
104+ await tester.pumpAndSettle ();
105+ await tester.pump ();
106+
107+ // Check that internal route properly prepares using the default
108+ // [UrlStrategy]
109+ expect (
110+ anchor.getAttribute ('href' ),
111+ ui_web.urlStrategy? .prepareExternalUrl (uri3.toString ()),
112+ );
113+ expect (anchor.getAttribute ('target' ), '_self' );
114+ });
118115
119116 testWidgets ('sizes itself correctly' , (WidgetTester tester) async {
120117 final Key containerKey = GlobalKey ();
0 commit comments