| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 @TestOn('browser') |
| 6 |
| 5 import 'dart:html'; | 7 import 'dart:html'; |
| 6 | 8 |
| 7 import 'package:unittest/unittest.dart'; | 9 import 'package:test/test.dart'; |
| 8 import 'package:unittest/html_config.dart'; | |
| 9 import 'package:path/path.dart' as path; | 10 import 'package:path/path.dart' as path; |
| 10 | 11 |
| 11 main() { | 12 main() { |
| 12 useHtmlConfiguration(); | |
| 13 | |
| 14 group('new Context()', () { | 13 group('new Context()', () { |
| 15 test('uses the window location if root and style are omitted', () { | 14 test('uses the window location if root and style are omitted', () { |
| 16 var context = new path.Context(); | 15 var context = new path.Context(); |
| 17 expect(context.current, | 16 expect(context.current, |
| 18 Uri.parse(window.location.href).resolve('.').toString()); | 17 Uri.parse(window.location.href).resolve('.').toString()); |
| 19 }); | 18 }); |
| 20 | 19 |
| 21 test('uses "." if root is omitted', () { | 20 test('uses "." if root is omitted', () { |
| 22 var context = new path.Context(style: path.Style.platform); | 21 var context = new path.Context(style: path.Style.platform); |
| 23 expect(context.current, "."); | 22 expect(context.current, "."); |
| 24 }); | 23 }); |
| 25 | 24 |
| 26 test('uses the host platform if style is omitted', () { | 25 test('uses the host platform if style is omitted', () { |
| 27 var context = new path.Context(); | 26 var context = new path.Context(); |
| 28 expect(context.style, path.Style.platform); | 27 expect(context.style, path.Style.platform); |
| 29 }); | 28 }); |
| 30 }); | 29 }); |
| 31 | 30 |
| 32 test('Style.platform is url', () { | 31 test('Style.platform is url', () { |
| 33 expect(path.Style.platform, path.Style.url); | 32 expect(path.Style.platform, path.Style.url); |
| 34 }); | 33 }); |
| 35 | 34 |
| 36 test('current', () { | 35 test('current', () { |
| 37 expect( | 36 expect( |
| 38 path.current, Uri.parse(window.location.href).resolve('.').toString()); | 37 path.current, Uri.parse(window.location.href).resolve('.').toString()); |
| 39 }); | 38 }); |
| 40 } | 39 } |
| OLD | NEW |