Page tests fix.

This commit is contained in:
Nedyalko Nikolov
2017-01-16 19:04:21 +02:00
parent 0010a25ca3
commit 329ba3a2c5
8 changed files with 31 additions and 14 deletions

View File

@@ -1485,7 +1485,11 @@ function convertToTransform(value: string): [CssProperty<any, any>, any][] {
}
// Background properties.
export const backgroundInternalProperty = new CssProperty<Style, Background>({ name: "backgroundInternal", cssName: "_backgroundInternal", defaultValue: Background.default });
export const backgroundInternalProperty = new CssProperty<Style, Background>({
name: "backgroundInternal",
cssName: "_backgroundInternal",
defaultValue: Background.default
});
backgroundInternalProperty.register(Style);
let pattern: RegExp = /url\(('|")(.*?)\1\)/;

View File

@@ -1,7 +1,6 @@
import { Page as PageDefinition, NavigatedData, ShownModallyData } from "ui/page";
import {
ContentView, View, backgroundColorProperty,
eachDescendant, Property, Color, isIOS, booleanConverter, resetCSSProperties
ContentView, View, eachDescendant, Property, Color, isIOS, booleanConverter, resetCSSProperties
} from "ui/content-view";
import { Frame, topmost as topmostFrame, resolvePageFromEntry } from "ui/frame";
import { ActionBar } from "ui/action-bar";
@@ -41,9 +40,6 @@ export class PageBase extends ContentView implements PageDefinition {
constructor() {
super();
this.actionBar = new ActionBar();
// The default style of the page should be white background
this.style[backgroundColorProperty.cssName] = new Color("white");
}
// public onLoaded() {

View File

@@ -92,10 +92,15 @@ export class Page extends PageBase {
return this._grid;
}
get nativeView(): android.view.ViewGroup {
return this._grid;
}
public _createNativeView() {
this._grid = new org.nativescript.widgets.GridLayout(this._context);
this._grid.addRow(new org.nativescript.widgets.ItemSpec(1, org.nativescript.widgets.GridUnitType.auto));
this._grid.addRow(new org.nativescript.widgets.ItemSpec(1, org.nativescript.widgets.GridUnitType.star));
this.nativeView.setBackgroundColor(new Color("white").android);
}
public _addViewToNativeVisualTree(child: View, atIndex?: number): boolean {
@@ -126,6 +131,7 @@ export class Page extends PageBase {
if (!skipDetached) {
super._tearDownUI();
this._isAddedToNativeVisualTree = false;
}
}

View File

@@ -5,6 +5,7 @@
} from "./page-common";
import { ios as iosApp } from "application";
import { device } from "platform";
import { Color } from "color";
import * as uiUtils from "ui/utils";
export * from "./page-common";
@@ -115,9 +116,9 @@ class UIViewControllerImpl extends UIViewController {
let widthSpec = layout.makeMeasureSpec(width, mode);
let heightSpec = layout.makeMeasureSpec(height, mode);
View.measureChild(null, owner, widthSpec, heightSpec);
View.measureChild(owner._modalParent, owner, widthSpec, heightSpec);
let top = ((backgroundSpanUnderStatusBar && isFullScreen) || ios.MajorVersion < 8 || !isFullScreen) ? 0 : statusBarHeight;
View.layoutChild(null, owner, 0, top, width, bottom);
View.layoutChild(owner._modalParent, owner, 0, top, width, bottom);
if (ios.MajorVersion < 8) {
if (!backgroundSpanUnderStatusBar && (!isTablet || isFullScreen)) {
@@ -339,6 +340,7 @@ export class Page extends PageBase {
super();
this._ios = UIViewControllerImpl.initWithOwner(new WeakRef(this));
this.nativeView = this._ios.view;
this.nativeView.backgroundColor = new Color("white").ios;
}
public requestLayout(): void {
@@ -582,6 +584,9 @@ export class Page extends PageBase {
}
set [actionBarHiddenProperty.native](value: boolean) {
this._updateEnableSwipeBackNavigation(value);
if (this.isLoaded) {
this.updateActionBar(value);
}
}
get [statusBarStyleProperty.native](): UIBarStyle {