style(tests): format all files

This commit is contained in:
Vasil Chimev
2019-08-22 13:54:47 +03:00
parent 0a5ac1a527
commit 7412ce82b3
142 changed files with 589 additions and 557 deletions

View File

@@ -12,4 +12,4 @@
<StackLayout>
<Label text="page content"/>
</StackLayout>
</Page>
</Page>

View File

@@ -9,4 +9,4 @@
<StackLayout>
<Button text="Click me" />
</StackLayout>
</Page>
</Page>

View File

@@ -6,4 +6,4 @@
<StackLayout>
<Button text="Click me" />
</StackLayout>
</Page>
</Page>

View File

@@ -421,4 +421,4 @@ export function createPageAndNavigate() {
export function test_recycling() {
helper.nativeView_recycling_test(() => new actionBarModule.ActionBar());
}
}

View File

@@ -1,4 +1,4 @@
/* tslint:disable */
//@private
import * as android from "./action-bar-tests.android";
import * as iOS from "./action-bar-tests.ios";
import * as iOS from "./action-bar-tests.ios";

View File

@@ -66,7 +66,7 @@ if (platform.device.os === platform.platformNames.ios) {
/* tslint:disable:no-unused-variable */
function binding_busy_to_image() {
/* tslint:enable:no-unused-variable */
// >> activity-indicator-loading
var image = new imageModule.Image();
var indicator = new activityIndicatorModule.ActivityIndicator();

View File

@@ -501,10 +501,10 @@ export function test_AnimateExtent_Should_ThrowIfCannotParsePercentLength() {
const label = new Label();
helper.buildUIAndRunTest(label, (views: Array<viewModule.View>) => {
TKUnit.assertThrows(() => {
label.animate({width: "-frog%"});
label.animate({ width: "-frog%" });
}, "Invalid percent string should throw");
TKUnit.assertThrows(() => {
label.animate({height: "-frog%"});
label.animate({ height: "-frog%" });
}, "Invalid percent string should throw");
});
}

View File

@@ -27,7 +27,7 @@ function createAnimationFromCSS(css: string, name: string): keyframeAnimation.Ke
}
function findSelectorInScope(scope: styleScope.StyleScope, cssClass: string): SelectorCore {
let selectors = scope.query({cssClasses: new Set([cssClass])});
let selectors = scope.query({ cssClasses: new Set([cssClass]) });
return selectors[0];
}
@@ -426,12 +426,12 @@ export function test_AnimationCurveInKeyframes() {
function getTransformsValues(declarations) {
return Object.assign({},
...(<any>Object).entries(getTransforms(declarations))
.map(([k, v]) => ({[k]: v.value}))
.map(([k, v]) => ({ [k]: v.value }))
);
}
function getTransforms(declarations) {
const [ translate, rotate, scale ] = [...declarations];
const [translate, rotate, scale] = [...declarations];
return { translate, rotate, scale };
}

View File

@@ -1,5 +1,13 @@
@keyframes test {
from { background-color: red; }
50% { background-color: yellow; }
to { background-color: green; }
}
from {
background-color: red;
}
50% {
background-color: yellow;
}
to {
background-color: green;
}
}

View File

@@ -5,4 +5,4 @@ import * as helper from "../../ui-helper";
export function test_recycling() {
helper.nativeView_recycling_test(() => new Border());
}
}

View File

@@ -37,4 +37,4 @@ export function getOriginalFont(tabView: BottomNavigation): any {
typeface: tv.getTypeface(),
size: tv.getTextSize()
};
}
}

View File

@@ -5,4 +5,4 @@ export function getNativeTabCount(tabView: BottomNavigation): number;
export function selectNativeTab(tabView: BottomNavigation, index: number): void;
export function getNativeSelectedIndex(tabView: BottomNavigation): number;
export function getNativeFont(tabView: BottomNavigation): any;
export function getOriginalFont(tabView: BottomNavigation): any;
export function getOriginalFont(tabView: BottomNavigation): any;

View File

@@ -427,7 +427,7 @@ export function testCustomComponentWithCode_JsCssQualifiers() {
}
function loadRightComponentXmlWithCodeFileAndCssFile() {
return `<Button
return `<Button
codeFile="${testPrefix}/component/custom-code-component.js"
cssFile="${testPrefix}/component/custom-code-component.css"
id="test-id" class="test-class" text="right" tap="testEvent"/>`;

View File

@@ -103,7 +103,7 @@ export function test_listenerDoesNotRetainTarget(done) {
// with the v8 6.5 the GC does not release WeakRefs so fast if you pass them to a method
// that's why we are making the call to the addWeakEventListener in a closure so that the WeakRef will be easier released
(function() {
(function () {
addWeakEventListener(sourceRef.get(), Observable.propertyChangeEvent, emptyHandler, targetRef.get());
})();
forceGC();
@@ -123,7 +123,7 @@ export function test_listenerDoesNotRetainSource(done) {
// with the v8 6.5 the GC does not release WeakRefs so fast if you pass them to a method
// that's why we are making the call to the addWeakEventListener in a closure so that the WeakRef will be easier released
(function() {
(function () {
addWeakEventListener(sourceRef.get(), Observable.propertyChangeEvent, targetRef.get().onEvent, targetRef.get());
})();
forceGC();

View File

@@ -49,21 +49,21 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke
return datePicker;
}
private setUpDatePicker(year?: number, month?: number, day?: number) {
if (year) {
this.testView.year = year;
}
if (month) {
this.testView.month = month;
}
if (day) {
this.testView.day = day;
}
}
public test_DummyForCodeSnippet() {
const datePicker = new datePickerModule.DatePicker();
// >> date-picker-configure
@@ -74,14 +74,14 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke
datePicker.maxDate = new Date(2045, 4, 12);
// << date-picker-configure
}
public test_set_color() {
if (platform.device.os === platform.platformNames.ios) {
this.testView.color = new color.Color("red");
TKUnit.assertEqual(this.testView.color.ios.CGColor, this.testView.ios.valueForKey("textColor").CGColor, "datePicker.color");
}
}
public test_WhenCreated_YearIsCurrentYear() {
const actualValue = this.testView.year;
const expectedValue = currentDate.getFullYear();
@@ -138,69 +138,69 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke
const actualValue = datePickerTestsNative.getNativeDay(this.testView);
TKUnit.assertEqual(actualValue, expectedValue);
}
public test_DateIsSetCorrectlyWhenDayIsSet() {
const today = new Date(2016, 3, 15);
this.testView.year = today.getFullYear();
this.testView.month = today.getMonth();
const expectedValue = today.getDate();
this.testView.day = expectedValue;
const expectedDate = new Date(today.getFullYear(), today.getMonth() - 1, expectedValue);
TKUnit.assertEqual(this.testView.date.getDate(), expectedDate.getDate(), "Getting Day from date property failed.");
TKUnit.assertEqual(this.testView.date.getMonth(), expectedDate.getMonth(), "Getting Month from date property failed.");
TKUnit.assertEqual(this.testView.date.getFullYear(), expectedDate.getFullYear(), "Getting Year from date property failed.");
}
public test_DateIsSetCorrectlyWhenMonthIsSet() {
const today = new Date(2016, 3, 15);
this.testView.year = today.getFullYear();
this.testView.day = today.getDate();
const expectedValue = today.getMonth();
this.testView.month = expectedValue;
const expectedDate = new Date(today.getFullYear(), expectedValue - 1, today.getDate());
TKUnit.assertEqual(this.testView.date.getDate(), expectedDate.getDate(), "Getting Day from date property failed.");
TKUnit.assertEqual(this.testView.date.getMonth(), expectedDate.getMonth(), "Getting Month from date property failed.");
TKUnit.assertEqual(this.testView.date.getFullYear(), expectedDate.getFullYear(), "Getting Year from date property failed.");
}
public test_DateIsSetCorrectlyWhenYearIsSet() {
const current = new Date(2016, 3, 15);
this.testView.month = current.getMonth();
this.testView.day = current.getDate();
const expectedValue = 1980;
this.testView.year = expectedValue;
const expectedDate = new Date(1980, current.getMonth() - 1, current.getDate());
TKUnit.assertEqual(this.testView.date.getDate(), expectedDate.getDate(), "Getting Day from date property failed.");
TKUnit.assertEqual(this.testView.date.getMonth(), expectedDate.getMonth(), "Getting Month from date property failed.");
TKUnit.assertEqual(this.testView.date.getFullYear(), expectedDate.getFullYear(), "Getting Year from date property failed.");
}
public testMaxDateFromLocalToNative() {
const expectedValue = new Date(1980, 1, 9);
this.testView.maxDate = expectedValue;
const actualValue = datePickerTestsNative.getNativeMaxDate(this.testView);
TKUnit.assertEqual(actualValue.getTime(), expectedValue.getTime());
}
public testMinDateFromLocalToNative() {
const expectedValue = new Date(1980, 1, 9);
this.testView.minDate = expectedValue;
const actualValue = datePickerTestsNative.getNativeMinDate(this.testView);
TKUnit.assertEqual(actualValue.getTime(), expectedValue.getTime());
}
public testYearFromNativeToLocal() {
const expectedValue = 1981;
datePickerTestsNative.setNativeYear(this.testView, expectedValue);
const actualValue = this.testView.year;
TKUnit.assertEqual(actualValue, expectedValue);
}
public testMonthFromNativeToLocal() {
// Use July as it has 31 days
const expectedValue = 7;
@@ -208,7 +208,7 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke
const actualValue = this.testView.month;
TKUnit.assertEqual(actualValue, expectedValue);
}
public testYearMonthDayFromNativeToLocal() {
const testYear = 2000;
const testMonth = 3;
@@ -217,67 +217,67 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke
datePickerTestsNative.setNativeDate(this.testView, testYear, testMonth, testDay);
assertDate(this.testView, testYear, testMonth, testDay);
}
public testDayFromNativeToLocal() {
const expectedValue = 20;
datePickerTestsNative.setNativeDay(this.testView, expectedValue);
const actualValue = this.testView.day;
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
}
public test_DateFromNativeToLocalWithDay() {
const today = new Date();
const expectedValue = 20;
datePickerTestsNative.setNativeDate(this.testView, today.getFullYear(), today.getMonth(), expectedValue);
const expectedDate = new Date(today.getFullYear(), today.getMonth() - 1, expectedValue);
TKUnit.assertEqual(this.testView.date.getDate(), expectedDate.getDate(), "Getting Day from date property failed.");
TKUnit.assertEqual(this.testView.date.getMonth(), expectedDate.getMonth(), "Getting Month from date property failed.");
TKUnit.assertEqual(this.testView.date.getFullYear(), expectedDate.getFullYear(), "Getting Year from date property failed.");
}
public test_DateFromNativeToLocalWithMonth() {
const today = new Date();
const expectedValue = 7;
datePickerTestsNative.setNativeDate(this.testView, today.getFullYear(), expectedValue, today.getDate());
const expectedDate = new Date(today.getFullYear(), expectedValue - 1, today.getDate());
TKUnit.assertEqual(this.testView.date.getDate(), expectedDate.getDate(), "Getting Day from date property failed.");
TKUnit.assertEqual(this.testView.date.getMonth(), expectedDate.getMonth(), "Getting Month from date property failed.");
TKUnit.assertEqual(this.testView.date.getFullYear(), expectedDate.getFullYear(), "Getting Year from date property failed.");
}
public test_DateFromNativeToLocalWithYear() {
const today = new Date();
const expectedValue = 1981;
datePickerTestsNative.setNativeDate(this.testView, expectedValue, today.getMonth(), today.getDate());
const expectedDate = new Date(expectedValue, today.getMonth() - 1, today.getDate());
TKUnit.assertEqual(this.testView.date.getDate(), expectedDate.getDate(), "Getting Day from date property failed.");
TKUnit.assertEqual(this.testView.date.getMonth(), expectedDate.getMonth(), "Getting Month from date property failed.");
TKUnit.assertEqual(this.testView.date.getFullYear(), expectedDate.getFullYear(), "Getting Year from date property failed.");
}
public test_DateFromNativeToLocalWithAll() {
const testYear = 2000;
const testMonth = 3;
const testDay = 24;
datePickerTestsNative.setNativeDate(this.testView, testYear, testMonth, testDay);
const expectedDate = new Date(testYear, testMonth - 1, testDay);
TKUnit.assertEqual(this.testView.date.getDate(), expectedDate.getDate(), "Getting Day from date property failed.");
TKUnit.assertEqual(this.testView.date.getMonth(), expectedDate.getMonth(), "Getting Month from date property failed.");
TKUnit.assertEqual(this.testView.date.getFullYear(), expectedDate.getFullYear(), "Getting Year from date property failed.");
}
public testSetYearMonthDay_BeforeLoaded() {
const testYear = 2000;
const testMonth = 3;
const testDay = 24;
this.setUpDatePicker(testYear, testMonth, testDay);
TKUnit.assertEqual(this.testView.year, testYear, "datePicker.year");
@@ -288,16 +288,16 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke
TKUnit.assertEqual(datePickerTestsNative.getNativeMonth(this.testView), testMonth, "Native datePicker.month");
TKUnit.assertEqual(datePickerTestsNative.getNativeDay(this.testView), testDay, "Native datePicker.day");
}
public testSetYearMonthDay_AfterLoaded() {
const testYear = 2000;
const testMonth = 3;
const testDay = 24;
this.testView.year = testYear;
this.testView.month = testMonth;
this.testView.day = testDay;
this.waitUntilTestElementIsLoaded();
assertDate(this.testView, testYear, testMonth, testDay);
}

View File

@@ -11,9 +11,9 @@ export function test_percent_width_and_height_set_to_page_support() {
(<any>currentPage).width = "50%";
(<any>currentPage).height = "50%";
TKUnit.waitUntilReady(() => {
return currentPage.isLayoutValid;
}, 1);
TKUnit.waitUntilReady(() => {
return currentPage.isLayoutValid;
}, 1);
let topFrameWidth = topFrame.getMeasuredWidth();
let topFrameHeight = topFrame.getMeasuredHeight();
@@ -37,9 +37,9 @@ export function test_percent_margin_set_to_page_support() {
let currentPage = topFrame.currentPage;
currentPage.margin = "10%";
TKUnit.waitUntilReady(() => {
return currentPage.isLayoutValid;
}, 1);
TKUnit.waitUntilReady(() => {
return currentPage.isLayoutValid;
}, 1);
let topFrameWidth = topFrame.getMeasuredWidth();
let topFrameHeight = topFrame.getMeasuredHeight();
@@ -63,4 +63,4 @@ export function test_percent_margin_set_to_page_support() {
TKUnit.assertTrue(PercentLength.equals(currentPage.marginTop, 0));
TKUnit.assertTrue(PercentLength.equals(currentPage.marginRight, 0));
TKUnit.assertTrue(PercentLength.equals(currentPage.marginBottom, 0));
}
}

View File

@@ -1,3 +1,3 @@
/* tslint:disable */
//@private
import * as android from "./frame-tests.android";
import * as android from "./frame-tests.android";

View File

@@ -1 +1 @@
export * from "./frame-tests-common";
export * from "./frame-tests-common";

View File

@@ -8,7 +8,7 @@ import * as TKUnit from "../../tk-unit";
const sdkVersion = lazy(() => parseInt(device.sdkVersion));
export const test_ImageCache_ValidUrl = function() {
export const test_ImageCache_ValidUrl = function () {
// see https://github.com/NativeScript/NativeScript/issues/6643
if (sdkVersion() < 20) {
return;
@@ -46,7 +46,7 @@ export const test_ImageCache_ValidUrl = function() {
TKUnit.assertEqual(validKey, url, "Key should equal the provided url");
};
export const test_ImageCache_NothingAtProvidedUrl = function() {
export const test_ImageCache_NothingAtProvidedUrl = function () {
const cache = new imageCacheModule.Cache();
cache.maxRequests = 5;

View File

@@ -8,7 +8,7 @@ previous_url: /ApiReference/ui/image/HOW-TO
# Image
The purpose of this article is to show the basic functionality of the Image view. The snippets demonstrates some scenarios and the usage of the ImageView specifics properties
The purpose of this article is to show the basic functionality of the Image view. The snippets demonstrates some scenarios and the usage of the ImageView specifics properties
* [Binding image source property](#binding-image-source-property)
* [Loading an image from app resources](#loading-an-image-from-app-resources)
@@ -62,7 +62,7 @@ The example demonstrates how we could load an image, which is available in the A
``` XML
<Page>
<StackLayout>
{%raw%}<Image src="http://www.google.com/images/errors/logo_sm_2.png" stretch ="none" />{%endraw%}
{%raw%}<Image src="http://www.google.com/images/errors/logo_sm_2.png" stretch ="none" />{%endraw%}
</StackLayout>
</Page>
```
@@ -83,13 +83,13 @@ The sample above, demonstrates, how to load an image source while providing URL
{%snippet img-create-local%}
The Image source could be load also from a local file. The path to the image should start with a tilde(`~`) as it is shown in the example above. Using `~/` prefix, we can load images relative to the project `app` folder
The Image source could be load also from a local file. The path to the image should start with a tilde(`~`) as it is shown in the example above. Using `~/` prefix, we can load images relative to the project `app` folder
### Loading an image from Data URI
{%snippet img-create-datauri%}
In the sample code is shown, how to load an image source data, while using data URI.
In the sample code is shown, how to load an image source data, while using data URI.
### Setting image stretching

View File

@@ -1,3 +1,3 @@
label {
background-color: red;
}
}

View File

@@ -1,4 +1,3 @@
label {
<!--Test wrong comment-->
background-color: red;
< !--Test wrong comment-->background-color: red;
}

View File

@@ -51,7 +51,7 @@ export class AbsoluteLayoutTest extends testModule.UITest<absoluteLayoutModule.A
absoluteLayout.height = { value: 230, unit: "px" };
absoluteLayout.style.backgroundColor = new colorModule.Color("LightGray");
let label = new labelModule.Label();
absoluteLayoutModule.AbsoluteLayout.setLeft(label, layoutHelper.dp(10));
absoluteLayoutModule.AbsoluteLayout.setTop(label, layoutHelper.dp(10));
label.width = { value: 100, unit: "px" };

View File

@@ -56,13 +56,15 @@ import { Label } from "tns-core-modules/ui/label";
import * as TKUnit from "../../tk-unit";
import * as helper from "../../ui-helper";
import { parse } from "tns-core-modules/ui/builder";
import { dipToDp, left, top, right, bottom, height, width,
import {
dipToDp, left, top, right, bottom, height, width,
paddingLeft, paddingTop, paddingRight, paddingBottom,
equal, closeEnough, notEqual, check,
heightEqual, widthEqual,
isLeftAlignedWith, isRightAlignedWith, isTopAlignedWith, isBottomAlignedWith,
isLeftOf, isRightOf, isBelow, isAbove,
isLeftWith, isAboveWith, isRightWith, isBelowWith } from "./layout-tests-helper";
isLeftWith, isAboveWith, isRightWith, isBelowWith
} from "./layout-tests-helper";
function waitUntilTestElementLayoutIsValid(view: View, timeoutSec?: number): void {
TKUnit.waitUntilReady(() => {

View File

@@ -121,7 +121,7 @@ export class GridLayoutTest extends testModule.UITest<RemovalTrackingGridLayout>
public test_synonym_property_setting_column_changes_col() {
const test = new Button();
test.column = 3;
TKUnit.assertEqual(test.column, 3, "Setting column should work.");
@@ -130,7 +130,7 @@ export class GridLayoutTest extends testModule.UITest<RemovalTrackingGridLayout>
public test_synonym_property_setting_col_changes_column() {
const test = new Button();
test.col = 3;
TKUnit.assertEqual(test.col, 3, "Setting col should work.");
@@ -139,7 +139,7 @@ export class GridLayoutTest extends testModule.UITest<RemovalTrackingGridLayout>
public test_synonym_property_setColumn_should_set_col_and_column() {
const test = new Button();
GridLayout.setColumn(test, 3);
TKUnit.assertEqual(test.col, 3, "setColumn should set col");
@@ -148,7 +148,7 @@ export class GridLayoutTest extends testModule.UITest<RemovalTrackingGridLayout>
public test_synonym_property_setting_columnSpan_changes_colSpan() {
const test = new Button();
test.columnSpan = 3;
TKUnit.assertEqual(test.columnSpan, 3, "Setting columnSpan should work.");
@@ -157,7 +157,7 @@ export class GridLayoutTest extends testModule.UITest<RemovalTrackingGridLayout>
public test_synonym_property_setting_colSpan_changes_columnSpan() {
const test = new Button();
test.colSpan = 3;
TKUnit.assertEqual(test.colSpan, 3, "Setting colSpan should work.");
@@ -166,7 +166,7 @@ export class GridLayoutTest extends testModule.UITest<RemovalTrackingGridLayout>
public test_synonym_property_setColumnSpan_should_set_colSpan_and_columnSpan() {
const test = new Button();
GridLayout.setColumnSpan(test, 3);
TKUnit.assertEqual(test.colSpan, 3, "setColumnSpan should set colSpan");

View File

@@ -249,4 +249,4 @@ export function dp(value: number): number {
export function dip(value: number): number {
return utils.layout.toDevicePixels(value);
}
}

View File

@@ -173,7 +173,7 @@ export class MyButton extends Button implements def.MyButton {
return bounds.bottom - bounds.top;
}
get layoutLeft(): number {
let bounds = this._getCurrentLayoutBounds();

View File

@@ -1033,7 +1033,7 @@ export class SafeAreaTests extends testModule.UITest<any> {
greaterOrCloseEnough(width(cells[1][0]), width(cells[1][1]), `cell10 width<${width(cells[1][0])}> not greater or close enough cell11 width<${width(cells[1][1])}>`);
lessOrCloseEnough(width(cells[1][1]), width(cells[1][2]), `cell11 width<${width(cells[1][1])}> not less or close enough cell12 width<${width(cells[1][2])}>`);
const sumOfNestedGridWidths = width(cells[1][0]) + width(cells[1][1]) + width(cells[1][2]);
equal(width(grid), sumOfNestedGridWidths, `grid width<${width(grid)}> sum of nested grids width <${sumOfNestedGridWidths}>`);
},

View File

@@ -20,7 +20,7 @@ Using a StackLayout requires the StackLayout module.
## Create StackLayout
{%snippet stack-layout-new%}
## Add child view to layout
{%snippet stack-layout-addchild%}

View File

@@ -1,3 +1,3 @@
{
"main": "lifecycle-tests"
}
}

View File

@@ -1,4 +1,6 @@
#btn2, #btn3, #btn4 {
#btn2,
#btn3,
#btn4 {
border-width: 2;
border-color: teal;
border-radius: 20;

View File

@@ -12,4 +12,4 @@ Button {
.nocolor {
background: red;
}
}

View File

@@ -14,4 +14,4 @@ export function selectNativeItem(listPicker: listPickerModule.ListPicker, index:
var oldIndex = listPicker.selectedIndex;
listPicker.nativeViewProtected.setValue(index);
listPicker.nativeViewProtected.valueChangedListener.onValueChange(listPicker.android, oldIndex, index);
}
}

View File

@@ -233,4 +233,4 @@ export var test_Android_WhenSelectedIndexChangesEditTextIsUpdatedProperly = func
var actualValue = listPicker.nativeViewProtected.editText.getText().toString();
TKUnit.assertEqual(actualValue, expectedValue);
});
};
};

View File

@@ -16,4 +16,4 @@ export class ViewModel extends Observable {
});
}
}
}
}

View File

@@ -2,4 +2,4 @@
<StackLayout>
<Label text="Modal Page" />
</StackLayout>
</Page>
</Page>

View File

@@ -8,4 +8,4 @@
<TabViewItem title="Modal Second">
<Label text="tab 2" />
</TabViewItem>
</TabView>
</TabView>

View File

@@ -1,4 +1,4 @@
/* tslint:disable */
//@private
import * as android from "./page-tests.android";
import * as iOS from "./page-tests.ios";
import * as iOS from "./page-tests.ios";

View File

@@ -1,4 +1,4 @@
import { Page, View, EventData } from "tns-core-modules/ui/page";
import { Page, View, EventData } from "tns-core-modules/ui/page";
import { Label } from "tns-core-modules/ui/label";
import { topmost } from "tns-core-modules/ui/frame";
import * as TKUnit from "../../tk-unit";

View File

@@ -3,4 +3,4 @@
<Label text="In Modal Page" />
<Repeater items="{{ $value }}" verticalAlignment="top" />
</StackLayout>
</Page>
</Page>

View File

@@ -1,3 +1,3 @@
Label {
background-color: #ff00ff00;
}
}

View File

@@ -1,3 +1,3 @@
<Page>
<Label text="Label created within a page declarative file with css."/>
</Page>
</Page>

View File

@@ -1,3 +1,3 @@
Label {
background-color: #ff00ff00;
}
}

View File

@@ -52,7 +52,7 @@ export function test_placeholder_creatingView() {
}
export function test_placeholder_will_not_crash_wihout_creatingView() {
const p = new placeholderModule.Placeholder();
const p = new placeholderModule.Placeholder();
function testAction(views: Array<viewModule.View>) {
if (isIOS) {
@@ -63,4 +63,4 @@ export function test_placeholder_will_not_crash_wihout_creatingView() {
}
helper.buildUIAndRunTest(p, testAction);
}
}

View File

@@ -5,7 +5,7 @@ import * as view from "tns-core-modules/ui/core/view";
import * as platform from "tns-core-modules/platform";
import { Repeater } from "tns-core-modules/ui/repeater";
import { UITest } from "../../ui-test";
import { left, top, right, bottom, equal } from "../layouts/layout-tests-helper";
import { left, top, right, bottom, equal } from "../layouts/layout-tests-helper";
export class RepeaterSafeAreaTest extends UITest<Repeater> {

View File

@@ -12,4 +12,4 @@ exports.pageLoaded = pageLoaded;
exports.tapPage = function (args) {
console.log("Tap! " + args + " " + args.object);
};
};

View File

@@ -6,4 +6,4 @@
</GridLayout>
</Repeater.itemTemplate>
</Repeater>
</Page>
</Page>

View File

@@ -1,2 +1,4 @@
{ "name" : "MyControl",
"main" : "MyControl.js" }
{
"name": "MyControl",
"main": "MyControl.js"
}

View File

@@ -1,3 +1,3 @@
.MyStackLayoutRoot {
background-color: blue;
}
}

View File

@@ -1,2 +1,2 @@
<customControls:MyControl xmlns:customControls="ui/root-view/mymodule/" class="MyStackLayoutRoot">
</customControls:MyControl>
</customControls:MyControl>

View File

@@ -1,3 +1,3 @@
.MyStackLayoutRoot {
background-color: blue;
}
}

View File

@@ -1,3 +1,3 @@
<GridLayout class="MyStackLayoutRoot">
<Label text="I'm here!!!" id="my-test-label"/>
</GridLayout>
</GridLayout>

View File

@@ -1,3 +1,3 @@
TabView {
selected-tab-text-color: blue;
}
}

View File

@@ -14,4 +14,4 @@
</TabViewItem>
</TabView.items>
</TabView>
</TabView>

View File

@@ -14,4 +14,4 @@ export function onSubmit(args) {
var searchbar: SearchBar = <SearchBar>args.object;
console.log("Search submit result: " + searchbar.text);
}
// << searchbar-submit
// << searchbar-submit

View File

@@ -107,7 +107,8 @@ export var testSearchBarPropertiesWithCSS = function () {
TKUnit.assert(hintColorActualValue === expectedHintColor, "HintColor - Actual: " + hintColorActualValue + "; Expected: " + expectedHintColor);
TKUnit.assert(expectedTextFieldBackgroundColor === textFieldBackgroundColorActualValue, "Text Background Color - Actual: " + textFieldBackgroundColorActualValue + "; Expected: " + expectedTextFieldBackgroundColor);
TKUnit.assertAreClose(expectedFontSize, fontSizeActualValue, 0.2, "Font Size - Actual: " + fontSizeActualValue + "; Expected: " + expectedFontSize);
}, { pageCss: `
}, {
pageCss: `
SearchBar {
text-field-hint-color: blue;
text-field-background-color: red;

View File

@@ -530,4 +530,4 @@ function setNativeValue(slider: Slider, value: number) {
// setting value trough code does not send notification, so simulate that manually.
slider.ios.sendActionsForControlEvents(UIControlEvents.ValueChanged);
}
}
}

View File

@@ -1474,7 +1474,7 @@ export function test_css_calc() {
TKUnit.assertEqual(stack.width as any, 125, "Stack - width === 125");
(stack as any).style = `width: calc(100% / 2)`;
TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 0.5 }, "Stack - width === 50%");
TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 0.5 }, "Stack - width === 50%");
// This should log an error for the invalid css-calc expression, but not cause a crash
stack.className = "invalid-css-calc";
@@ -1545,7 +1545,7 @@ export function test_nested_css_calc() {
(stack as any).style = `width: calc(100% * calc(1 / 2)`;
TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 0.5 }, "Stack - width === 50%");
TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 0.5 }, "Stack - width === 50%");
}
export function test_css_variables() {
@@ -1655,7 +1655,7 @@ export function test_css_calc_and_variables() {
// Test setting the CSS variable via the style-attribute, this should override any value set via css-class
(stack as any).style = `${cssVarName}: 0.5`;
TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 0.5 }, "Stack - width === 50%");
TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 0.5 }, "Stack - width === 50%");
}
export function test_css_variable_fallback() {
@@ -1796,10 +1796,10 @@ export function test_nested_css_calc_and_variables() {
// Test setting the CSS variable via the style-attribute, this should override any value set via css-class
stack.className = "wide";
(stack as any).style = `${cssVarName}: 0.25`;
TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 0.5 }, "Stack - width === 50%");
TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 0.5 }, "Stack - width === 50%");
stack.className = "nested";
TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 1 }, "Stack - width === 100%");
TKUnit.assertDeepEqual(stack.width, { unit: "%", value: 1 }, "Stack - width === 100%");
}
export function test_css_variable_is_applied_to_normal_properties() {

View File

@@ -17,4 +17,4 @@ previous_url: ApiReference/ui/styling/HOW-TO
{%snippet article-using-id-selector%}
### Using state selector
{%snippet article-using-state-selector%}
For information and example how to use style properties please refer to special [**Styling**](../../../styling.md) topic.
For information and example how to use style properties please refer to special [**Styling**](../../../styling.md) topic.

View File

@@ -1 +1,3 @@
page { background-color: red; }
page {
background-color: red;
}

View File

@@ -38,4 +38,4 @@ export function getOriginalFont(tabView: TabView): any {
typeface: tv.getTypeface(),
size: tv.getTextSize()
};
}
}

View File

@@ -5,4 +5,4 @@ export function getNativeTabCount(tabView: TabView): number;
export function selectNativeTab(tabView: TabView, index: number): void;
export function getNativeSelectedIndex(tabView: TabView): number;
export function getNativeFont(tabView: TabView): any;
export function getOriginalFont(tabView: TabView): any;
export function getOriginalFont(tabView: TabView): any;

View File

@@ -10,8 +10,8 @@ The TabView is a component, which allows to navigate between different views. Th
> Note (iOS specific): `UITabBarController` is used in the implementation, which means that only one `TabViewItem` can be shown at a given time and only one needs to be loaded. When the user selects a new `TabViewItem`, we load the new item and unload the previous one.
> Note (Android specific): In the Android implementation is used `ViewPager` controller, which allows using the `swipe` gesture to navigate to the next or previous tab. This means that only one `TabViewItem` can be shown, but multiple `TabViewItems` need to be loaded. Otherwise, after left or right swipe, you will not see the `TabViewItem`'s contents, after the swiping. By default, the ViewPager controller will pre-load one `TabViewItem` on the left and on on the right. Regarding that, if one of the items is already pre-loaded, it will not be loaded again. In the Android, we have exposed a property called `androidOffscreenTabLimit`, which allow specifying, how many components should be pre-load on the left and right (if you are setting up `androidOffscreenTabLimit` to 0, the Android TabView will match to the iOS TabView).
> Note (Android specific): In the Android implementation is used `ViewPager` controller, which allows using the `swipe` gesture to navigate to the next or previous tab. This means that only one `TabViewItem` can be shown, but multiple `TabViewItems` need to be loaded. Otherwise, after left or right swipe, you will not see the `TabViewItem`'s contents, after the swiping. By default, the ViewPager controller will pre-load one `TabViewItem` on the left and on on the right. Regarding that, if one of the items is already pre-loaded, it will not be loaded again. In the Android, we have exposed a property called `androidOffscreenTabLimit`, which allow specifying, how many components should be pre-load on the left and right (if you are setting up `androidOffscreenTabLimit` to 0, the Android TabView will match to the iOS TabView).
The iOS and Android UX guidelines regarding the Tab controls differ greatly. The difference is described in the below points:
* The iOS tabs have their tab bar, which will be displayed always on the bottom and does not allow swipe gesture for changing tabs.
@@ -53,7 +53,7 @@ export function onSelectedIndexChanged(args) {...}
## Styling TabView
For the TabView component could be set three different styling properties
For the TabView component could be set three different styling properties
* `selectedTabTextColor` (coresponding CSS property `selected-tab-text-color`) - change the color of the text, while selecting some of the tabs.
* `tabBackgroundColor` (coresponding CSS property `tab-background-color`) - changing the background of the tabs.

View File

@@ -37,4 +37,4 @@ export function getOriginalFont(tabView: BottomNavigation): any {
typeface: tv.getTypeface(),
size: tv.getTextSize()
};
}
}

View File

@@ -5,4 +5,4 @@ export function getNativeTabCount(tabView: TabView): number;
export function selectNativeTab(tabView: TabView, index: number): void;
export function getNativeSelectedIndex(tabView: TabView): number;
export function getNativeFont(tabView: TabView): any;
export function getOriginalFont(tabView: TabView): any;
export function getOriginalFont(tabView: TabView): any;

View File

@@ -40,4 +40,4 @@ export function getNativeFont(tabView: Tabs): UIFont {
export function getOriginalFont(tabView: Tabs): UIFont {
return tabView.style.fontInternal.getUIFont(UIFont.systemFontOfSize(10));
}
}

View File

@@ -2,5 +2,5 @@
export function pageLoaded(args) {
var page = <pages.Page>args.object;
page.bindingContext = { var0: 0, var1: 1};
page.bindingContext = { var0: 0, var1: 1 };
}

View File

@@ -2,5 +2,5 @@
export function pageLoaded(args) {
var page = <pages.Page>args.object;
page.bindingContext = { varStr: "5", varNum: 3, varTrue: true, varText: "Text"};
page.bindingContext = { varStr: "5", varNum: 3, varTrue: true, varText: "Text" };
}

View File

@@ -46,7 +46,7 @@ export function getNativeTextAlignment(textField: textFieldModule.TextField): st
export function typeTextNatively(textField: textFieldModule.TextField, text: string): void {
textField.ios.text = text;
// Setting the text will not trigger the delegate method, so we have to do it by hand.
textField.ios.delegate.textFieldDidEndEditing(textField.ios);
}

View File

@@ -34,4 +34,4 @@ Using a TextField requires the text-field module.
```
<TextField autocorrect="false" hint="Setting Max text length(max 3 characters)" maxLength="3" />
<TextField autocorrect="false" hint="Setting Max text length(max 3 characters) with secure='true'" maxLength="3" secure="true" />
```
```

View File

@@ -47,7 +47,7 @@ export function getNativeTextAlignment(textView: textViewModule.TextView): strin
export function typeTextNatively(textView: textViewModule.TextView, text: string): void {
textView.ios.text = text;
// Setting the text will not trigger the delegate method, so we have to do it by hand.
textView.ios.delegate.textViewDidEndEditing(textView.ios);
}

View File

@@ -27,10 +27,10 @@ import * as observable from "tns-core-modules/data/observable";
// << text-view-xml
// >> observable-declare
export function pageLoaded(args) {
let page = args.object;
let obj = new observable.Observable();
obj.set("someProperty", "Please change this text!");
page.bindingContext = obj;
let page = args.object;
let obj = new observable.Observable();
obj.set("someProperty", "Please change this text!");
page.bindingContext = obj;
}
exports.pageLoaded = pageLoaded;
// << observable-declare

View File

@@ -1,10 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<title>MyTitle</title>
<meta charset="utf-8" />
<meta charset="utf-8" />
</head>
<body>
<span style="color:red">TestÖ</span>
</body>
</html>

View File

@@ -21,4 +21,4 @@ export function webViewLoaded(args) {
webview.android.getSettings().setDisplayZoomControls(false);
}
}
// << web-view-loaded
// << web-view-loaded

View File

@@ -34,4 +34,4 @@ Using a WebView requires the web-view module.
{%snippet web-view-loaded%}
>Note: to be able to use gestures in `WebView` component on Android, we should first disabled the zoom control. To do that we could access the `android` property and with the help of `setDisplayZoomControls` to set this controll to `false`.
>Note: to be able to use gestures in `WebView` component on Android, we should first disabled the zoom control. To do that we could access the `android` property and with the help of `setDisplayZoomControls` to set this controll to `false`.