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

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

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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
OLDNEW
1 library HistoryTest; 1 library HistoryTest;
2
2 import 'package:unittest/unittest.dart'; 3 import 'package:unittest/unittest.dart';
3 import 'package:unittest/html_individual_config.dart'; 4 import 'package:unittest/html_individual_config.dart';
4 import 'dart:html'; 5 import 'dart:html';
5 import 'dart:async'; 6 import 'dart:async';
6 7
7 main() { 8 main() {
8 useHtmlIndividualConfiguration(); 9 useHtmlIndividualConfiguration();
9 10
10 group('supported_state', () { 11 group('supported_state', () {
11 test('supportsState', () { 12 test('supportsState', () {
(...skipping 11 matching lines...) Expand all
23 24
24 group('history', () { 25 group('history', () {
25 test('pushState', () { 26 test('pushState', () {
26 expect(() { 27 expect(() {
27 window.history.pushState(null, document.title, '?dummy'); 28 window.history.pushState(null, document.title, '?dummy');
28 var length = window.history.length; 29 var length = window.history.length;
29 30
30 window.history.pushState(null, document.title, '?foo=bar'); 31 window.history.pushState(null, document.title, '?foo=bar');
31 32
32 expect(window.location.href.endsWith('foo=bar'), isTrue); 33 expect(window.location.href.endsWith('foo=bar'), isTrue);
33
34 }, expectation); 34 }, expectation);
35 }); 35 });
36 36
37 test('pushState with data', () { 37 test('pushState with data', () {
38 expect(() { 38 expect(() {
39 window.history.pushState({'one' : 1}, document.title, '?dummy'); 39 window.history.pushState({'one': 1}, document.title, '?dummy');
40 expect(window.history.state, equals({'one' : 1})); 40 expect(window.history.state, equals({'one': 1}));
41 window.history.pushState(null, document.title, '?foo=bar'); 41 window.history.pushState(null, document.title, '?foo=bar');
42 42
43 expect(window.location.href.endsWith('foo=bar'), isTrue); 43 expect(window.location.href.endsWith('foo=bar'), isTrue);
44
45 }, expectation); 44 }, expectation);
46 }); 45 });
47 46
48 test('back', () { 47 test('back', () {
49 expect(() { 48 expect(() {
50 window.history.pushState(null, document.title, '?dummy1'); 49 window.history.pushState(null, document.title, '?dummy1');
51 window.history.pushState(null, document.title, '?dummy2'); 50 window.history.pushState(null, document.title, '?dummy2');
52 var length = window.history.length; 51 var length = window.history.length;
53 52
54 expect(window.location.href.endsWith('dummy2'), isTrue); 53 expect(window.location.href.endsWith('dummy2'), isTrue);
55 54
56 // Need to wait a frame or two to let the pushState events occur. 55 // Need to wait a frame or two to let the pushState events occur.
57 new Timer(const Duration(milliseconds: 100), expectAsync(() { 56 new Timer(const Duration(milliseconds: 100), expectAsync(() {
58 window.onPopState.first.then(expectAsync((_){ 57 window.onPopState.first.then(expectAsync((_) {
59 expect(window.history.length, length); 58 expect(window.history.length, length);
60 expect(window.location.href.endsWith('dummy1'), isTrue); 59 expect(window.location.href.endsWith('dummy1'), isTrue);
61 })); 60 }));
62 61
63 window.history.back(); 62 window.history.back();
64 })); 63 }));
65 }, expectation); 64 }, expectation);
66 }); 65 });
67 66
68 test('replaceState', () { 67 test('replaceState', () {
69 expect(() { 68 expect(() {
70 var length = window.history.length; 69 var length = window.history.length;
71 70
72 window.history.replaceState(null, document.title, '?foo=baz'); 71 window.history.replaceState(null, document.title, '?foo=baz');
73 expect(window.history.length, length); 72 expect(window.history.length, length);
74 expect(window.location.href.endsWith('foo=baz'), isTrue); 73 expect(window.location.href.endsWith('foo=baz'), isTrue);
75 }, expectation); 74 }, expectation);
76 }); 75 });
77 76
78 test('popstatevent', () { 77 test('popstatevent', () {
79 expect(() { 78 expect(() {
80 var event = new Event.eventType('PopStateEvent', 'popstate'); 79 var event = new Event.eventType('PopStateEvent', 'popstate');
81 expect(event is PopStateEvent, true); 80 expect(event is PopStateEvent, true);
82 }, expectation); 81 }, expectation);
83 }); 82 });
84 83
85 test('hashchangeevent', () { 84 test('hashchangeevent', () {
86 var expectation = HashChangeEvent.supported ? returnsNormally : throws; 85 var expectation = HashChangeEvent.supported ? returnsNormally : throws;
87 expect(() { 86 expect(() {
88 var event = new HashChangeEvent('change', oldUrl:'old', newUrl: 'new'); 87 var event = new HashChangeEvent('change', oldUrl: 'old', newUrl: 'new');
89 expect(event is HashChangeEvent, true); 88 expect(event is HashChangeEvent, true);
90 expect(event.oldUrl, 'old'); 89 expect(event.oldUrl, 'old');
91 expect(event.newUrl, 'new'); 90 expect(event.newUrl, 'new');
92 }, expectation); 91 }, expectation);
93 }); 92 });
94 }); 93 });
95 } 94 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698