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 'dart:async'; | 6 import 'dart:async'; |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 import 'package:observatory/src/elements/nav/notify_exception.dart'; | 8 import 'package:observatory/src/elements/nav/notify_exception.dart'; |
9 | 9 |
10 main() { | 10 main() { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 setUp(() async { | 57 setUp(() async { |
58 e = new NavNotifyExceptionElement(ex, stacktrace: st); | 58 e = new NavNotifyExceptionElement(ex, stacktrace: st); |
59 document.body.append(e); | 59 document.body.append(e); |
60 await e.onRendered.first; | 60 await e.onRendered.first; |
61 }); | 61 }); |
62 tearDown(() { | 62 tearDown(() { |
63 sub.cancel(); | 63 sub.cancel(); |
64 e.remove(); | 64 e.remove(); |
65 }); | 65 }); |
66 test('navigation after connect', () async { | 66 test('navigation after connect', () async { |
67 sub = window.onPopState.listen(expectAsync((_) {}, count: 1, | 67 sub = window.onPopState |
68 reason: 'event is fired')); | 68 .listen(expectAsync((_) {}, count: 1, reason: 'event is fired')); |
69 e.querySelector('a').click(); | 69 e.querySelector('a').click(); |
70 }); | 70 }); |
71 test('onDelete events (DOM)', () async { | 71 test('onDelete events (DOM)', () async { |
72 sub = e.onDelete.listen(expectAsync((ExceptionDeleteEvent event) { | 72 sub = e.onDelete.listen(expectAsync((ExceptionDeleteEvent event) { |
73 expect(event, isNotNull, reason: 'event is passed'); | 73 expect(event, isNotNull, reason: 'event is passed'); |
74 expect(event.exception, equals(ex), reason: 'exception is the same'); | 74 expect(event.exception, equals(ex), reason: 'exception is the same'); |
75 expect(event.stacktrace, equals(st), | 75 expect(event.stacktrace, equals(st), |
76 reason: 'stacktrace is the same'); | 76 reason: 'stacktrace is the same'); |
77 }, count: 1, reason: 'event is fired')); | 77 }, count: 1, reason: 'event is fired')); |
78 e.querySelector('button').click(); | 78 e.querySelector('button').click(); |
79 }); | 79 }); |
80 test('onDelete events (code)', () async { | 80 test('onDelete events (code)', () async { |
81 sub = e.onDelete.listen(expectAsync((ExceptionDeleteEvent event) { | 81 sub = e.onDelete.listen(expectAsync((ExceptionDeleteEvent event) { |
82 expect(event, isNotNull, reason: 'event is passed'); | 82 expect(event, isNotNull, reason: 'event is passed'); |
83 expect(event.exception, equals(ex), reason: 'exception is the same'); | 83 expect(event.exception, equals(ex), reason: 'exception is the same'); |
84 expect(event.stacktrace, equals(st), | 84 expect(event.stacktrace, equals(st), |
85 reason: 'stacktrace is the same'); | 85 reason: 'stacktrace is the same'); |
86 }, count: 1, reason: 'event is fired')); | 86 }, count: 1, reason: 'event is fired')); |
87 e.delete(); | 87 e.delete(); |
88 }); | 88 }); |
89 }); | 89 }); |
90 }); | 90 }); |
91 } | 91 } |
OLD | NEW |