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

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

Issue 2995923002: Restore "Speedup Observatory elements first time rendering" (Closed)
Patch Set: Created 3 years, 4 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();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 }); 60 });
61 test('disabled', () { 61 test('disabled', () {
62 final e = new CurlyBlockElement(disabled: true); 62 final e = new CurlyBlockElement(disabled: true);
63 expect(e, isNotNull, reason: 'element correctly created'); 63 expect(e, isNotNull, reason: 'element correctly created');
64 expect(e.expanded, isFalse); 64 expect(e.expanded, isFalse);
65 expect(e.disabled, isTrue); 65 expect(e.disabled, isTrue);
66 }); 66 });
67 }); 67 });
68 test('elements created', () async { 68 test('elements created', () async {
69 final e = new CurlyBlockElement(); 69 final e = new CurlyBlockElement();
70 expect(e.children.length, isZero, reason: 'is empty'); 70 expect(e.children, isEmpty, reason: 'is empty');
71 document.body.append(e); 71 document.body.append(e);
72 await e.onRendered.first; 72 await e.onRendered.first;
73 expect(e.children.length, isNonZero, reason: 'has elements'); 73 expect(e.children, isNotEmpty, reason: 'has elements');
74 e.remove(); 74 e.remove();
75 await e.onRendered.first; 75 await e.onRendered.first;
76 expect(e.children.length, isZero, reason: 'is empty'); 76 expect(e.children, isEmpty, reason: 'is empty');
77 }); 77 });
78 group('content', () { 78 group('content', () {
79 CurlyBlockElement e; 79 CurlyBlockElement e;
80 setUp(() async { 80 setUp(() async {
81 e = new CurlyBlockElement(); 81 e = new CurlyBlockElement();
82 e.content = [document.createElement('content')]; 82 e.content = [document.createElement('content')];
83 document.body.append(e); 83 document.body.append(e);
84 await e.onRendered.first; 84 await e.onRendered.first;
85 }); 85 });
86 tearDown(() { 86 tearDown(() {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 e.expanded = !e.expanded; 167 e.expanded = !e.expanded;
168 await e.onRendered.first; 168 await e.onRendered.first;
169 }); 169 });
170 test('does not fire if setting same expanded value', () async { 170 test('does not fire if setting same expanded value', () async {
171 e.onToggle.listen(expectAsync((_) {}, count: 0)); 171 e.onToggle.listen(expectAsync((_) {}, count: 0));
172 e.expanded = e.expanded; 172 e.expanded = e.expanded;
173 await e.onRendered.first; 173 await e.onRendered.first;
174 }); 174 });
175 }); 175 });
176 } 176 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698