未验证 提交 21a484d9 编写于 作者: M Mouad Debbar 提交者: GitHub

[web] Add few awaits in history tests (#24934)

上级 850c7fe4
......@@ -8,7 +8,6 @@
import 'dart:async';
import 'dart:html' as html;
import 'dart:typed_data';
import 'package:test/bootstrap/browser.dart';
import 'package:test/test.dart';
......@@ -32,8 +31,6 @@ const Map<String, bool> flutterState = <String, bool>{'flutter': true};
const MethodCodec codec = JSONMethodCodec();
void emptyCallback(ByteData date) {}
void main() {
internalBootstrapBrowserTest(() => testMain);
}
......
......@@ -6,7 +6,6 @@
import 'dart:async';
import 'dart:html' as html;
import 'dart:js_util' as js_util;
import 'dart:typed_data';
import 'package:test/bootstrap/browser.dart';
import 'package:test/test.dart';
......@@ -18,8 +17,6 @@ import 'matchers.dart';
const MethodCodec codec = JSONMethodCodec();
void emptyCallback(ByteData data) {}
void main() {
internalBootstrapBrowserTest(() => testMain);
}
......@@ -57,13 +54,15 @@ void testMain() {
// Reading it multiple times should return the same value.
expect(window.defaultRouteName, '/initial');
expect(window.defaultRouteName, '/initial');
Completer<void> callback = Completer<void>();
window.sendPlatformMessage(
'flutter/navigation',
JSONMethodCodec().encodeMethodCall(MethodCall(
'routeUpdated',
<String, dynamic>{'routeName': '/bar'},
)),
emptyCallback,
(_) { callback.complete(); },
);
// After a navigation platform message, [window.defaultRouteName] should
// reset to "/".
......@@ -192,7 +191,7 @@ void testMain() {
expect(window.browserHistory.currentPath, '/');
// Perform some navigation operations.
routeInformationUpdated('/foo/bar', null);
await routeInformationUpdated('/foo/bar', null);
// Path should not be updated because URL strategy is disabled.
expect(window.browserHistory.currentPath, '/');
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册