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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/tests/observatory_ui/field_ref/element_test.dart
diff --git a/runtime/observatory/tests/observatory_ui/field_ref/element_test.dart b/runtime/observatory/tests/observatory_ui/field_ref/element_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..f576f54304b9b1462bbadfb3b134d1d76687db73
--- /dev/null
+++ b/runtime/observatory/tests/observatory_ui/field_ref/element_test.dart
@@ -0,0 +1,51 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:html';
+import 'package:unittest/unittest.dart';
+import 'package:observatory/models.dart' as M;
+import 'package:observatory/src/elements/field_ref.dart';
+import 'package:observatory/src/elements/instance_ref.dart';
+import '../mocks.dart';
+
+main() {
+ FieldRefElement.tag.ensureRegistration();
+
+ final iTag = InstanceRefElement.tag.name;
+
+ const isolate = const IsolateRefMock();
+ const field = const FieldRefMock();
+ const declaredType = const InstanceMock(kind: M.InstanceKind.type,
+ name: 'CustomObject');
+ const field_non_dynamic = const FieldRefMock(declaredType: declaredType);
+ final repository = new InstanceRepositoryMock();
+ test('instantiation', () {
+ final e = new FieldRefElement(isolate, field, repository);
+ expect(e, isNotNull, reason: 'element correctly created');
+ expect(e.isolate, equals(isolate));
+ expect(e.field, equals(field));
+ });
+ group('elements', () {
+ test('created after attachment (dynamic)', () async {
+ final e = new FieldRefElement(isolate, field, repository);
+ document.body.append(e);
+ await e.onRendered.first;
+ expect(e.children.length, isNonZero, reason: 'has elements');
+ expect(e.querySelectorAll(iTag).length, isZero);
+ e.remove();
+ await e.onRendered.first;
+ expect(e.children.length, isZero, reason: 'is empty');
+ });
+ test('created after attachment (non dynamic)', () async {
+ final e = new FieldRefElement(isolate, field_non_dynamic, repository);
+ document.body.append(e);
+ await e.onRendered.first;
+ expect(e.children.length, isNonZero, reason: 'has elements');
+ expect(e.querySelectorAll(iTag).length, equals(1));
+ e.remove();
+ await e.onRendered.first;
+ expect(e.children.length, isZero, reason: 'is empty');
+ });
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698