| OLD | NEW |
| 1 library HistoryTest; | 1 library HistoryTest; |
| 2 import 'package:unittest/unittest.dart'; | 2 import 'package:unittest/unittest.dart'; |
| 3 import 'package:unittest/html_individual_config.dart'; | 3 import 'package:unittest/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 16 matching lines...) Expand all Loading... |
| 27 window.history.pushState(null, document.title, '?dummy'); | 27 window.history.pushState(null, document.title, '?dummy'); |
| 28 var length = window.history.length; | 28 var length = window.history.length; |
| 29 | 29 |
| 30 window.history.pushState(null, document.title, '?foo=bar'); | 30 window.history.pushState(null, document.title, '?foo=bar'); |
| 31 | 31 |
| 32 expect(window.location.href.endsWith('foo=bar'), isTrue); | 32 expect(window.location.href.endsWith('foo=bar'), isTrue); |
| 33 | 33 |
| 34 }, expectation); | 34 }, expectation); |
| 35 }); | 35 }); |
| 36 | 36 |
| 37 test('pushState with data', () { |
| 38 expect(() { |
| 39 window.history.pushState({'one' : 1}, document.title, '?dummy'); |
| 40 expect(window.history.state, equals({'one' : 1})); |
| 41 window.history.pushState(null, document.title, '?foo=bar'); |
| 42 |
| 43 expect(window.location.href.endsWith('foo=bar'), isTrue); |
| 44 |
| 45 }, expectation); |
| 46 }); |
| 47 |
| 37 test('back', () { | 48 test('back', () { |
| 38 expect(() { | 49 expect(() { |
| 39 window.history.pushState(null, document.title, '?dummy1'); | 50 window.history.pushState(null, document.title, '?dummy1'); |
| 40 window.history.pushState(null, document.title, '?dummy2'); | 51 window.history.pushState(null, document.title, '?dummy2'); |
| 41 var length = window.history.length; | 52 var length = window.history.length; |
| 42 | 53 |
| 43 expect(window.location.href.endsWith('dummy2'), isTrue); | 54 expect(window.location.href.endsWith('dummy2'), isTrue); |
| 44 | 55 |
| 45 // Need to wait a frame or two to let the pushState events occur. | 56 // Need to wait a frame or two to let the pushState events occur. |
| 46 new Timer(const Duration(milliseconds: 100), expectAsync(() { | 57 new Timer(const Duration(milliseconds: 100), expectAsync(() { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 75 var expectation = HashChangeEvent.supported ? returnsNormally : throws; | 86 var expectation = HashChangeEvent.supported ? returnsNormally : throws; |
| 76 expect(() { | 87 expect(() { |
| 77 var event = new HashChangeEvent('change', oldUrl:'old', newUrl: 'new'); | 88 var event = new HashChangeEvent('change', oldUrl:'old', newUrl: 'new'); |
| 78 expect(event is HashChangeEvent, true); | 89 expect(event is HashChangeEvent, true); |
| 79 expect(event.oldUrl, 'old'); | 90 expect(event.oldUrl, 'old'); |
| 80 expect(event.newUrl, 'new'); | 91 expect(event.newUrl, 'new'); |
| 81 }, expectation); | 92 }, expectation); |
| 82 }); | 93 }); |
| 83 }); | 94 }); |
| 84 } | 95 } |
| OLD | NEW |