mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[web] Add few awaits in history tests (flutter/engine#24934)
This commit is contained in:
parent
810917d1a2
commit
b29e65be16
@ -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, '/');
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user