a80b71fc15
- "util.dart" is completely unused, so deleted. - We had two copies of "utils.dart" in two directories. It needs to exist in both places, but doesn't need to be copy/pasted. Replaced one with an export of the other. - Fixed bad import paths to "../utils.dart" in html/custom/ tests. These were causing those tests to crash DDC. (Now most are instead failing because of #31577, so it's not a *huge* improvement, but it's a step in the right direction.) - Don't use unittest in utils.dart. Change-Id: I28c432b53c992a5ec790f5804453cddb0f44cbe5 Reviewed-on: https://dart-review.googlesource.com/27301 Reviewed-by: Vijay Menon <vsm@google.com> Commit-Queue: Bob Nystrom <rnystrom@google.com>
61 lines
1.5 KiB
Dart
61 lines
1.5 KiB
Dart
// Copyright (c) 2014, 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.
|
|
|
|
import 'dart:async';
|
|
import 'dart:html';
|
|
import 'dart:js' as js;
|
|
|
|
import 'package:unittest/html_individual_config.dart';
|
|
import 'package:unittest/unittest.dart';
|
|
|
|
import 'utils.dart';
|
|
|
|
class FooElement extends HtmlElement {
|
|
static final tag = 'x-foo';
|
|
|
|
final int initializedField = 666;
|
|
js.JsObject _proxy;
|
|
|
|
factory FooElement() => new Element.tag(tag);
|
|
FooElement.created() : super.created() {
|
|
_proxy = new js.JsObject.fromBrowserObject(this);
|
|
}
|
|
|
|
String doSomething() => _proxy.callMethod('doSomething');
|
|
|
|
bool get fooCreated => _proxy['fooCreated'];
|
|
}
|
|
|
|
main() {
|
|
var registered = false;
|
|
var upgrader;
|
|
setUp(() => customElementsReady.then((_) {
|
|
if (!registered) {
|
|
registered = true;
|
|
upgrader = document.createElementUpgrader(FooElement);
|
|
js.context['upgradeListener'] = (e) {
|
|
upgrader.upgrade(e);
|
|
};
|
|
}
|
|
}));
|
|
|
|
|
|
test('cannot create upgrader for interfaces', () {
|
|
expect(() {
|
|
document.createElementUpgrader(HtmlElementInterface); /*@compile-error=unspecified*/
|
|
}, throws);
|
|
});
|
|
|
|
test('cannot upgrade interfaces', () {
|
|
expect(() {
|
|
upgrader.upgrade(new HtmlElementInterface());
|
|
}, throws);
|
|
});
|
|
}
|
|
|
|
class HtmlElementInterface implements HtmlElement { /*@compile-error=unspecified*/
|
|
HtmlElementInterface.created();
|
|
}
|
|
|