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

Side by Side Diff: runtime/observatory/tests/observatory_ui/curly_block/element_test.dart

Issue 2759973004: Fix observatory tests broken by running dartfmt. Temporarily reverted formatting for evaluate_activ… (Closed)
Patch Set: Created 3 years, 9 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 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:html'; 5 import 'dart:html';
6 import 'package:unittest/unittest.dart'; 6 import 'package:unittest/unittest.dart';
7 import 'package:observatory/src/elements/curly_block.dart'; 7 import 'package:observatory/src/elements/curly_block.dart';
8 8
9 main() { 9 main() {
10 CurlyBlockElement.tag.ensureRegistration(); 10 CurlyBlockElement.tag.ensureRegistration();
11 11
12 group('instantiation', () { 12 group('instantiation', () {
13 test('default', () { 13 test('default', () {
14 final e = new CurlyBlockElement(); 14 final e = new CurlyBlockElement();
15 expect(e, isNotNull, reason: 'element correctly created'); 15 expect(e, isNotNull, reason: 'element correctly created');
16 expect(e.expanded, isFalse); 16 expect(e.expanded, isFalse);
17 expect(e.disabled, isFalse); 17 expect(e.disabled, isFalse);
18 }); 18 });
19 test('not expanded', () { 19 test('not expanded', () {
20 final e = new CurlyBlockElement(expanded: false); 20 final e = new CurlyBlockElement(expanded: false);
21 expect(e, isNotNull, reason: 'element correctly created'); 21 expect(e, isNotNull, reason: 'element correctly created');
22 expect(e.expanded, isFalse); 22 expect(e.expanded, isFalse);
23 expect(e.disabled, isFalse); 23 expect(e.disabled, isFalse);
24 }); 24 });
25 test('not expanded / not disabled', () { 25 test('not expanded / not disabled', () {
26 final e = new CurlyBlockElement(expanded: false, 26 final e = new CurlyBlockElement(expanded: false, disabled: false);
27 disabled: false);
28 expect(e, isNotNull, reason: 'element correctly created'); 27 expect(e, isNotNull, reason: 'element correctly created');
29 expect(e.expanded, isFalse); 28 expect(e.expanded, isFalse);
30 expect(e.disabled, isFalse); 29 expect(e.disabled, isFalse);
31 }); 30 });
32 test('not expanded / disabled', () { 31 test('not expanded / disabled', () {
33 final e = new CurlyBlockElement(expanded: false, 32 final e = new CurlyBlockElement(expanded: false, disabled: true);
34 disabled: true);
35 expect(e, isNotNull, reason: 'element correctly created'); 33 expect(e, isNotNull, reason: 'element correctly created');
36 expect(e.expanded, isFalse); 34 expect(e.expanded, isFalse);
37 expect(e.disabled, isTrue); 35 expect(e.disabled, isTrue);
38 }); 36 });
39 test('expanded', () { 37 test('expanded', () {
40 final e = new CurlyBlockElement(expanded: true); 38 final e = new CurlyBlockElement(expanded: true);
41 expect(e, isNotNull, reason: 'element correctly created'); 39 expect(e, isNotNull, reason: 'element correctly created');
42 expect(e.expanded, isTrue); 40 expect(e.expanded, isTrue);
43 expect(e.disabled, isFalse); 41 expect(e.disabled, isFalse);
44 }); 42 });
(...skipping 20 matching lines...) Expand all
65 expect(e, isNotNull, reason: 'element correctly created'); 63 expect(e, isNotNull, reason: 'element correctly created');
66 expect(e.expanded, isFalse); 64 expect(e.expanded, isFalse);
67 expect(e.disabled, isTrue); 65 expect(e.disabled, isTrue);
68 }); 66 });
69 }); 67 });
70 test('elements created', () async { 68 test('elements created', () async {
71 final e = new CurlyBlockElement(); 69 final e = new CurlyBlockElement();
72 expect(e.children.length, isZero, reason: 'is empty'); 70 expect(e.children.length, isZero, reason: 'is empty');
73 document.body.append(e); 71 document.body.append(e);
74 await e.onRendered.first; 72 await e.onRendered.first;
75 expect(e.children.length, isNonZero, 73 expect(e.children.length, isNonZero, reason: 'has elements');
76 reason: 'has elements');
77 e.remove(); 74 e.remove();
78 await e.onRendered.first; 75 await e.onRendered.first;
79 expect(e.children.length, isZero, reason: 'is empty'); 76 expect(e.children.length, isZero, reason: 'is empty');
80 }); 77 });
81 group('content', () { 78 group('content', () {
82 CurlyBlockElement e; 79 CurlyBlockElement e;
83 setUp(() async { 80 setUp(() async {
84 e = new CurlyBlockElement(); 81 e = new CurlyBlockElement();
85 e.content = [document.createElement('content')]; 82 e.content = [document.createElement('content')];
86 document.body.append(e); 83 document.body.append(e);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 setUp(() async { 145 setUp(() async {
149 e = new CurlyBlockElement(); 146 e = new CurlyBlockElement();
150 document.body.append(e); 147 document.body.append(e);
151 await e.onRendered.first; 148 await e.onRendered.first;
152 }); 149 });
153 tearDown(() async { 150 tearDown(() async {
154 e.remove(); 151 e.remove();
155 await e.onRendered.first; 152 await e.onRendered.first;
156 }); 153 });
157 test('fires on toggle', () async { 154 test('fires on toggle', () async {
158 e.onToggle.listen(expectAsync((CurlyBlockToggleEvent event){ 155 e.onToggle.listen(expectAsync((CurlyBlockToggleEvent event) {
159 expect(event, isNotNull); 156 expect(event, isNotNull);
160 expect(event.control, equals(e)); 157 expect(event.control, equals(e));
161 }, count: 1)); 158 }, count: 1));
162 e.toggle(); 159 e.toggle();
163 await e.onRendered.first; 160 await e.onRendered.first;
164 }); 161 });
165 test('fires on manual toggle', () async { 162 test('fires on manual toggle', () async {
166 e.onToggle.listen(expectAsync((CurlyBlockToggleEvent event){ 163 e.onToggle.listen(expectAsync((CurlyBlockToggleEvent event) {
167 expect(event, isNotNull); 164 expect(event, isNotNull);
168 expect(event.control, equals(e)); 165 expect(event.control, equals(e));
169 }, count: 1)); 166 }, count: 1));
170 e.expanded = !e.expanded; 167 e.expanded = !e.expanded;
171 await e.onRendered.first; 168 await e.onRendered.first;
172 }); 169 });
173 test('does not fire if setting same expanded value', () async { 170 test('does not fire if setting same expanded value', () async {
174 e.onToggle.listen(expectAsync((_){}, count: 0)); 171 e.onToggle.listen(expectAsync((_) {}, count: 0));
175 e.expanded = e.expanded; 172 e.expanded = e.expanded;
176 await e.onRendered.first; 173 await e.onRendered.first;
177 }); 174 });
178 }); 175 });
179 } 176 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698