bc75856e54
expose ServiceWorker, removed query and queryAll from in dart:html, added constructor to MessageChannel and removed getCssCanvasContext. Fixed all tests using query and queryAll. Fixes https://github.com/dart-lang/sdk/issues/25664 Fixes https://github.com/dart-lang/sdk/issues/26349 Fixes https://github.com/dart-lang/sdk/issues/32323 Fixes https://github.com/dart-lang/sdk/issues/32659 Fixes https://github.com/dart-lang/sdk/issues/32675 R=kevmoo@google.com Change-Id: I687471e80b8fe9c7040673113f424dbaab7c64d4 Reviewed-on: https://dart-review.googlesource.com/48381 Commit-Queue: Terry Lucas <terry@google.com> Reviewed-by: Kevin Moore <kevmoo@google.com>
38 lines
1.0 KiB
Dart
38 lines
1.0 KiB
Dart
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
// 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
|
|
|
|
library UnknownElementTest;
|
|
|
|
import 'package:unittest/unittest.dart';
|
|
import 'package:unittest/html_config.dart';
|
|
import 'dart:html';
|
|
|
|
main() {
|
|
useHtmlConfiguration();
|
|
|
|
var isUnknownElement =
|
|
predicate((x) => x is UnknownElement, 'is an UnknownELement');
|
|
|
|
var foo = new Element.tag('foo');
|
|
foo.id = 'foo';
|
|
var bar = new Element.tag('bar');
|
|
bar.id = 'bar';
|
|
document.body.nodes.addAll([foo, bar]);
|
|
|
|
test('type-check', () {
|
|
expect(foo, isUnknownElement);
|
|
expect(bar, isUnknownElement);
|
|
expect(querySelector('#foo'), equals(foo));
|
|
expect(querySelector('#bar'), equals(bar));
|
|
});
|
|
|
|
test('dispatch-fail', () {
|
|
expect(() => foo.method1(), throwsNoSuchMethodError);
|
|
expect(() => foo.field1, throwsNoSuchMethodError);
|
|
expect(() {
|
|
foo.field1 = 42;
|
|
}, throwsNoSuchMethodError);
|
|
});
|
|
}
|