chore: remove obsolete files (#10240)

This commit is contained in:
Victor Berchet
2016-07-22 16:18:31 -07:00
committed by GitHub
parent e34eb4520f
commit b652a7fc9f
166 changed files with 1 additions and 12836 deletions
-1
View File
@@ -1 +0,0 @@
export 'index.dart';
@@ -1,63 +0,0 @@
library angular2.directives.observable_list_iterable_diff;
import 'package:observe/observe.dart' show ObservableList;
import 'package:angular2/core.dart';
import 'package:angular2/src/core/change_detection/differs/default_iterable_differ.dart';
import 'dart:async';
class ObservableListDiff extends DefaultIterableDiffer {
ChangeDetectorRef _ref;
ObservableListDiff(this._ref);
bool _updated = true;
ObservableList _collection;
StreamSubscription _subscription;
onDestroy() {
if (this._subscription != null) {
this._subscription.cancel();
this._subscription = null;
this._collection = null;
}
}
DefaultIterableDiffer diff(ObservableList collection) {
if (collection is! ObservableList) {
throw "Cannot change the type of a collection";
}
// A new collection instance is passed in.
// - We need to set up a listener.
// - We need to diff collection.
if (!identical(_collection, collection)) {
_collection = collection;
if (_subscription != null) _subscription.cancel();
_subscription = collection.changes.listen((_) {
_updated = true;
_ref.markForCheck();
});
_updated = false;
return super.diff(collection);
// An update has been registered since the last change detection check.
// - We reset the flag.
// - We diff the collection.
} else if (_updated) {
_updated = false;
return super.diff(collection);
// No updates has been registered.
} else {
return null;
}
}
}
class ObservableListDiffFactory implements IterableDifferFactory {
const ObservableListDiffFactory();
bool supports(obj) => obj is ObservableList;
IterableDiffer create(ChangeDetectorRef cdRef, [Function trackByFn]) {
return new ObservableListDiff(cdRef);
}
}
@@ -1,20 +0,0 @@
library angular2.core.forms.normalize_validators;
import 'package:angular2/src/common/forms/directives/validators.dart' show Validator;
Function normalizeValidator(dynamic validator){
if (validator is Validator) {
return (c) => validator.validate(c);
} else {
return validator;
}
}
Function normalizeAsyncValidator(dynamic validator){
if (validator is Validator) {
return (c) => validator.validate(c);
} else {
return validator;
}
}
@@ -51,9 +51,6 @@ var defaultLocale: string = 'en-US';
*
* In javascript, only the components specified will be respected (not the ordering,
* punctuations, ...) and details of the formatting will be dependent on the locale.
* On the other hand in Dart version, you can also include quoted text as well as some extra
* date/time components such as quarter. For more information see:
* https://www.dartdocs.org/documentation/intl/0.13.0/intl/DateFormat-class.html
*
* `format` can also be one of the following predefined formats:
*
@@ -1,102 +0,0 @@
library angular2.test.directives.observable_list_iterable_diff_spec;
import 'package:angular2/testing_internal.dart';
import 'package:observe/observe.dart' show ObservableList;
import 'package:angular2/core.dart' show ChangeDetectorRef;
import 'package:angular2/common.dart' show ObservableListDiffFactory;
@proxy
class SpyChangeDetectorRef extends SpyObject implements ChangeDetectorRef {}
main() {
describe('ObservableListDiff', () {
var factory, changeDetectorRef;
beforeEach(() {
factory = const ObservableListDiffFactory();
changeDetectorRef = new SpyChangeDetectorRef();
});
describe("supports", () {
it("should be true for ObservableList", () {
expect(factory.supports(new ObservableList())).toBe(true);
});
it("should be false otherwise", () {
expect(factory.supports([1, 2, 3])).toBe(false);
});
});
it("should return itself when called the first time", () {
final d = factory.create(changeDetectorRef);
final c = new ObservableList.from([1, 2]);
expect(d.diff(c)).toBe(d);
});
it("should return itself when no changes between the calls", () {
final d = factory.create(changeDetectorRef);
final c = new ObservableList.from([1, 2]);
d.diff(c);
expect(d.diff(c)).toBe(null);
});
it("should return the wrapped value once a change has been triggered",
fakeAsync(() {
final d = factory.create(changeDetectorRef);
final c = new ObservableList.from([1, 2]);
d.diff(c);
c.add(3);
// same value, because we have not detected the change yet
expect(d.diff(c)).toBe(null);
// now we detect the change
flushMicrotasks();
expect(d.diff(c)).toBe(d);
}));
it("should request a change detection check upon receiving a change",
fakeAsync(() {
final d = factory.create(changeDetectorRef);
final c = new ObservableList.from([1, 2]);
d.diff(c);
c.add(3);
flushMicrotasks();
expect(changeDetectorRef.spy("markForCheck")).toHaveBeenCalledOnce();
}));
it("should return the wrapped value after changing a collection", () {
final d = factory.create(changeDetectorRef);
final c1 = new ObservableList.from([1, 2]);
final c2 = new ObservableList.from([3, 4]);
expect(d.diff(c1)).toBe(d);
expect(d.diff(c2)).toBe(d);
});
it("should not unbsubscribe from the stream of chagnes after changing a collection",
() {
final d = factory.create(changeDetectorRef);
final c1 = new ObservableList.from([1, 2]);
expect(d.diff(c1)).toBe(d);
final c2 = new ObservableList.from([3, 4]);
expect(d.diff(c2)).toBe(d);
// pushing into the first collection has no effect, and we do not see the change
c1.add(3);
expect(d.diff(c2)).toBe(null);
});
});
}
-14
View File
@@ -1,14 +0,0 @@
library core.spies;
import 'package:angular2/common.dart';
import 'package:angular2/src/core/change_detection/change_detection.dart';
import 'package:angular2/testing_internal.dart';
@proxy
class SpyNgControl extends SpyObject implements NgControl {}
@proxy
class SpyValueAccessor extends SpyObject implements ControlValueAccessor {}
@proxy
class SpyChangeDetectorRef extends SpyObject implements ChangeDetectorRef {}