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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 main() { | 7 main() { |
8 useHtmlIndividualConfiguration(); | 8 useHtmlIndividualConfiguration(); |
9 | 9 |
10 group('supported_state', () { | 10 group('supported_state', () { |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 test('back', () { | 37 test('back', () { |
38 expect(() { | 38 expect(() { |
39 window.history.pushState(null, document.title, '?dummy1'); | 39 window.history.pushState(null, document.title, '?dummy1'); |
40 window.history.pushState(null, document.title, '?dummy2'); | 40 window.history.pushState(null, document.title, '?dummy2'); |
41 var length = window.history.length; | 41 var length = window.history.length; |
42 | 42 |
43 expect(window.location.href.endsWith('dummy2'), isTrue); | 43 expect(window.location.href.endsWith('dummy2'), isTrue); |
44 | 44 |
45 // Need to wait a frame or two to let the pushState events occur. | 45 // Need to wait a frame or two to let the pushState events occur. |
46 new Timer(const Duration(milliseconds: 100), expectAsync0(() { | 46 new Timer(const Duration(milliseconds: 100), expectAsync(() { |
47 window.onPopState.first.then(expectAsync1((_){ | 47 window.onPopState.first.then(expectAsync((_){ |
48 expect(window.history.length, length); | 48 expect(window.history.length, length); |
49 expect(window.location.href.endsWith('dummy1'), isTrue); | 49 expect(window.location.href.endsWith('dummy1'), isTrue); |
50 })); | 50 })); |
51 | 51 |
52 window.history.back(); | 52 window.history.back(); |
53 })); | 53 })); |
54 }, expectation); | 54 }, expectation); |
55 }); | 55 }); |
56 | 56 |
57 test('replaceState', () { | 57 test('replaceState', () { |
(...skipping 17 matching lines...) Expand all Loading... |
75 var expectation = HashChangeEvent.supported ? returnsNormally : throws; | 75 var expectation = HashChangeEvent.supported ? returnsNormally : throws; |
76 expect(() { | 76 expect(() { |
77 var event = new HashChangeEvent('change', oldUrl:'old', newUrl: 'new'); | 77 var event = new HashChangeEvent('change', oldUrl:'old', newUrl: 'new'); |
78 expect(event is HashChangeEvent, true); | 78 expect(event is HashChangeEvent, true); |
79 expect(event.oldUrl, 'old'); | 79 expect(event.oldUrl, 'old'); |
80 expect(event.newUrl, 'new'); | 80 expect(event.newUrl, 'new'); |
81 }, expectation); | 81 }, expectation); |
82 }); | 82 }); |
83 }); | 83 }); |
84 } | 84 } |
OLD | NEW |