parent
4ba4427510
commit
557d309377
|
@ -208,8 +208,8 @@ function commonTests() {
|
||||||
macroTask(() => {
|
macroTask(() => {
|
||||||
expect(_log.result()).toEqual('run; onTurnDone; onEventDone');
|
expect(_log.result()).toEqual('run; onTurnDone; onEventDone');
|
||||||
async.done();
|
async.done();
|
||||||
}, 80);
|
}, 150);
|
||||||
}));
|
}), 200);
|
||||||
|
|
||||||
it('should run async tasks scheduled inside onEventDone outside Angular zone',
|
it('should run async tasks scheduled inside onEventDone outside Angular zone',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -230,7 +230,7 @@ function commonTests() {
|
||||||
TimerWrapper.setTimeout(() => {
|
TimerWrapper.setTimeout(() => {
|
||||||
expect(_log.result()).toEqual('run; onTurnDone; onEventDone; asyncTask');
|
expect(_log.result()).toEqual('run; onTurnDone; onEventDone; asyncTask');
|
||||||
async.done();
|
async.done();
|
||||||
}, 10);
|
}, 20);
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -402,8 +402,8 @@ function commonTests() {
|
||||||
// Second VM Turn => microtask enqueued from onTurnDone
|
// Second VM Turn => microtask enqueued from onTurnDone
|
||||||
'onTurnStart; executedMicrotask; onTurnDone(begin); onTurnDone(end)');
|
'onTurnStart; executedMicrotask; onTurnDone(begin); onTurnDone(end)');
|
||||||
async.done();
|
async.done();
|
||||||
}, 80);
|
}, 150);
|
||||||
}));
|
}), 200);
|
||||||
|
|
||||||
it('should call onTurnStart and onTurnDone for a scheduleMicrotask in onTurnDone triggered by ' +
|
it('should call onTurnStart and onTurnDone for a scheduleMicrotask in onTurnDone triggered by ' +
|
||||||
'a scheduleMicrotask in run',
|
'a scheduleMicrotask in run',
|
||||||
|
@ -437,8 +437,8 @@ function commonTests() {
|
||||||
// Second VM Turn => the microtask enqueued from onTurnDone
|
// Second VM Turn => the microtask enqueued from onTurnDone
|
||||||
'onTurnStart; onTurnDone(executeMicrotask); onTurnDone(begin); onTurnDone(end)');
|
'onTurnStart; onTurnDone(executeMicrotask); onTurnDone(begin); onTurnDone(end)');
|
||||||
async.done();
|
async.done();
|
||||||
}, 80);
|
}, 150);
|
||||||
}));
|
}), 200);
|
||||||
|
|
||||||
it('should execute promises scheduled in onTurnStart before promises scheduled in run',
|
it('should execute promises scheduled in onTurnStart before promises scheduled in run',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -492,8 +492,8 @@ function commonTests() {
|
||||||
// Second VM turn: execute the microtask from onTurnEnd
|
// Second VM turn: execute the microtask from onTurnEnd
|
||||||
'onTurnStart(begin); onTurnStart(end); onTurnDone(executePromise); onTurnDone(begin); onTurnDone(end)');
|
'onTurnStart(begin); onTurnStart(end); onTurnDone(executePromise); onTurnDone(begin); onTurnDone(end)');
|
||||||
async.done();
|
async.done();
|
||||||
}, 80);
|
}, 150);
|
||||||
}));
|
}), 200);
|
||||||
|
|
||||||
it('should call onTurnStart and onTurnDone before and after each turn, respectively',
|
it('should call onTurnStart and onTurnDone before and after each turn, respectively',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -513,7 +513,7 @@ function commonTests() {
|
||||||
macroTask(() => { _zone.run(() => { completerA.resolve(null); }); }, 20);
|
macroTask(() => { _zone.run(() => { completerA.resolve(null); }); }, 20);
|
||||||
|
|
||||||
|
|
||||||
macroTask(() => { _zone.run(() => { completerB.resolve(null); }); }, 100);
|
macroTask(() => { _zone.run(() => { completerB.resolve(null); }); }, 120);
|
||||||
|
|
||||||
macroTask(() => {
|
macroTask(() => {
|
||||||
expect(_log.result())
|
expect(_log.result())
|
||||||
|
@ -545,8 +545,8 @@ function commonTests() {
|
||||||
expect(_log.result())
|
expect(_log.result())
|
||||||
.toEqual('onTurnStart; run start; run end; async1; async2; onTurnDone');
|
.toEqual('onTurnStart; run start; run end; async1; async2; onTurnDone');
|
||||||
async.done();
|
async.done();
|
||||||
}, 80);
|
}, 150);
|
||||||
}));
|
}), 200);
|
||||||
|
|
||||||
it('should call onTurnStart and onTurnDone for promises created outside of run body',
|
it('should call onTurnStart and onTurnDone for promises created outside of run body',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -567,8 +567,8 @@ function commonTests() {
|
||||||
expect(_log.result())
|
expect(_log.result())
|
||||||
.toEqual('onTurnStart; zone run; onTurnDone; onTurnStart; promise then; onTurnDone');
|
.toEqual('onTurnStart; zone run; onTurnDone; onTurnStart; promise then; onTurnDone');
|
||||||
async.done();
|
async.done();
|
||||||
}, 80);
|
}, 150);
|
||||||
}));
|
}), 200);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('exceptions', () => {
|
describe('exceptions', () => {
|
||||||
|
|
|
@ -100,7 +100,7 @@ export function main() {
|
||||||
expect(log).toEqual(['activate: null -> /on-activate']);
|
expect(log).toEqual(['activate: null -> /on-activate']);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 2000);
|
||||||
|
|
||||||
it('should wait for a parent component\'s onActivate hook to resolve before calling its child\'s',
|
it('should wait for a parent component\'s onActivate hook to resolve before calling its child\'s',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -123,7 +123,7 @@ export function main() {
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}));
|
}), 2000);
|
||||||
|
|
||||||
it('should call the onDeactivate hook', inject([AsyncTestCompleter], (async) => {
|
it('should call the onDeactivate hook', inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
|
@ -136,7 +136,7 @@ export function main() {
|
||||||
expect(log).toEqual(['deactivate: /on-deactivate -> /a']);
|
expect(log).toEqual(['deactivate: /on-deactivate -> /a']);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 2000);
|
||||||
|
|
||||||
it('should wait for a child component\'s onDeactivate hook to resolve before calling its parent\'s',
|
it('should wait for a child component\'s onDeactivate hook to resolve before calling its parent\'s',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -161,7 +161,7 @@ export function main() {
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}));
|
}), 2000);
|
||||||
|
|
||||||
it('should reuse a component when the canReuse hook returns true',
|
it('should reuse a component when the canReuse hook returns true',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -182,7 +182,7 @@ export function main() {
|
||||||
expect(cmpInstanceCount).toBe(1);
|
expect(cmpInstanceCount).toBe(1);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 2000);
|
||||||
|
|
||||||
|
|
||||||
it('should not reuse a component when the canReuse hook returns false',
|
it('should not reuse a component when the canReuse hook returns false',
|
||||||
|
@ -204,7 +204,7 @@ export function main() {
|
||||||
expect(cmpInstanceCount).toBe(2);
|
expect(cmpInstanceCount).toBe(2);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 2000);
|
||||||
|
|
||||||
|
|
||||||
it('should navigate when canActivate returns true', inject([AsyncTestCompleter], (async) => {
|
it('should navigate when canActivate returns true', inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -224,7 +224,7 @@ export function main() {
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}));
|
}), 2000);
|
||||||
|
|
||||||
it('should not navigate when canActivate returns false',
|
it('should not navigate when canActivate returns false',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -244,7 +244,7 @@ export function main() {
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}));
|
}), 2000);
|
||||||
|
|
||||||
it('should navigate away when canDeactivate returns true',
|
it('should navigate away when canDeactivate returns true',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -269,7 +269,7 @@ export function main() {
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}));
|
}), 2000);
|
||||||
|
|
||||||
it('should not navigate away when canDeactivate returns false',
|
it('should not navigate away when canDeactivate returns false',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -294,7 +294,7 @@ export function main() {
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}));
|
}), 2000);
|
||||||
|
|
||||||
|
|
||||||
it('should run activation and deactivation hooks in the correct order',
|
it('should run activation and deactivation hooks in the correct order',
|
||||||
|
@ -322,7 +322,7 @@ export function main() {
|
||||||
]);
|
]);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 2000);
|
||||||
|
|
||||||
it('should only run reuse hooks when reusing', inject([AsyncTestCompleter], (async) => {
|
it('should only run reuse hooks when reusing', inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
|
@ -349,7 +349,7 @@ export function main() {
|
||||||
]);
|
]);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 2000);
|
||||||
|
|
||||||
it('should not run reuse hooks when not reusing', inject([AsyncTestCompleter], (async) => {
|
it('should not run reuse hooks when not reusing', inject([AsyncTestCompleter], (async) => {
|
||||||
compile()
|
compile()
|
||||||
|
@ -378,7 +378,7 @@ export function main() {
|
||||||
]);
|
]);
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
}));
|
}), 2000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ export function main() {
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('broken app', () => {
|
describe('broken app', () => {
|
||||||
|
@ -78,7 +78,7 @@ export function main() {
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('back button app', () => {
|
describe('back button app', () => {
|
||||||
|
@ -148,26 +148,27 @@ export function main() {
|
||||||
});
|
});
|
||||||
router.navigate('/parent/child');
|
router.navigate('/parent/child');
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
describe('custom app base ref', () => {
|
describe('custom app base ref', () => {
|
||||||
beforeEachBindings(() => { return [bind(APP_BASE_HREF).toValue('/my/app')]; });
|
beforeEachBindings(() => { return [bind(APP_BASE_HREF).toValue('/my/app')]; });
|
||||||
it('should bootstrap', inject([AsyncTestCompleter, TestComponentBuilder],
|
it('should bootstrap',
|
||||||
(async, tcb: TestComponentBuilder) => {
|
inject([AsyncTestCompleter, TestComponentBuilder],
|
||||||
|
(async, tcb: TestComponentBuilder) => {
|
||||||
|
|
||||||
tcb.createAsync(HierarchyAppCmp)
|
tcb.createAsync(HierarchyAppCmp)
|
||||||
.then((rootTC) => {
|
.then((rootTC) => {
|
||||||
var router = rootTC.componentInstance.router;
|
var router = rootTC.componentInstance.router;
|
||||||
router.subscribe((_) => {
|
router.subscribe((_) => {
|
||||||
expect(rootTC.nativeElement)
|
expect(rootTC.nativeElement).toHaveText('root { parent { hello } }');
|
||||||
.toHaveText('root { parent { hello } }');
|
expect(rootTC.componentInstance.location.path())
|
||||||
expect(rootTC.componentInstance.location.path())
|
.toEqual('/my/app/parent/child');
|
||||||
.toEqual('/my/app/parent/child');
|
async.done();
|
||||||
async.done();
|
});
|
||||||
});
|
router.navigate('/parent/child');
|
||||||
router.navigate('/parent/child');
|
});
|
||||||
});
|
}),
|
||||||
}));
|
1000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// TODO: add a test in which the child component has bindings
|
// TODO: add a test in which the child component has bindings
|
||||||
|
@ -192,7 +193,7 @@ export function main() {
|
||||||
router.navigate('/qs?q=search-for-something');
|
router.navigate('/qs?q=search-for-something');
|
||||||
rootTC.detectChanges();
|
rootTC.detectChanges();
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,7 @@ export function main() {
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it('should navigate to link hrefs in presence of base href',
|
it('should navigate to link hrefs in presence of base href',
|
||||||
inject([AsyncTestCompleter], (async) => {
|
inject([AsyncTestCompleter], (async) => {
|
||||||
|
@ -200,7 +200,7 @@ export function main() {
|
||||||
async.done();
|
async.done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}));
|
}), 1000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ export function main() {
|
||||||
expect(ev['url']).toEqual('/user/btford');
|
expect(ev['url']).toEqual('/user/btford');
|
||||||
async.done();
|
async.done();
|
||||||
})
|
})
|
||||||
}), 1000);
|
}), 2000);
|
||||||
|
|
||||||
it('should normalize location path', () => {
|
it('should normalize location path', () => {
|
||||||
locationStrategy.internalPath = '/my/app/user/btford';
|
locationStrategy.internalPath = '/my/app/user/btford';
|
||||||
|
|
|
@ -35,7 +35,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
var toEmitter = bus.to(CHANNEL);
|
var toEmitter = bus.to(CHANNEL);
|
||||||
ObservableWrapper.callNext(toEmitter, MESSAGE);
|
ObservableWrapper.callNext(toEmitter, MESSAGE);
|
||||||
}));
|
}), 1000);
|
||||||
|
|
||||||
it("should broadcast", inject([AsyncTestCompleter], (async) => {
|
it("should broadcast", inject([AsyncTestCompleter], (async) => {
|
||||||
const CHANNEL = "CHANNEL 1";
|
const CHANNEL = "CHANNEL 1";
|
||||||
|
|
Loading…
Reference in New Issue