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

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

Issue 1414903007: Serialize the data argument to History's state-related APIs. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add a TODO Created 5 years, 1 month 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
« 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 '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
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
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 }
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