| OLD | NEW |
| 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/models.dart' as M; | 7 import 'package:observatory/models.dart' as M; |
| 8 import 'package:observatory/src/elements/field_ref.dart'; | 8 import 'package:observatory/src/elements/field_ref.dart'; |
| 9 import 'package:observatory/src/elements/instance_ref.dart'; | 9 import 'package:observatory/src/elements/instance_ref.dart'; |
| 10 import '../mocks.dart'; | 10 import '../mocks.dart'; |
| 11 | 11 |
| 12 main() { | 12 main() { |
| 13 FieldRefElement.tag.ensureRegistration(); | 13 FieldRefElement.tag.ensureRegistration(); |
| 14 | 14 |
| 15 final iTag = InstanceRefElement.tag.name; | 15 final iTag = InstanceRefElement.tag.name; |
| 16 | 16 |
| 17 const isolate = const IsolateRefMock(); | 17 const isolate = const IsolateRefMock(); |
| 18 const field = const FieldRefMock(); | 18 const field = const FieldRefMock(); |
| 19 const declaredType = | 19 const declaredType = const InstanceMock(kind: M.InstanceKind.type, |
| 20 const InstanceMock(kind: M.InstanceKind.type, name: 'CustomObject'); | 20 name: 'CustomObject'); |
| 21 const field_non_dynamic = const FieldRefMock(declaredType: declaredType); | 21 const field_non_dynamic = const FieldRefMock(declaredType: declaredType); |
| 22 final repository = new InstanceRepositoryMock(); | 22 final repository = new InstanceRepositoryMock(); |
| 23 test('instantiation', () { | 23 test('instantiation', () { |
| 24 final e = new FieldRefElement(isolate, field, repository); | 24 final e = new FieldRefElement(isolate, field, repository); |
| 25 expect(e, isNotNull, reason: 'element correctly created'); | 25 expect(e, isNotNull, reason: 'element correctly created'); |
| 26 expect(e.isolate, equals(isolate)); | 26 expect(e.isolate, equals(isolate)); |
| 27 expect(e.field, equals(field)); | 27 expect(e.field, equals(field)); |
| 28 }); | 28 }); |
| 29 group('elements', () { | 29 group('elements', () { |
| 30 test('created after attachment (dynamic)', () async { | 30 test('created after attachment (dynamic)', () async { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 42 document.body.append(e); | 42 document.body.append(e); |
| 43 await e.onRendered.first; | 43 await e.onRendered.first; |
| 44 expect(e.children.length, isNonZero, reason: 'has elements'); | 44 expect(e.children.length, isNonZero, reason: 'has elements'); |
| 45 expect(e.querySelectorAll(iTag).length, equals(1)); | 45 expect(e.querySelectorAll(iTag).length, equals(1)); |
| 46 e.remove(); | 46 e.remove(); |
| 47 await e.onRendered.first; | 47 await e.onRendered.first; |
| 48 expect(e.children.length, isZero, reason: 'is empty'); | 48 expect(e.children.length, isZero, reason: 'is empty'); |
| 49 }); | 49 }); |
| 50 }); | 50 }); |
| 51 } | 51 } |
| OLD | NEW |