cache page on forward navigation (#4652)

* cache page on forward navigation
Still some failing navigation tests

* Current page is kept alive when navigating forward
Refactoring code and removing all hacks and flags
Remove one module circular reference

* Disable Page recycling because when there is transition between pages the nativeView stays animated (e.g. when transition is Fade the hidden page nativeView stays with Alpha 0)
Disable recycling if there is native anitmation

* Fix failing tests on ios & android API17
Fix wrong urls in http tests
Made some timer tests async

* Animations are not stored in BackstackEntry instead of Fragment because fragments could die (activity die) and recreated and we lose animations.

* Fix android crash when activity is recreated.
Refactoring transitionListener.
This commit is contained in:
Hristo Hristov
2017-08-07 17:24:12 +03:00
committed by GitHub
parent e827eced8e
commit 075e70e336
33 changed files with 1565 additions and 1770 deletions

View File

@@ -110,51 +110,55 @@ export function test_setTimeout_callbackShouldBeCleared() {
TKUnit.assert(!completed, "Callback should be cleared when clearTimeout() is executed for specified id!");
};
export function test_setInterval_callbackCalledDuringPeriod() {
export function test_setInterval_callbackCalledDuringPeriod(done) {
let counter = 0;
let expected = 4;
const expected = 4;
const start = TKUnit.time();
// >> timer-set-expression
const id = timer.setInterval(() => {
// >> (hide)
counter++;
if (counter === 4) {
const end = TKUnit.time();
timer.clearInterval(id);
done(end - start > 250 ? new Error('setInterval too slow.') : null);
}
// << (hide)
}, 50);
// << timer-set-expression
TKUnit.waitUntilReady(() => counter >= expected, 0.25, false);
timer.clearInterval(id);
TKUnit.assert(counter >= expected, "Callback should be raised at least" + expected + "times! Callback raised " + counter + " times.");
};
export function test_setInterval_callbackCalledWithExtraArgs() {
export function test_setInterval_callbackCalledWithExtraArgs(done) {
let counter: number = 0;
let expected: number = 4;
let rnd: number = Math.random();
const expected: number = 4;
const rnd: number = Math.random();
const start = TKUnit.time();
const id = timer.setInterval((arg) => {
counter += arg === rnd ? 1 : -1;
if (counter === 4) {
const end = TKUnit.time();
timer.clearInterval(id);
done(end - start > 250 ? new Error('setInterval too slow.') : null);
}
}, 50, rnd);
TKUnit.waitUntilReady(() => counter >= expected, 0.25, false);
timer.clearInterval(id);
TKUnit.assert(counter >= expected, "Callback raised " + counter + " times with arguments.");
};
export function test_setInterval_callbackShouldBeCleared() {
export function test_setInterval_callbackShouldBeCleared(done) {
let counter = 0;
const start = TKUnit.time();
// >> timer-set-interval
const id = timer.setInterval(() => {
// >> (hide)
counter++;
const end = TKUnit.time();
timer.clearInterval(id);
done(end - start > 150 ? new Error('setInterval too slow.') : null);
// << (hide)
timer.clearInterval(id);
}, 50);
// << timer-set-interval
TKUnit.wait(0.15);
TKUnit.assertEqual(counter, 1, "Callback should be raised only once!");
};
export function test_clearTimeout_multipleTimes_afterTick() {
@@ -205,4 +209,4 @@ export function test_clearTimeout_insideCallback() {
TKUnit.waitUntilReady(() => completed, 0.5);
TKUnit.assert(completed, "Callback should be called");
}
}