| Index: runtime/observatory/tests/observatory_ui/vm_connect/element_test.dart
|
| diff --git a/runtime/observatory/tests/observatory_ui/vm_connect/element_test.dart b/runtime/observatory/tests/observatory_ui/vm_connect/element_test.dart
|
| index 15a853ca76cd904823d178af8f556e56de5cde10..270e0d54213a68e5d3385ff9e9aa300557b8e034 100644
|
| --- a/runtime/observatory/tests/observatory_ui/vm_connect/element_test.dart
|
| +++ b/runtime/observatory/tests/observatory_ui/vm_connect/element_test.dart
|
| @@ -3,31 +3,30 @@
|
| // BSD-style license that can be found in the LICENSE file.
|
| import 'dart:html';
|
| import 'package:unittest/unittest.dart';
|
| -import 'package:observatory/mocks.dart';
|
| -import 'package:observatory/models.dart' as M;
|
| import 'package:observatory/src/elements/nav/notify.dart';
|
| import 'package:observatory/src/elements/vm_connect_target.dart';
|
| import 'package:observatory/src/elements/vm_connect.dart';
|
| +import '../mocks.dart';
|
| +
|
| +void load(_) {}
|
|
|
| main() {
|
| VMConnectElement.tag.ensureRegistration();
|
|
|
| - final String nTag = NavNotifyElement.tag.name;
|
| - final String tTag = VMConnectTargetElement.tag.name;
|
| + final nTag = NavNotifyElement.tag.name;
|
| + final tTag = VMConnectTargetElement.tag.name;
|
|
|
| group('instantiation', () {
|
| test('default', () {
|
| - final VMConnectElement e = new VMConnectElement(
|
| - new TargetRepositoryMock(),
|
| - new CrashDumpRepositoryMock(),
|
| - new NotificationRepositoryMock());
|
| + final e = new VMConnectElement(new TargetRepositoryMock(),
|
| + load, new NotificationRepositoryMock());
|
| expect(e, isNotNull, reason: 'element correctly created');
|
| });
|
| });
|
| test('is correctly listening', () async {
|
| final targets = new TargetRepositoryMock();
|
| - final VMConnectElement e = new VMConnectElement(targets,
|
| - new CrashDumpRepositoryMock(), new NotificationRepositoryMock());
|
| + final e = new VMConnectElement(targets, load,
|
| + new NotificationRepositoryMock());
|
| document.body.append(e);
|
| await e.onRendered.first;
|
| expect(targets.hasListeners, isTrue, reason: 'is listening');
|
| @@ -40,8 +39,8 @@ main() {
|
| final targets = new TargetRepositoryMock(list: const [
|
| const TargetMock(name: 't-1'), const TargetMock(name: 't-2'),
|
| ]);
|
| - final VMConnectElement e = new VMConnectElement(targets,
|
| - new CrashDumpRepositoryMock(), new NotificationRepositoryMock());
|
| + final e = new VMConnectElement(targets, load,
|
| + new NotificationRepositoryMock());
|
| document.body.append(e);
|
| await e.onRendered.first;
|
| expect(targets.listInvoked, isTrue, reason: 'should invoke list()');
|
| @@ -54,10 +53,10 @@ main() {
|
| expect(e.children.length, isZero, reason: 'is empty');
|
| });
|
| test('react to update event', () async {
|
| - final list = <M.Target>[const TargetMock(name: 't-1')];
|
| + final list = <TargetMock>[const TargetMock(name: 't-1')];
|
| final targets = new TargetRepositoryMock(list: list);
|
| - final VMConnectElement e = new VMConnectElement(targets,
|
| - new CrashDumpRepositoryMock(), new NotificationRepositoryMock());
|
| + final e = new VMConnectElement(targets, load,
|
| + new NotificationRepositoryMock());
|
| document.body.append(e);
|
| await e.onRendered.first;
|
| expect(e.querySelectorAll(tTag).length, equals(1));
|
| @@ -73,14 +72,13 @@ main() {
|
| group('invokes', () {
|
| test('add on click', () async {
|
| final address = 'ws://host:1234';
|
| - final list = <M.Target>[const TargetMock(name: 't-1')];
|
| + final list = <TargetMock>[const TargetMock(name: 't-1')];
|
| final targets = new TargetRepositoryMock(list: list,
|
| add: expectAsync((String val) {
|
| expect(val, equals(address));
|
| }, count: 1, reason: 'should be invoked'));
|
| - final VMConnectElement e = new VMConnectElement(targets,
|
| - new CrashDumpRepositoryMock(), new NotificationRepositoryMock(),
|
| - address: address);
|
| + final e = new VMConnectElement(targets, load,
|
| + new NotificationRepositoryMock(), address: address);
|
| document.body.append(e);
|
| await e.onRendered.first;
|
| (e.querySelector('button.vm_connect') as ButtonElement).click();
|
| @@ -88,13 +86,13 @@ main() {
|
| await e.onRendered.first;
|
| });
|
| test('connect', () async {
|
| - final list = <M.Target>[const TargetMock(name: 't-1')];
|
| + final list = <TargetMock>[const TargetMock(name: 't-1')];
|
| final targets = new TargetRepositoryMock(list: list,
|
| - setCurrent: expectAsync((M.Target t) {
|
| + setCurrent: expectAsync((TargetMock t) {
|
| expect(t, equals(list[0]));
|
| }, count: 1, reason: 'should be invoked'));
|
| - final VMConnectElement e = new VMConnectElement(targets,
|
| - new CrashDumpRepositoryMock(), new NotificationRepositoryMock());
|
| + final e = new VMConnectElement(targets, load,
|
| + new NotificationRepositoryMock());
|
| document.body.append(e);
|
| await e.onRendered.first;
|
| (e.querySelector(tTag) as VMConnectTargetElement).connect();
|
| @@ -102,13 +100,13 @@ main() {
|
| await e.onRendered.first;
|
| });
|
| test('delete', () async {
|
| - final list = <M.Target>[const TargetMock(name: 't-1')];
|
| + final list = <TargetMock>[const TargetMock(name: 't-1')];
|
| final targets = new TargetRepositoryMock(list: list,
|
| - delete: expectAsync((M.Target t) {
|
| + delete: expectAsync((TargetMock t) {
|
| expect(t, equals(list[0]));
|
| }, count: 1, reason: 'should be invoked'));
|
| - final VMConnectElement e = new VMConnectElement(targets,
|
| - new CrashDumpRepositoryMock(), new NotificationRepositoryMock());
|
| + final e = new VMConnectElement(targets, load,
|
| + new NotificationRepositoryMock());
|
| document.body.append(e);
|
| await e.onRendered.first;
|
| (e.querySelector(tTag) as VMConnectTargetElement).delete();
|
|
|