chore: remove obsolete files (#10240)
This commit is contained in:
@ -1,4 +0,0 @@
|
||||
// This symbol is not used on the Dart side. This exists just as a stub.
|
||||
async(Function fn) {
|
||||
throw 'async() test wrapper not available for Dart.';
|
||||
}
|
@ -1,103 +0,0 @@
|
||||
library testing.fake_async;
|
||||
|
||||
import 'dart:async' show runZoned, ZoneSpecification;
|
||||
import 'package:quiver/testing/async.dart' as quiver;
|
||||
import 'package:angular2/src/facade/exceptions.dart' show BaseException;
|
||||
|
||||
const _u = const Object();
|
||||
|
||||
quiver.FakeAsync _fakeAsync = null;
|
||||
|
||||
/**
|
||||
* Wraps the [fn] to be executed in the fakeAsync zone:
|
||||
* - microtasks are manually executed by calling [flushMicrotasks],
|
||||
* - timers are synchronous, [tick] simulates the asynchronous passage of time.
|
||||
*
|
||||
* If there are any pending timers at the end of the function, an exception
|
||||
* will be thrown.
|
||||
*
|
||||
* Can be used to wrap inject() calls.
|
||||
*
|
||||
* Returns a `Function` that wraps [fn].
|
||||
*/
|
||||
Function fakeAsync(Function fn) {
|
||||
if (_fakeAsync != null) {
|
||||
throw 'fakeAsync() calls can not be nested';
|
||||
}
|
||||
|
||||
return ([a0 = _u,
|
||||
a1 = _u,
|
||||
a2 = _u,
|
||||
a3 = _u,
|
||||
a4 = _u,
|
||||
a5 = _u,
|
||||
a6 = _u,
|
||||
a7 = _u,
|
||||
a8 = _u,
|
||||
a9 = _u]) {
|
||||
// runZoned() to install a custom exception handler that re-throws
|
||||
return runZoned(() {
|
||||
return new quiver.FakeAsync().run((quiver.FakeAsync async) {
|
||||
try {
|
||||
_fakeAsync = async;
|
||||
List args = [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9]
|
||||
.takeWhile((a) => a != _u)
|
||||
.toList();
|
||||
var res = Function.apply(fn, args);
|
||||
_fakeAsync.flushMicrotasks();
|
||||
|
||||
if (async.periodicTimerCount > 0) {
|
||||
throw new BaseException('${async.periodicTimerCount} periodic '
|
||||
'timer(s) still in the queue.');
|
||||
}
|
||||
|
||||
if (async.nonPeriodicTimerCount > 0) {
|
||||
throw new BaseException('${async.nonPeriodicTimerCount} timer(s) '
|
||||
'still in the queue.');
|
||||
}
|
||||
|
||||
return res;
|
||||
} finally {
|
||||
_fakeAsync = null;
|
||||
}
|
||||
});
|
||||
},
|
||||
zoneSpecification: new ZoneSpecification(
|
||||
handleUncaughtError: (self, parent, zone, error, stackTrace) =>
|
||||
throw error));
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulates the asynchronous passage of [millis] milliseconds for the timers
|
||||
* in the fakeAsync zone.
|
||||
*
|
||||
* The microtasks queue is drained at the very start of this function and after
|
||||
* any timer callback has been executed.
|
||||
*/
|
||||
void tick([int millis = 0]) {
|
||||
_assertInFakeAsyncZone();
|
||||
var duration = new Duration(milliseconds: millis);
|
||||
_fakeAsync.elapse(duration);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is not needed in Dart. Because quiver correctly removes a timer when
|
||||
* it throws an exception.
|
||||
*/
|
||||
void clearPendingTimers() {}
|
||||
|
||||
/**
|
||||
* Flush any pending microtasks.
|
||||
*/
|
||||
void flushMicrotasks() {
|
||||
_assertInFakeAsyncZone();
|
||||
_fakeAsync.flushMicrotasks();
|
||||
}
|
||||
|
||||
void _assertInFakeAsyncZone() {
|
||||
if (_fakeAsync == null) {
|
||||
throw new BaseException('The code should be running in the fakeAsync zone '
|
||||
'to call this function');
|
||||
}
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
library testing.lang_utils;
|
||||
|
||||
import 'dart:mirrors';
|
||||
|
||||
Type getTypeOf(instance) => instance.runtimeType;
|
||||
|
||||
dynamic instantiateType(Type type, [List params = const []]) {
|
||||
var cm = reflectClass(type);
|
||||
return cm.newInstance(new Symbol(''), params).reflectee;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
library angular2.src.testing.testing;
|
||||
|
||||
// empty as this file is for external TS/js users and should not be transpiled to dart
|
@ -1,69 +0,0 @@
|
||||
library angular2.src.testing.testing_internal;
|
||||
|
||||
import 'testing_internal_core.dart' as core;
|
||||
export 'testing_internal_core.dart'
|
||||
hide
|
||||
beforeEachProviders,
|
||||
beforeEachBindings,
|
||||
beforeEach,
|
||||
it,
|
||||
iit,
|
||||
xit,
|
||||
testSetup,
|
||||
describe,
|
||||
ddescribe,
|
||||
xdescribe;
|
||||
|
||||
import 'package:angular2/platform/testing/browser.dart';
|
||||
import 'package:angular2/src/facade/collection.dart' show StringMapWrapper;
|
||||
import "package:angular2/src/core/zone/ng_zone.dart" show NgZone;
|
||||
|
||||
export 'test_injector.dart' show inject;
|
||||
|
||||
void testSetup() {
|
||||
core.setDartBaseTestProviders(TEST_BROWSER_PLATFORM_PROVIDERS, TEST_BROWSER_APPLICATION_PROVIDERS);
|
||||
}
|
||||
|
||||
void beforeEachProviders(Function fn) {
|
||||
testSetup();
|
||||
core.beforeEachProviders(fn);
|
||||
}
|
||||
|
||||
@Deprecated('using beforeEachProviders instead')
|
||||
void beforeEachBindings(Function fn) {
|
||||
beforeEachProviders(fn);
|
||||
}
|
||||
|
||||
void beforeEach(fn) {
|
||||
testSetup();
|
||||
core.beforeEach(fn);
|
||||
}
|
||||
|
||||
void it(name, fn, [timeOut = null]) {
|
||||
core.it(name, fn, timeOut);
|
||||
}
|
||||
|
||||
void iit(name, fn, [timeOut = null]) {
|
||||
core.iit(name, fn, timeOut);
|
||||
}
|
||||
|
||||
void xit(name, fn, [timeOut = null]) {
|
||||
core.xit(name, fn, timeOut);
|
||||
}
|
||||
|
||||
void describe(name, fn) {
|
||||
testSetup();
|
||||
core.describe(name, fn);
|
||||
}
|
||||
|
||||
void ddescribe(name, fn) {
|
||||
testSetup();
|
||||
core.ddescribe(name, fn);
|
||||
}
|
||||
|
||||
void xdescribe(name, fn) {
|
||||
testSetup();
|
||||
core.xdescribe(name, fn);
|
||||
}
|
||||
|
||||
bool isInInnerZone() => NgZone.isInAngularZone();
|
Reference in New Issue
Block a user