| Index: tests/lib_strong/html/html_mock_test.dart
|
| diff --git a/tests/lib_strong/html/html_mock_test.dart b/tests/lib_strong/html/html_mock_test.dart
|
| index 9b6daf88982a6992432240cb1632876f9a6ceb9f..bdf88600e4cf9b80978e022bba80a78b63da8649 100644
|
| --- a/tests/lib_strong/html/html_mock_test.dart
|
| +++ b/tests/lib_strong/html/html_mock_test.dart
|
| @@ -2,6 +2,7 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| +import 'dart:async';
|
| import 'dart:html';
|
|
|
| import 'package:expect/minitest.dart';
|
| @@ -11,7 +12,26 @@ class Mock {
|
| }
|
|
|
| @proxy
|
| -class MockWindow extends Mock implements Window {}
|
| +class MockBodyElement extends Mock implements BodyElement {
|
| + Node append(Node e) => e;
|
| +}
|
| +
|
| +@proxy
|
| +class MockHtmlDocument extends Mock implements HtmlDocument {
|
| + BodyElement get body => new MockBodyElement();
|
| +}
|
| +
|
| +@proxy
|
| +class MockWindow extends Mock implements Window {
|
| + Stream<Event> get onBeforeUnload => new Stream.fromIterable([]);
|
| +
|
| + String name = "MOCK_NAME";
|
| +}
|
| +
|
| +@proxy
|
| +class MockLocation extends Mock implements Location {
|
| + String href = "MOCK_HREF";
|
| +}
|
|
|
| main() {
|
| test('is', () {
|
| @@ -23,4 +43,26 @@ main() {
|
| var win = new MockWindow();
|
| expect(win.document, equals(document));
|
| });
|
| +
|
| + test('override', () {
|
| + Window win = new MockWindow();
|
| + expect(win.onBeforeUnload != null, isTrue);
|
| + expect(win.name, equals("MOCK_NAME"));
|
| + });
|
| +
|
| + test('override', () {
|
| + var loc1 = new MockLocation();
|
| + Location loc2 = loc1;
|
| + dynamic loc3 = loc1;
|
| + expect(loc1.href, equals("MOCK_HREF"));
|
| + loc1.href = "RESET";
|
| + expect(loc2.href, equals("RESET"));
|
| + loc2.href = "RESET2";
|
| + expect(loc3.href, equals("RESET2"));
|
| + });
|
| +
|
| + test('method', () {
|
| + HtmlDocument doc = new MockHtmlDocument();
|
| + expect(doc.body.append(null), equals(null));
|
| + });
|
| }
|
|
|