whiteSpace default value change to undefined (#3782)

TKUnit default message change to empty string
isSet method is now instance method of Property classes
fix detaching from parent bindingContext - were using oldParent.parent instead of parent
editable-text-base.android - onTextChanged implementation commented. Does nothing.
frame - onCreateView wrapped in try/catch and shows label with exception message if any
text-base.android - should support reset of nativeView. TransformationMethod won’t be set if TextField is secure
Change some types to their string couterparts
TextField.android won’t support multilines anymore in order to work as iOS
In android when page is removed from native backstack we won’t call tearDownUI again a second time
This commit is contained in:
Hristo Hristov
2017-03-14 10:26:45 +02:00
committed by GitHub
parent 8592c934ec
commit a64bba62aa
15 changed files with 314 additions and 303 deletions

View File

@@ -214,7 +214,7 @@ export function assertNotEqual(actual: any, expected: any, message?: string) {
}
}
export function assertEqual<T extends { equals?(arg: T): boolean }>(actual: T, expected: T, message?: string) {
export function assertEqual<T extends { equals?(arg: T): boolean }>(actual: T, expected: T, message: string = '') {
if (!types.isNullOrUndefined(actual)
&& !types.isNullOrUndefined(expected)
&& types.getClass(actual) === types.getClass(expected)

View File

@@ -508,18 +508,17 @@ export function test_TwoElementsBindingToSameBindingContext() {
export function test_BindingContext_NavigatingForwardAndBack() {
const expectedValue = "Tralala";
const moduleName = __dirname.substr(fs.knownFolders.currentApp().path.length);
const testFunc = function (page: Page) {
const innerTestFunc = function (childPage: Page) {
const testTextField: TextField = <TextField>(childPage.getViewById("testTextField"));
testTextField.text = expectedValue;
};
const moduleName = __dirname.substr(fs.knownFolders.currentApp().path.length);
helper.navigateToModuleAndRunTest(("." + moduleName + "/bindingContext_testPage2"), page.bindingContext, innerTestFunc);
const testLabel: Label = <Label>(page.getViewById("testLabel"));
TKUnit.assertEqual(testLabel.text, expectedValue);
};
const moduleName = __dirname.substr(fs.knownFolders.currentApp().path.length);
helper.navigateToModuleAndRunTest(("." + moduleName + "/bindingContext_testPage1"), null, testFunc);
};

View File

@@ -5,37 +5,12 @@ import { Label } from "tns-core-modules/ui/label";
import { TextField } from "tns-core-modules/ui/text-field";
import { TextView } from "tns-core-modules/ui/text-view";
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
import { Page } from "tns-core-modules/ui/page";
import { Color } from "tns-core-modules/color";
import { isAndroid, isIOS } from "tns-core-modules/platform";
import { View } from "tns-core-modules/ui/core/view";
import { Length, PercentLength } from "tns-core-modules/ui/core/view";
import * as fontModule from "tns-core-modules/ui/styling/font";
let testBtn: Button;
let testPage: Page;
export function setUpModule() {
const pageFactory = function () {
testPage = new Page();
testBtn = new Button();
testBtn.text = "test";
testBtn.id = "testBtn";
testPage.content = testBtn;
return testPage;
};
helper.navigate(pageFactory);
}
export function tearDownModule() {
testBtn = null;
testPage = null;
}
export function tearDown() {
testPage.css = "";
}
export function test_setting_textDecoration_property_from_CSS_is_applied_to_Style() {
test_property_from_CSS_is_applied_to_style("textDecoration", "text-decoration", "underline");
}
@@ -214,14 +189,18 @@ function test_property_from_CSS_is_applied_to_style(propName: string, cssName: s
cssValue = value + "";
}
testPage.css = "#testBtn { " + cssName + ": " + cssValue + " }";
const btn = new Button();
btn.id = "testBtn";
const page = helper.getCurrentPage();
page.css = "#testBtn { " + cssName + ": " + cssValue + " }";
page.content = btn;
if (useDeepEquals) {
TKUnit.assertDeepEqual(testBtn.style[propName], value);
TKUnit.assertDeepEqual(btn.style[propName], value);
} else {
TKUnit.assertEqual(testBtn.style[propName], value, "Setting property " + propName + " with CSS name " + cssName);
TKUnit.assertEqual(btn.style[propName], value, "Setting property " + propName + " with CSS name " + cssName);
}
testPage.css = "";
}
export function test_width_property_is_synced_in_style_and_view() {