mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Fixed Issue #1335: Page (xml) with no content does not fire loaded
callbacks in ActionBar.
This commit is contained in:
@ -409,6 +409,62 @@ export function test_CanDefineEverythingAsContentBetweenTheTwoTags() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function test_LoadedEventsOrder() {
|
||||||
|
var loadedEvents = new Array<string>();
|
||||||
|
var pageFactory = function (): PageModule.Page {
|
||||||
|
var page = new PageModule.Page();
|
||||||
|
page.on(viewModule.View.loadedEvent, () => {
|
||||||
|
loadedEvents.push("page");
|
||||||
|
});
|
||||||
|
|
||||||
|
page.actionBar.on(viewModule.View.loadedEvent, () => {
|
||||||
|
loadedEvents.push("action-bar");
|
||||||
|
});
|
||||||
|
|
||||||
|
var content = new LabelModule.Label();
|
||||||
|
content.on(viewModule.View.loadedEvent, () => {
|
||||||
|
loadedEvents.push("content");
|
||||||
|
});
|
||||||
|
page.content = content;
|
||||||
|
|
||||||
|
return page;
|
||||||
|
};
|
||||||
|
|
||||||
|
helper.navigate(pageFactory);
|
||||||
|
|
||||||
|
try {
|
||||||
|
TKUnit.arrayAssert(loadedEvents, new Array<string>("content", "action-bar", "page"));
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
helper.goBack();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export function test_LoadedEventsOrder_WithoutPageContent() {
|
||||||
|
var loadedEvents = new Array<string>();
|
||||||
|
var pageFactory = function (): PageModule.Page {
|
||||||
|
var page = new PageModule.Page();
|
||||||
|
page.on(viewModule.View.loadedEvent, () => {
|
||||||
|
loadedEvents.push("page");
|
||||||
|
});
|
||||||
|
|
||||||
|
page.actionBar.on(viewModule.View.loadedEvent, () => {
|
||||||
|
loadedEvents.push("action-bar");
|
||||||
|
});
|
||||||
|
|
||||||
|
return page;
|
||||||
|
};
|
||||||
|
|
||||||
|
helper.navigate(pageFactory);
|
||||||
|
|
||||||
|
try {
|
||||||
|
TKUnit.arrayAssert(loadedEvents, new Array<string>("action-bar", "page"));
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
helper.goBack();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export function createPageAndNavigate() {
|
export function createPageAndNavigate() {
|
||||||
var page: PageModule.Page;
|
var page: PageModule.Page;
|
||||||
var pageFactory = function (): PageModule.Page {
|
var pageFactory = function (): PageModule.Page {
|
||||||
|
@ -280,10 +280,13 @@ export class Page extends ContentView implements dts.Page {
|
|||||||
|
|
||||||
public _eachChildView(callback: (child: view.View) => boolean) {
|
public _eachChildView(callback: (child: view.View) => boolean) {
|
||||||
super._eachChildView(callback);
|
super._eachChildView(callback);
|
||||||
|
|
||||||
callback(this.actionBar);
|
callback(this.actionBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get _childrenCount(): number {
|
||||||
|
return (this.content ? 1 : 0) + (this.actionBar ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
private _applyCss() {
|
private _applyCss() {
|
||||||
if (this._cssApplied) {
|
if (this._cssApplied) {
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user