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/src/elements/icdata_view.dart'; | 7 import 'package:observatory/src/elements/icdata_view.dart'; |
8 import 'package:observatory/src/elements/nav/refresh.dart'; | 8 import 'package:observatory/src/elements/nav/refresh.dart'; |
9 import 'package:observatory/src/elements/object_common.dart'; | 9 import 'package:observatory/src/elements/object_common.dart'; |
10 import '../mocks.dart'; | 10 import '../mocks.dart'; |
(...skipping 10 matching lines...) Expand all Loading... |
21 final notifs = new NotificationRepositoryMock(); | 21 final notifs = new NotificationRepositoryMock(); |
22 final icdata = const ICDataMock(); | 22 final icdata = const ICDataMock(); |
23 final icdatas = new ICDataRepositoryMock(); | 23 final icdatas = new ICDataRepositoryMock(); |
24 final reachableSizes = new ReachableSizeRepositoryMock(); | 24 final reachableSizes = new ReachableSizeRepositoryMock(); |
25 final retainedSizes = new RetainedSizeRepositoryMock(); | 25 final retainedSizes = new RetainedSizeRepositoryMock(); |
26 final inbounds = new InboundReferencesRepositoryMock(); | 26 final inbounds = new InboundReferencesRepositoryMock(); |
27 final paths = new RetainingPathRepositoryMock(); | 27 final paths = new RetainingPathRepositoryMock(); |
28 final instances = new InstanceRepositoryMock(); | 28 final instances = new InstanceRepositoryMock(); |
29 test('instantiation', () { | 29 test('instantiation', () { |
30 final e = new ICDataViewElement(vm, isolate, icdata, events, notifs, | 30 final e = new ICDataViewElement(vm, isolate, icdata, events, notifs, |
31 icdatas, retainedSizes, reachableSizes, | 31 icdatas, retainedSizes, reachableSizes, inbounds, paths, instances); |
32 inbounds, paths, instances); | |
33 expect(e, isNotNull, reason: 'element correctly created'); | 32 expect(e, isNotNull, reason: 'element correctly created'); |
34 expect(e.isolate, equals(isolate)); | 33 expect(e.isolate, equals(isolate)); |
35 expect(e.icdata, equals(icdata)); | 34 expect(e.icdata, equals(icdata)); |
36 }); | 35 }); |
37 test('elements created after attachment', () async { | 36 test('elements created after attachment', () async { |
38 final icdatas = new ICDataRepositoryMock( | 37 final icdatas = new ICDataRepositoryMock( |
39 getter: expectAsync((i, id) async { | 38 getter: expectAsync((i, id) async { |
40 expect(i, equals(isolate)); | 39 expect(i, equals(isolate)); |
41 expect(id, equals(icdata.id)); | 40 expect(id, equals(icdata.id)); |
42 return icdata; | 41 return icdata; |
43 }, count: 1) | 42 }, count: 1)); |
44 ); | |
45 final e = new ICDataViewElement(vm, isolate, icdata, events, notifs, | 43 final e = new ICDataViewElement(vm, isolate, icdata, events, notifs, |
46 icdatas, retainedSizes, reachableSizes, | 44 icdatas, retainedSizes, reachableSizes, inbounds, paths, instances); |
47 inbounds, paths, instances); | |
48 document.body.append(e); | 45 document.body.append(e); |
49 await e.onRendered.first; | 46 await e.onRendered.first; |
50 expect(e.children.length, isNonZero, reason: 'has elements'); | 47 expect(e.children.length, isNonZero, reason: 'has elements'); |
51 expect(e.querySelectorAll(cTag).length, equals(1)); | 48 expect(e.querySelectorAll(cTag).length, equals(1)); |
52 (e.querySelector(rTag) as NavRefreshElement).refresh(); | 49 (e.querySelector(rTag) as NavRefreshElement).refresh(); |
53 await e.onRendered.first; | 50 await e.onRendered.first; |
54 e.remove(); | 51 e.remove(); |
55 await e.onRendered.first; | 52 await e.onRendered.first; |
56 expect(e.children.length, isZero, reason: 'is empty'); | 53 expect(e.children.length, isZero, reason: 'is empty'); |
57 }); | 54 }); |
58 } | 55 } |
OLD | NEW |