| Index: test/codegen/lib/html/location_test.dart
|
| diff --git a/test/codegen/lib/html/location_test.dart b/test/codegen/lib/html/location_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e274a2a02f07cc70d3e11501932b72ec4387a396
|
| --- /dev/null
|
| +++ b/test/codegen/lib/html/location_test.dart
|
| @@ -0,0 +1,33 @@
|
| +library LocationTest;
|
| +import 'package:unittest/unittest.dart';
|
| +import 'package:unittest/html_config.dart';
|
| +import 'dart:html';
|
| +
|
| +main() {
|
| + useHtmlConfiguration();
|
| +
|
| + var isLocation = predicate((x) => x is Location, 'is a Location');
|
| +
|
| + test('location hash', () {
|
| + final location = window.location;
|
| + expect(location, isLocation);
|
| +
|
| + // The only navigation we dare try is hash.
|
| + location.hash = 'hello';
|
| + var h = location.hash;
|
| + expect(h, '#hello');
|
| + });
|
| +
|
| + test('location.origin', () {
|
| + var origin = window.location.origin;
|
| +
|
| + // We build up the origin from Uri, then make sure that it matches.
|
| + var uri = Uri.parse(window.location.href);
|
| + var reconstructedOrigin = '${uri.scheme}://${uri.host}';
|
| + if (uri.port != 0) {
|
| + reconstructedOrigin = '$reconstructedOrigin:${uri.port}';
|
| + }
|
| +
|
| + expect(origin, reconstructedOrigin);
|
| + });
|
| +}
|
|
|