Merge pull request #256 from NativeScript/view-props

Moved text-align and font-size to TextBase and fixed a WebView test.
This commit is contained in:
Rossen Hristov
2015-04-03 16:46:40 +03:00
6 changed files with 32 additions and 29 deletions

View File

@ -10,7 +10,6 @@ allTests["WRAPLAYOUT"] = require("./layouts/wrap-layout-tests");
allTests["ABSOLUTELAYOUT"] = require("./layouts/absolute-layout-tests"); allTests["ABSOLUTELAYOUT"] = require("./layouts/absolute-layout-tests");
allTests["GRIDLAYOUT"] = require("./layouts/grid-layout-tests"); allTests["GRIDLAYOUT"] = require("./layouts/grid-layout-tests");
allTests["STACKLAYOUT"] = require("./layouts/stack-layout-tests"); allTests["STACKLAYOUT"] = require("./layouts/stack-layout-tests");
allTests["WEB-VIEW"] = require("./ui/web-view/web-view-tests");
allTests["PLATFORM"] = require("./platform-tests"); allTests["PLATFORM"] = require("./platform-tests");
allTests["STYLE-PROPERTIES"] = require("./ui/style/style-properties-tests"); allTests["STYLE-PROPERTIES"] = require("./ui/style/style-properties-tests");
allTests["SCROLL-VIEW"] = require("./ui/scroll-view/scroll-view-tests"); allTests["SCROLL-VIEW"] = require("./ui/scroll-view/scroll-view-tests");
@ -51,6 +50,7 @@ allTests["XML-DECLARATION"] = require("./xml-declaration/xml-declaration-tests")
allTests["LIST-PICKER"] = require("./ui/list-picker/list-picker-tests"); allTests["LIST-PICKER"] = require("./ui/list-picker/list-picker-tests");
allTests["DATE-PICKER"] = require("./ui/date-picker/date-picker-tests"); allTests["DATE-PICKER"] = require("./ui/date-picker/date-picker-tests");
allTests["TIME-PICKER"] = require("./ui/time-picker/time-picker-tests"); allTests["TIME-PICKER"] = require("./ui/time-picker/time-picker-tests");
allTests["WEB-VIEW"] = require("./ui/web-view/web-view-tests");
var testsWithLongDelay = { var testsWithLongDelay = {
testLocation: 10000, testLocation: 10000,

View File

@ -63,7 +63,7 @@ export var testLoadExistingUrl = function () {
}); });
webView.url = "https://httpbin.org/html"; webView.url = "https://httpbin.org/html";
TKUnit.wait(2); TKUnit.wait(4);
helper.goBack(); helper.goBack();
@ -89,14 +89,17 @@ export var testLoadInvalidUrl = function () {
var testFinished = false; var testFinished = false;
var actualError; var actualError;
webView.on(webViewModule.knownEvents.loadFinished, function (args: webViewModule.LoadEventData) { webView.on(webViewModule.knownEvents.loadFinished, function (args: webViewModule.LoadEventData) {
testFinished = true; if (actualError) {
// Android call this twice -- the second time args.error is undefined.
return;
}
actualError = args.error; actualError = args.error;
testFinished = true;
}); });
webView.url = "kofti://mnogokofti"; webView.url = "kofti://mnogokofti";
TKUnit.wait(2); TKUnit.wait(4);
helper.goBack(); helper.goBack();

View File

@ -174,20 +174,6 @@ export class View extends proxy.ProxyObject implements definition.View {
this.style.backgroundColor = value; this.style.backgroundColor = value;
} }
get fontSize(): number {
return this.style.fontSize;
}
set fontSize(value: number) {
this.style.fontSize = value;
}
get textAlignment(): string {
return this.style.textAlignment;
}
set textAlignment(value: string) {
this.style.textAlignment;
}
get minWidth(): number { get minWidth(): number {
return this.style.minWidth; return this.style.minWidth;
} }

10
ui/core/view.d.ts vendored
View File

@ -135,16 +135,6 @@ declare module "ui/core/view" {
*/ */
backgroundColor: color.Color; backgroundColor: color.Color;
/**
* Gets or sets font-size style property.
*/
fontSize: number;
/**
* Gets or sets text-alignment style property.
*/
textAlignment: string;
/** /**
* Gets or sets the minimum width the view may grow to. * Gets or sets the minimum width the view may grow to.
*/ */

View File

@ -25,6 +25,16 @@
*/ */
text: string; text: string;
/**
* Gets or sets text-alignment style property.
*/
textAlignment: string;
/**
* Gets or sets font-size style property.
*/
fontSize: number;
/** /**
* Gets or sets a formatted string. * Gets or sets a formatted string.
*/ */

View File

@ -57,6 +57,20 @@ export class TextBase extends view.View implements definition.TextBase {
this._setValue(TextBase.textProperty, value); this._setValue(TextBase.textProperty, value);
} }
get fontSize(): number {
return this.style.fontSize;
}
set fontSize(value: number) {
this.style.fontSize = value;
}
get textAlignment(): string {
return this.style.textAlignment;
}
set textAlignment(value: string) {
this.style.textAlignment;
}
get formattedText(): formattedString.FormattedString { get formattedText(): formattedString.FormattedString {
return this._getValue(TextBase.formattedTextProperty); return this._getValue(TextBase.formattedTextProperty);
} }