OLD | NEW |
1 library HistoryTest; | 1 library HistoryTest; |
2 import '../../pkg/unittest/lib/unittest.dart'; | 2 import '../../pkg/unittest/lib/unittest.dart'; |
3 import '../../pkg/unittest/lib/html_individual_config.dart'; | 3 import '../../pkg/unittest/lib/html_individual_config.dart'; |
4 import 'dart:html'; | 4 import 'dart:html'; |
5 | 5 |
6 /// Waits for a callback once, then removes the event handler. | 6 /// Waits for a callback once, then removes the event handler. |
7 void expectAsync1Once(EventListenerList list, void callback(arg)) { | 7 void expectAsync1Once(EventListenerList list, void callback(arg)) { |
8 var fn = null; | 8 var fn = null; |
9 fn = expectAsync1((arg) { | 9 fn = expectAsync1((arg) { |
10 list.remove(fn); | 10 list.remove(fn); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 expect(() { | 61 expect(() { |
62 var length = window.history.length; | 62 var length = window.history.length; |
63 | 63 |
64 window.history.replaceState(null, document.title, '?foo=baz'); | 64 window.history.replaceState(null, document.title, '?foo=baz'); |
65 expect(window.history.length, length); | 65 expect(window.history.length, length); |
66 expect(window.location.href.endsWith('foo=baz'), isTrue); | 66 expect(window.location.href.endsWith('foo=baz'), isTrue); |
67 }, expectation); | 67 }, expectation); |
68 }); | 68 }); |
69 | 69 |
70 test('hashchangeevent', () { | 70 test('hashchangeevent', () { |
71 var event = new HashChangeEvent('change', oldUrl:'old', newUrl: 'new'); | 71 expect(() { |
72 expect(event is HashChangeEvent, true); | 72 var event = new HashChangeEvent('change', oldUrl:'old', newUrl: 'new'); |
73 expect(event.oldUrl, 'old'); | 73 expect(event is HashChangeEvent, true); |
74 expect(event.newUrl, 'new'); | 74 expect(event.oldUrl, 'old'); |
| 75 expect(event.newUrl, 'new'); |
| 76 }, expectation); |
75 }); | 77 }); |
76 }); | 78 }); |
77 } | 79 } |
OLD | NEW |