Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(750)

Side by Side Diff: tests/html/history_test.dart

Issue 12052064: Adding test & annotations for popstatevent. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/scripts/generator.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 test('replaceState', () { 66 test('replaceState', () {
67 expect(() { 67 expect(() {
68 var length = window.history.length; 68 var length = window.history.length;
69 69
70 window.history.replaceState(null, document.title, '?foo=baz'); 70 window.history.replaceState(null, document.title, '?foo=baz');
71 expect(window.history.length, length); 71 expect(window.history.length, length);
72 expect(window.location.href.endsWith('foo=baz'), isTrue); 72 expect(window.location.href.endsWith('foo=baz'), isTrue);
73 }, expectation); 73 }, expectation);
74 }); 74 });
75 75
76 test('popstatevent', () {
77 expect(() {
78 var event = new Event.eventType('PopStateEvent', 'popstate');
79 expect(event is PopStateEvent, true);
80 }, expectation);
81 });
82
76 test('hashchangeevent', () { 83 test('hashchangeevent', () {
77 var expectation = HashChangeEvent.supported ? returnsNormally : throws; 84 var expectation = HashChangeEvent.supported ? returnsNormally : throws;
78 expect(() { 85 expect(() {
79 var event = new HashChangeEvent('change', oldUrl:'old', newUrl: 'new'); 86 var event = new HashChangeEvent('change', oldUrl:'old', newUrl: 'new');
80 expect(event is HashChangeEvent, true); 87 expect(event is HashChangeEvent, true);
81 expect(event.oldUrl, 'old'); 88 expect(event.oldUrl, 'old');
82 expect(event.newUrl, 'new'); 89 expect(event.newUrl, 'new');
83 }, expectation); 90 }, expectation);
84 }); 91 });
85 }); 92 });
86 } 93 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tools/dom/scripts/generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698