angular/modules/change_detection/test/change_detection_spec.js
Tobias Bosch 33af1d0b39 chore(build): execute pub get only if a pubspec.yaml changed and run dart analyzer on all dart files
`pub get` is now only executed when the `pubspec.yaml` in the `modules`
folder is different than the `pubspec.yaml` in the `build/dart` folder.

Generates the file `build/dart/_analyzer.dart` that imports all modules
to run `dart analyzer` against all of them. The build will fail whenever
there are errors, warnings or hints in `dart analyzer`.

Changes the sources so that `dart analyzer` does not report any
error, warning or hint.

Closes #40
2014-10-02 16:10:08 -07:00

46 lines
1.2 KiB
JavaScript

import {describe, it, xit, expect} from 'test_lib/test_lib';
import {ProtoWatchGroup, WatchGroup, WatchGroupDispatcher, ChangeDetection} from 'change_detection/change_detection';
export function main() {
describe('change_detection', function() {
describe('ChangeDetection', function() {
xit('should do simple watching', function() {
var person = new Person('misko', 38);
var pwg = new ProtoWatchGroup();
pwg.watch('name', 'nameToken');
pwg.watch('age', 'ageToken');
var dispatcher = new LoggingDispatcher();
var wg = pwg.instantiate(dispatcher);
wg.setContext(person);
var cd = new ChangeDetection(wg);
cd.detectChanges();
expect(dispatcher.log).toEqual(['ageToken=38']);
dispatcher.clear();
cd.detectChanges();
expect(dispatcher.log).toEqual([]);
person.age=1;
person.name="Misko";
cd.detectChanges();
expect(dispatcher.log).toEqual(['nameToken=Misko', 'ageToken=1']);
});
});
});
}
class Person {
constructor(name:string, age:number) {
this.name = name;
this.age = age;
}
}
class LoggingDispatcher extends WatchGroupDispatcher {
constructor() {
this.log = null;
}
clear() {
}
}