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

Side by Side Diff: runtime/observatory/tests/observatory_ui/nav/notify_exception/connection_exception_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/models.dart';
8 import 'package:observatory/mocks.dart';
9 import 'package:observatory/src/elements/nav/notify_exception.dart';
10
11 main() {
12 NavNotifyExceptionElement.tag.ensureRegistration();
13
14 final ConnectionException exception =
15 new ConnectionExceptionMock(message: 'message');
16 test('instantiation', () {
17 final NavNotifyExceptionElement e =
18 new NavNotifyExceptionElement(exception);
19 expect(e, isNotNull, reason: 'element correctly created');
20 });
21 test('elements created after attachment', () async {
22 final NavNotifyExceptionElement e =
23 new NavNotifyExceptionElement(exception);
24 document.body.append(e);
25 await e.onRendered.first;
26 expect(e.children.length, isNonZero, reason: 'has elements');
27 e.remove();
28 await e.onRendered.first;
29 expect(e.children.length, isZero, reason: 'is empty');
30 });
31 group('events are fired', () {
32 NavNotifyExceptionElement e;
33 StreamSubscription sub;
34 setUp(() async {
35 e = new NavNotifyExceptionElement(exception);
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((ExceptionDeleteEvent event) {
50 expect(event, isNotNull, reason: 'event is passed');
51 expect(event.exception, equals(exception),
52 reason: 'exception is the same');
53 expect(event.stacktrace, isNull);
54 }, count: 1, reason: 'event is fired'));
55 e.querySelector('button').click();
56 });
57 test('onDelete events (code)', () async {
58 sub = e.onDelete.listen(expectAsync((ExceptionDeleteEvent event) {
59 expect(event, isNotNull, reason: 'event is passed');
60 expect(event.exception, equals(exception),
61 reason: 'exception is the same');
62 expect(event.stacktrace, isNull);
63 }, count: 1, reason: 'event is fired'));
64 e.delete();
65 });
66 });
67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698