OLD | NEW |
1 library CrossFrameTest; | |
2 import 'package:unittest/unittest.dart'; | |
3 import 'package:unittest/html_config.dart'; | |
4 import 'dart:html'; | 1 import 'dart:html'; |
5 | 2 |
| 3 import 'package:minitest/minitest.dart'; |
| 4 |
6 main() { | 5 main() { |
7 useHtmlConfiguration(); | |
8 | |
9 var isWindowBase = predicate((x) => x is WindowBase, 'is a WindowBase'); | 6 var isWindowBase = predicate((x) => x is WindowBase, 'is a WindowBase'); |
10 var isWindow = predicate((x) => x is Window, 'is a Window'); | 7 var isWindow = predicate((x) => x is Window, 'is a Window'); |
11 var isLocationBase = predicate((x) => x is LocationBase, 'is a LocationBase'); | 8 var isLocationBase = predicate((x) => x is LocationBase, 'is a LocationBase'); |
12 var isLocation = | 9 var isLocation = |
13 predicate((x) => x is Location, 'is a Location'); | 10 predicate((x) => x is Location, 'is a Location'); |
14 var isHistoryBase = predicate((x) => x is HistoryBase, 'is a HistoryBase'); | 11 var isHistoryBase = predicate((x) => x is HistoryBase, 'is a HistoryBase'); |
15 var isHistory = predicate((x) => x is History, 'is a History'); | 12 var isHistory = predicate((x) => x is History, 'is a History'); |
16 | 13 |
17 final iframe = new Element.tag('iframe'); | 14 final iframe = new IFrameElement(); |
18 document.body.append(iframe); | 15 document.body.append(iframe); |
19 | 16 |
20 test('window', () { | 17 test('window', () { |
21 expect(window, isWindow); | 18 expect(window, isWindow); |
22 expect(window.document, document); | 19 expect(window.document, document); |
23 }); | 20 }); |
24 | 21 |
25 test('iframe', () { | 22 test('iframe', () { |
26 final frameWindow = iframe.contentWindow; | 23 final frameWindow = iframe.contentWindow; |
27 expect(frameWindow, isWindowBase); | 24 expect(frameWindow, isWindowBase); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 63 |
67 // Valid methods. | 64 // Valid methods. |
68 frameHistory.forward(); | 65 frameHistory.forward(); |
69 | 66 |
70 expect(() => frameHistory.length, throws); | 67 expect(() => frameHistory.length, throws); |
71 | 68 |
72 final frameParentHistory = iframe.contentWindow.parent.history; | 69 final frameParentHistory = iframe.contentWindow.parent.history; |
73 expect(frameParentHistory, isHistory); | 70 expect(frameParentHistory, isHistory); |
74 }); | 71 }); |
75 } | 72 } |
OLD | NEW |