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

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

Issue 2244433003: Converted Observatory refs elements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: All element tested Created 4 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:html';
6 import 'package:unittest/unittest.dart';
7 import 'package:observatory/models.dart' as M;
8 import 'package:observatory/src/elements/field_ref.dart';
9 import 'package:observatory/src/elements/instance_ref.dart';
10 import '../mocks.dart';
11
12 main() {
13 FieldRefElement.tag.ensureRegistration();
14
15 final iTag = InstanceRefElement.tag.name;
16
17 const isolate = const IsolateRefMock();
18 const field = const FieldRefMock();
19 const declaredType = const InstanceMock(kind: M.InstanceKind.type,
20 name: 'CustomObject');
21 const field_non_dynamic = const FieldRefMock(declaredType: declaredType);
22 final repository = new InstanceRepositoryMock();
23 test('instantiation', () {
24 final e = new FieldRefElement(isolate, field, repository);
25 expect(e, isNotNull, reason: 'element correctly created');
26 expect(e.isolate, equals(isolate));
27 expect(e.field, equals(field));
28 });
29 group('elements', () {
30 test('created after attachment (dynamic)', () async {
31 final e = new FieldRefElement(isolate, field, repository);
32 document.body.append(e);
33 await e.onRendered.first;
34 expect(e.children.length, isNonZero, reason: 'has elements');
35 expect(e.querySelectorAll(iTag).length, isZero);
36 e.remove();
37 await e.onRendered.first;
38 expect(e.children.length, isZero, reason: 'is empty');
39 });
40 test('created after attachment (non dynamic)', () async {
41 final e = new FieldRefElement(isolate, field_non_dynamic, repository);
42 document.body.append(e);
43 await e.onRendered.first;
44 expect(e.children.length, isNonZero, reason: 'has elements');
45 expect(e.querySelectorAll(iTag).length, equals(1));
46 e.remove();
47 await e.onRendered.first;
48 expect(e.children.length, isZero, reason: 'is empty');
49 });
50 });
51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698