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

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

Issue 2119733003: Wrapping leaf nodes in non polymer elements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fixed CSS leak on firefox 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) 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 import 'dart:html';
5 import 'dart:async';
6 import 'package:unittest/unittest.dart';
7 import 'package:observatory/repositories.dart';
8 import 'package:observatory/src/elements/isolate_ref.dart';
9
10 main() {
11 StreamController<IsolateUpdateEvent> updatesController;
12 final IsolateRefMock ref = new IsolateRefMock(id: 'id', name: 'old-name');
13 final IsolateMock obj = new IsolateMock(id: 'id', name: 'new-name');
14 setUp(() {
15 IsolateRefElement.tag.ensureRegistration();
16 updatesController = new StreamController<IsolateUpdateEvent>();
17 });
18 group('instantiation', () {
19 test('IsolateRef', () {
20 final IsolateRefElement e = new IsolateRefElement(ref,
21 updatesController.stream);
22 expect(e, isNotNull, reason: 'element correctly created');
23 expect(e.isolate, equals(ref));
24 });
25 test('Isolate', () {
26 final IsolateRefElement e = new IsolateRefElement(obj,
27 updatesController.stream);
28 expect(e, isNotNull, reason: 'element correctly created');
29 expect(e.isolate, equals(obj));
30 });
31 });
32 group('elements', () {
33 test('created after attachment', () {
34 final IsolateRefElement e = new IsolateRefElement(ref,
35 updatesController.stream);
36 expect(e.shadowRoot, isNotNull, reason: 'shadowRoot is created');
37 expect(e.shadowRoot.children.length, isZero,
38 reason: 'shadowRoot is empty');
39 document.body.append(e);
40 expect(e.shadowRoot.children.length, isNonZero,
41 reason: 'shadowRoot has elements');
42 e.remove();
43 });
44 });
45 group('updates', () {
46 test('are correctly listen', () {
47 final IsolateRefElement e = new IsolateRefElement(ref,
48 updatesController.stream);
49 expect(updatesController.hasListener, isFalse);
50 document.body.append(e);
51 expect(updatesController.hasListener, isTrue);
52 e.remove();
53 expect(updatesController.hasListener, isFalse);
54 });
55 test('have effects', () async {
56 final IsolateRefElement e = new IsolateRefElement(ref,
57 updatesController.stream);
58 document.body.append(e);
59 expect(e.shadowRoot.innerHtml.contains(ref.id), isTrue);
60 Future check() async {
61 expect(e.shadowRoot.innerHtml.contains(ref.name), isFalse);
62 expect(e.shadowRoot.innerHtml.contains(obj.name), isTrue);
63 };
64 updatesController.add(new IsolateUpdateEvent(obj));
65 await check();
66 e.remove();
67 });
68 });
69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698