Index: runtime/observatory/tests/observatory_ui/source_link/element_test.dart |
diff --git a/runtime/observatory/tests/observatory_ui/source_link/element_test.dart b/runtime/observatory/tests/observatory_ui/source_link/element_test.dart |
index 5d36fd140edf1eee68f625692d5764c4099c375a..3dcb5ddaa052b44c20cd11c1674ca8aee1cd53fb 100644 |
--- a/runtime/observatory/tests/observatory_ui/source_link/element_test.dart |
+++ b/runtime/observatory/tests/observatory_ui/source_link/element_test.dart |
@@ -3,7 +3,6 @@ |
// BSD-style license that can be found in the LICENSE file. |
import 'dart:html'; |
import 'package:unittest/unittest.dart'; |
-import 'package:observatory/models.dart' as M; |
import 'package:observatory/src/elements/source_link.dart'; |
import '../mocks.dart'; |
@@ -11,25 +10,30 @@ main() { |
SourceLinkElement.tag.ensureRegistration(); |
const isolate = const IsolateRefMock(id: 'isolate-id'); |
+ const script_id = 'script-id'; |
const file = 'filename.dart'; |
- final script = new ScriptMock(id: 'script-id', uri: 'package/$file', |
+ final script = new ScriptMock(id: script_id, uri: 'package/$file', |
tokenToLine: (int token) => 1, tokenToCol: (int token) => 2); |
final location = new SourceLocationMock(script: script, tokenPos: 0, |
endTokenPos: 1); |
- M.ScriptRepository repository; |
- setUp(() { |
- repository = new ScriptRepositoryMock({ 'script-id': script }); |
- }); |
test('instantiation', () { |
- final e = new SourceLinkElement(isolate, location, repository); |
+ final e = new SourceLinkElement(isolate, location, |
+ new ScriptRepositoryMock()); |
expect(e, isNotNull, reason: 'element correctly created'); |
expect(e.isolate, equals(isolate)); |
expect(e.location, equals(location)); |
}); |
test('elements created after attachment', () async { |
- final e = new SourceLinkElement(isolate, location, repository); |
+ bool rendered = false; |
+ final e = new SourceLinkElement(isolate, location, |
+ new ScriptRepositoryMock(getter: expectAsync((String id) async { |
+ expect(rendered, isFalse); |
+ expect(id, equals(script_id)); |
+ return script; |
+ }, count: 1))); |
document.body.append(e); |
await e.onRendered.first; |
+ rendered = true; |
expect(e.children.length, isNonZero, reason: 'has elements'); |
expect(e.innerHtml.contains(isolate.id), isTrue, |
reason: 'no message in the component'); |