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

Side by Side Diff: runtime/observatory/tests/observatory_ui/nav/notify_event/element_test.dart

Issue 2167053002: Converted Observatory nav-notify element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fixed template ciclic references that were blocking initialization 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/mocks.dart';
8 import 'package:observatory/src/elements/nav/notify_event.dart';
9
10 main() {
11 NavNotifyEventElement.tag.ensureRegistration();
12
13 final PauseStartEventMock event = new PauseStartEventMock(
14 isolate: new IsolateMock(id: 'isolate-id', name: 'isolate-name'));
15 group('instantiation', () {
16 final NavNotifyEventElement e = new NavNotifyEventElement(event);
17 expect(e, isNotNull, reason: 'element correctly created');
18 expect(e.event, equals(event));
19 });
20 group('elements', () {
21 test('created after attachment', () async {
22 final NavNotifyEventElement e = new NavNotifyEventElement(event);
23 document.body.append(e);
24 await e.onRendered.first;
25 expect(e.children.length, isNonZero, reason: 'has elements');
26 e.remove();
27 await e.onRendered.first;
28 expect(e.children.length, isZero, reason: 'is empty');
29 });
30 });
31 group('events are fired', () {
32 NavNotifyEventElement e;
33 StreamSubscription sub;
34 setUp(() async {
35 e = new NavNotifyEventElement(event);
36 document.body.append(e);
37 await e.onRendered.first;
38 });
39 tearDown(() {
40 sub.cancel();
41 e.remove();
42 });
43 test('navigation after connect', () async {
44 sub = window.onPopState.listen(expectAsync((_) {}, count: 1,
45 reason: 'event is fired'));
46 e.querySelector('a').click();
47 });
48 test('onDelete events (DOM)', () async {
49 sub = e.onDelete.listen(expectAsync((EventDeleteEvent ev) {
50 expect(ev, isNotNull, reason: 'event is passed');
51 expect(ev.event, equals(event),
52 reason: 'exception is the same');
53 }, count: 1, reason: 'event is fired'));
54 e.querySelector('button').click();
55 });
56 test('onDelete events (code)', () async {
57 sub = e.onDelete.listen(expectAsync((EventDeleteEvent ev) {
58 expect(ev, isNotNull, reason: 'event is passed');
59 expect(ev.event, equals(event),
60 reason: 'exception is the same');
61 }, count: 1, reason: 'event is fired'));
62 e.delete();
63 });
64 });
65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698