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

Side by Side Diff: runtime/observatory/tests/observatory_ui/vm_connect_target_test.dart

Issue 2119733003: Wrapping leaf nodes in non polymer elements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Converted error-ref tag Created 4 years, 5 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) 2015, 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 import 'dart:html';
5 import 'dart:async';
6 import 'package:unittest/unittest.dart';
7 import 'package:observatory/service_html.dart';
8 import 'package:observatory/src/elements/vm_connect_target.dart';
9
10 import 'helpers/webcomponents.dart';
11
12 main() async {
13 await loadWebComponents();
14 VmConnectTargetElement.tag.ensureRegistration();
15
16 WebSocketVMTarget t;
17 setUp(() {
18 t = new WebSocketVMTarget("a network address");
19 });
20 group('instantiation', () {
21 group('target: valid', () {
22 test('no other parameters', () {
23 final VmConnectTargetElement e = new VmConnectTargetElement(t);
24 expect(e, isNotNull, reason: 'element correctly created');
25 expect(e.target, t, reason: 'target not setted');
26 expect(e.current, isFalse, reason: 'default to not current');
27 });
28 test('isCurrent: false', () {
29 final VmConnectTargetElement e = new VmConnectTargetElement(t,
30 current:false);
31 expect(e, isNotNull, reason: 'element correctly created');
32 expect(e.target, t, reason: 'target not setted');
33 expect(e.current, isFalse, reason: 'default to not current');
34 });
35 test('isCurrent: true', () {
36 final VmConnectTargetElement e = new VmConnectTargetElement(t,
37 current:true);
38 expect(e, isNotNull, reason: 'element correctly created');
39 expect(e.target, t, reason: 'target not setted');
40 expect(e.current, isTrue, reason: 'default to not current');
41 });
42 });
43 });
44 test('elements created after attachment', () {
45 final VmConnectTargetElement e = new VmConnectTargetElement(t);
46 expect(e.children.length, isZero,
47 reason: 'is empty');
48 document.body.append(e);
49 expect(e.children.length, isNonZero,
50 reason: 'has elements');
51 e.remove();
52 });
53 group('events are fired', () {
54 VmConnectTargetElement e;
55 StreamSubscription sub;
56 setUp(() {
57 e = new VmConnectTargetElement(t);
58 document.body.append(e);
59 });
60 tearDown(() {
61 sub.cancel();
62 e.remove();
63 });
64 test('onConnect events (DOM)', () async {
65 sub = e.onConnect.listen(expectAsync((WebSocketVMTargetEvent event) {
66 expect(event, isNotNull, reason: 'event is passed');
67 expect(event.target, t, reason: 'target is the same');
68 }, count: 1, reason: 'event is fired'));
69 e.querySelector('a').click();
70 });
71 test('onConnect events (code)', () async {
72 sub = e.onConnect.listen(expectAsync((WebSocketVMTargetEvent event) {
73 expect(event, isNotNull, reason: 'event is passed');
74 expect(event.target, t, reason: 'target is the same');
75 }, count: 1, reason: 'event is fired'));
76 e.connect();
77 });
78 test('onRemove events (DOM)', () async {
79 sub = e.onDelete.listen(expectAsync((WebSocketVMTargetEvent event) {
80 expect(event, isNotNull, reason: 'event is passed');
81 expect(event.target, t, reason: 'target is the same');
82 }, count: 1, reason: 'event is fired'));
83 e.querySelector('button').click();
84 });
85 test('onRemove events (code)', () async {
86 sub = e.onDelete.listen(expectAsync((WebSocketVMTargetEvent event) {
87 expect(event, isNotNull, reason: 'event is passed');
88 expect(event.target, t, reason: 'target is the same');
89 }, count: 1, reason: 'event is fired'));
90 e.delete();
91 });
92 test('navigation after connect', () async {
93 sub = window.onPopState.listen(expectAsync((_) {}, count: 1,
94 reason: 'event is fired'));
95 e.querySelector('a').click();
96 });
97 });
98 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698