| OLD | NEW |
| 1 library LocationTest; | 1 library LocationTest; |
| 2 import '../../pkg/unittest/lib/unittest.dart'; | 2 import '../../pkg/unittest/lib/unittest.dart'; |
| 3 import '../../pkg/unittest/lib/html_config.dart'; | 3 import '../../pkg/unittest/lib/html_config.dart'; |
| 4 import 'dart:html'; | 4 import 'dart:html'; |
| 5 import 'dart:uri'; | |
| 6 | 5 |
| 7 main() { | 6 main() { |
| 8 useHtmlConfiguration(); | 7 useHtmlConfiguration(); |
| 9 | 8 |
| 10 var isLocation = predicate((x) => x is Location, 'is a Location'); | 9 var isLocation = predicate((x) => x is Location, 'is a Location'); |
| 11 | 10 |
| 12 test('location hash', () { | 11 test('location hash', () { |
| 13 final location = window.location; | 12 final location = window.location; |
| 14 expect(location, isLocation); | 13 expect(location, isLocation); |
| 15 | 14 |
| 16 // The only navigation we dare try is hash. | 15 // The only navigation we dare try is hash. |
| 17 location.hash = 'hello'; | 16 location.hash = 'hello'; |
| 18 var h = location.hash; | 17 var h = location.hash; |
| 19 expect(h, '#hello'); | 18 expect(h, '#hello'); |
| 20 }); | 19 }); |
| 21 | 20 |
| 22 test('location.origin', () { | 21 test('location.origin', () { |
| 23 var origin = window.location.origin; | 22 var origin = window.location.origin; |
| 24 | 23 |
| 25 // We build up the origin from Uri, then make sure that it matches. | 24 // We build up the origin from Uri, then make sure that it matches. |
| 26 var uri = new Uri(window.location.href); | 25 var uri = new Uri(window.location.href); |
| 27 var reconstructedOrigin = '${uri.scheme}://${uri.domain}'; | 26 var reconstructedOrigin = '${uri.scheme}://${uri.host}'; |
| 28 if (uri.port != 0) { | 27 if (uri.port != 0) { |
| 29 reconstructedOrigin = '$reconstructedOrigin:${uri.port}'; | 28 reconstructedOrigin = '$reconstructedOrigin:${uri.port}'; |
| 30 } | 29 } |
| 31 | 30 |
| 32 expect(origin, reconstructedOrigin); | 31 expect(origin, reconstructedOrigin); |
| 33 }); | 32 }); |
| 34 } | 33 } |
| OLD | NEW |