mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-26 21:00:16 +08:00
chore(tslint): update tslint rules and fix errors (#5747)
* chore(tslint): fix tslint config & errors * chore(tslint): enable double quotes, whitespace, and arrow-return-shorthand rules and fix errors
This commit is contained in:
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -6,5 +6,6 @@
|
||||
"**/platforms": true,
|
||||
"**/*.js": true,
|
||||
"**/*.js.map": true
|
||||
}
|
||||
},
|
||||
"tslint.configFile": "./build/tslint.json"
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
import {EventData as ObservableEventData} from "tns-core-modules/data/observable";
|
||||
import {EventData as ObservableEventData } from "tns-core-modules/data/observable";
|
||||
|
||||
export function navigatedTo(args: ObservableEventData) {
|
||||
setTimeout(() => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Page} from "tns-core-modules/ui/page";
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
|
||||
export function onTap(args: any) {
|
||||
(<any>global).startTime = (<any>global).time();
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {EventData as ObservableEventData} from "tns-core-modules/data/observable";
|
||||
import {Page} from "tns-core-modules/ui/page";
|
||||
import {ItemEventData as ListViewItemEventData} from "tns-core-modules/ui/list-view";
|
||||
import {topmost as topmostFrame} from "tns-core-modules/ui/frame";
|
||||
import {AppViewModel} from "./reddit-app-view-model";
|
||||
import {EventData as ObservableEventData } from "tns-core-modules/data/observable";
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
import {ItemEventData as ListViewItemEventData } from "tns-core-modules/ui/list-view";
|
||||
import {topmost as topmostFrame } from "tns-core-modules/ui/frame";
|
||||
import { AppViewModel } from "./reddit-app-view-model";
|
||||
|
||||
var appViewModel = new AppViewModel();
|
||||
|
||||
|
@ -30,7 +30,7 @@ export function navigate() {
|
||||
frame.topmost().navigate("gallery-app/main-page");
|
||||
}
|
||||
|
||||
export function change(args){
|
||||
export function change(args) {
|
||||
args.object.text = "hi " + Math.random();
|
||||
|
||||
}
|
@ -26,7 +26,7 @@ export function onTap3(args: EventData) {
|
||||
}
|
||||
|
||||
function closeModal() {
|
||||
console.log('closeModal Called');
|
||||
console.log("closeModal Called");
|
||||
}
|
||||
|
||||
export function sync(args: EventData) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { View, EventData } from "tns-core-modules/ui/core/view";
|
||||
|
||||
const colors = ['red', 'orange', 'magenta'];
|
||||
const colors = ["red", "orange", "magenta"];
|
||||
let x = 0;
|
||||
|
||||
export function onLoaded(args) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { EventData } from 'tns-core-modules/data/observable';
|
||||
import { Page, NavigatedData } from 'tns-core-modules/ui/page';
|
||||
import { topmost, NavigationEntry } from 'tns-core-modules/ui/frame';
|
||||
import { EventData } from "tns-core-modules/data/observable";
|
||||
import { Page, NavigatedData } from "tns-core-modules/ui/page";
|
||||
import { topmost, NavigationEntry } from "tns-core-modules/ui/frame";
|
||||
|
||||
export function nav() {
|
||||
const e: NavigationEntry = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {TabView} from "tns-core-modules/ui/tab-view";
|
||||
import { TabView } from "tns-core-modules/ui/tab-view";
|
||||
import * as utils from "tns-core-modules/utils/utils";
|
||||
|
||||
const titles = ["Etiam lacinia", "Imperdiet ante", "A interdum", "Quisque tempus", "Sodales viverra"];
|
||||
|
@ -4,7 +4,7 @@ import { Label } from "tns-core-modules/ui/label";
|
||||
|
||||
const average = 3;
|
||||
const noValue = "noValue";
|
||||
const colors = ['red', 'green'];
|
||||
const colors = ["red", "green"];
|
||||
|
||||
export function addRemove(counts: Array<number>, parent: LayoutBase): string {
|
||||
let result = `addRemove`;
|
||||
@ -29,7 +29,7 @@ export function addRemove(counts: Array<number>, parent: LayoutBase): string {
|
||||
}
|
||||
|
||||
export function setText(counts: Array<number>, parent?: LayoutBase): string {
|
||||
let result = `setText ${parent ? 'with nativeView' : ''}`;
|
||||
let result = `setText ${parent ? "with nativeView" : ""}`;
|
||||
counts.forEach((count) => {
|
||||
const lbl = setup(parent);
|
||||
const time = executeTest(() => {
|
||||
@ -44,7 +44,7 @@ export function setText(counts: Array<number>, parent?: LayoutBase): string {
|
||||
}
|
||||
|
||||
export function setBackgroundColor(counts: Array<number>, parent?: LayoutBase): string {
|
||||
let result = `setBackgroundColor ${parent ? 'with nativeView' : ''}`;
|
||||
let result = `setBackgroundColor ${parent ? "with nativeView" : ""}`;
|
||||
counts.forEach((count) => {
|
||||
if (parent && count > 10000) {
|
||||
result += setResultTime(noValue);
|
||||
@ -66,7 +66,7 @@ export function setBackgroundColor(counts: Array<number>, parent?: LayoutBase):
|
||||
|
||||
const borders = [1, 2, 3];
|
||||
export function setBorderWidths(counts: Array<number>, parent?: LayoutBase): string {
|
||||
let result = `setBorderWidths ${parent ? 'with nativeView' : ''}`;
|
||||
let result = `setBorderWidths ${parent ? "with nativeView" : ""}`;
|
||||
counts.forEach((count) => {
|
||||
if (count > 10000 && parent) {
|
||||
result += setResultTime(noValue);
|
||||
@ -90,7 +90,7 @@ export function setBorderWidths(counts: Array<number>, parent?: LayoutBase): str
|
||||
}
|
||||
|
||||
export function setColor(counts: Array<number>, parent?: LayoutBase): string {
|
||||
let result = `setColor ${parent ? 'with nativeView' : ''}`;
|
||||
let result = `setColor ${parent ? "with nativeView" : ""}`;
|
||||
counts.forEach((count) => {
|
||||
const lbl = setup(parent);
|
||||
const style = lbl.style;
|
||||
@ -128,7 +128,7 @@ export function setColorWithParents(counts: Array<number>, parent: LayoutBase):
|
||||
|
||||
const fontSizes = [10, 20];
|
||||
export function setFontSize(counts: Array<number>, parent?: LayoutBase): string {
|
||||
let result = `setFontSize ${parent ? 'with nativeView' : ''}`;
|
||||
let result = `setFontSize ${parent ? "with nativeView" : ""}`;
|
||||
counts.forEach((count) => {
|
||||
const lbl = setup(parent);
|
||||
const style = lbl.style;
|
||||
@ -165,13 +165,13 @@ export function setFontSizeWithParents(counts: Array<number>, parent: LayoutBase
|
||||
}
|
||||
|
||||
export function setFontWeight(counts: Array<number>, parent?: LayoutBase): string {
|
||||
let result = `setFontWeight ${parent ? 'with nativeView' : ''}`;
|
||||
let result = `setFontWeight ${parent ? "with nativeView" : ""}`;
|
||||
counts.forEach((count) => {
|
||||
const lbl = setup(parent);
|
||||
const style = lbl.style;
|
||||
const time = executeTest(() => {
|
||||
for (let i = 0; i < count; i++) {
|
||||
style.fontWeight = i % 2 === 0 ? 'bold' : 'normal';
|
||||
style.fontWeight = i % 2 === 0 ? "bold" : "normal";
|
||||
}
|
||||
});
|
||||
result += setResultTime(time);
|
||||
@ -192,7 +192,7 @@ export function setFontWeightWithParents(counts: Array<number>, parent: LayoutBa
|
||||
setupParents(parent);
|
||||
const time = executeTest(() => {
|
||||
for (let i = 0; i < count; i++) {
|
||||
style.fontWeight = i % 2 === 0 ? 'bold' : 'normal'
|
||||
style.fontWeight = i % 2 === 0 ? "bold" : "normal"
|
||||
}
|
||||
});
|
||||
result += setResultTime(time);
|
||||
@ -202,7 +202,7 @@ export function setFontWeightWithParents(counts: Array<number>, parent: LayoutBa
|
||||
}
|
||||
|
||||
export function setBindingContext(counts: Array<number>, parent?: LayoutBase): string {
|
||||
let result = `setBindingContext ${parent ? 'with nativeView' : ''}`;
|
||||
let result = `setBindingContext ${parent ? "with nativeView" : ""}`;
|
||||
counts.forEach((count) => {
|
||||
const lbl = setup(parent);
|
||||
const time = executeTest(() => {
|
||||
|
@ -56,7 +56,7 @@ export function onTap(args) {
|
||||
result.text += line + "\n";
|
||||
}
|
||||
|
||||
let text = '';//"Count";
|
||||
let text = ""; //"Count";
|
||||
// c.forEach(e => {
|
||||
// text += `\t${e}`;
|
||||
// });
|
||||
|
@ -1,40 +1,40 @@
|
||||
import { time } from 'tns-core-modules/profiling';
|
||||
import { ActionBar } from 'tns-core-modules/ui/action-bar';
|
||||
import { ActivityIndicator } from 'tns-core-modules/ui/activity-indicator';
|
||||
import { Border } from 'tns-core-modules/ui/border';
|
||||
import { Button } from 'tns-core-modules/ui/button';
|
||||
import { ContentView } from 'tns-core-modules/ui/content-view';
|
||||
import { DatePicker } from 'tns-core-modules/ui/date-picker';
|
||||
import { HtmlView } from 'tns-core-modules/ui/html-view';
|
||||
import { Image } from 'tns-core-modules/ui/image';
|
||||
import { Label } from 'tns-core-modules/ui/label';
|
||||
import { AbsoluteLayout } from 'tns-core-modules/ui/layouts/absolute-layout';
|
||||
import { DockLayout } from 'tns-core-modules/ui/layouts/dock-layout';
|
||||
import { FlexboxLayout } from 'tns-core-modules/ui/layouts/flexbox-layout';
|
||||
import { GridLayout } from 'tns-core-modules/ui/layouts/grid-layout';
|
||||
import { StackLayout } from 'tns-core-modules/ui/layouts/stack-layout';
|
||||
import { WrapLayout } from 'tns-core-modules/ui/layouts/wrap-layout';
|
||||
import { ListPicker } from 'tns-core-modules/ui/list-picker';
|
||||
import { ListView } from 'tns-core-modules/ui/list-view';
|
||||
import { Page } from 'tns-core-modules/ui/page';
|
||||
import { Progress } from 'tns-core-modules/ui/progress';
|
||||
import { Repeater } from 'tns-core-modules/ui/repeater';
|
||||
import { SegmentedBar } from 'tns-core-modules/ui/segmented-bar';
|
||||
import { Switch } from 'tns-core-modules/ui/switch';
|
||||
import { TabView } from 'tns-core-modules/ui/tab-view';
|
||||
import { TextField } from 'tns-core-modules/ui/text-field';
|
||||
import { TextView } from 'tns-core-modules/ui/text-view';
|
||||
import { TimePicker } from 'tns-core-modules/ui/time-picker';
|
||||
import { View } from 'tns-core-modules/ui/core/view';
|
||||
import { FormattedString, Span } from 'tns-core-modules/text/formatted-string';
|
||||
import { _getProperties, _getStyleProperties } from 'tns-core-modules/ui/core/properties';
|
||||
import { time } from "tns-core-modules/profiling";
|
||||
import { ActionBar } from "tns-core-modules/ui/action-bar";
|
||||
import { ActivityIndicator } from "tns-core-modules/ui/activity-indicator";
|
||||
import { Border } from "tns-core-modules/ui/border";
|
||||
import { Button } from "tns-core-modules/ui/button";
|
||||
import { ContentView } from "tns-core-modules/ui/content-view";
|
||||
import { DatePicker } from "tns-core-modules/ui/date-picker";
|
||||
import { HtmlView } from "tns-core-modules/ui/html-view";
|
||||
import { Image } from "tns-core-modules/ui/image";
|
||||
import { Label } from "tns-core-modules/ui/label";
|
||||
import { AbsoluteLayout } from "tns-core-modules/ui/layouts/absolute-layout";
|
||||
import { DockLayout } from "tns-core-modules/ui/layouts/dock-layout";
|
||||
import { FlexboxLayout } from "tns-core-modules/ui/layouts/flexbox-layout";
|
||||
import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout";
|
||||
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
|
||||
import { WrapLayout } from "tns-core-modules/ui/layouts/wrap-layout";
|
||||
import { ListPicker } from "tns-core-modules/ui/list-picker";
|
||||
import { ListView } from "tns-core-modules/ui/list-view";
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
import { Progress } from "tns-core-modules/ui/progress";
|
||||
import { Repeater } from "tns-core-modules/ui/repeater";
|
||||
import { SegmentedBar } from "tns-core-modules/ui/segmented-bar";
|
||||
import { Switch } from "tns-core-modules/ui/switch";
|
||||
import { TabView } from "tns-core-modules/ui/tab-view";
|
||||
import { TextField } from "tns-core-modules/ui/text-field";
|
||||
import { TextView } from "tns-core-modules/ui/text-view";
|
||||
import { TimePicker } from "tns-core-modules/ui/time-picker";
|
||||
import { View } from "tns-core-modules/ui/core/view";
|
||||
import { FormattedString, Span } from "tns-core-modules/text/formatted-string";
|
||||
import { _getProperties, _getStyleProperties } from "tns-core-modules/ui/core/properties";
|
||||
declare var __startCPUProfiler;
|
||||
declare var __stopCPUProfiler;
|
||||
|
||||
const count = 200;
|
||||
export function testSetup(layout: StackLayout): string {
|
||||
setupSetters();
|
||||
return '';
|
||||
return "";
|
||||
}
|
||||
|
||||
export function testFlexboxLayout(layout: StackLayout): string {
|
||||
@ -133,47 +133,47 @@ function test(layout: StackLayout, createView: () => View, count: number): strin
|
||||
const viewMap1 = new Map<string, any>();
|
||||
const cssMap1 = new Map<string, any>();
|
||||
|
||||
viewMap1.set('isEnabled', false);
|
||||
viewMap1.set("isEnabled", false);
|
||||
let result = execute(layout, createView, count, viewMap1, cssMap1)
|
||||
|
||||
viewMap1.set('text', 'text');
|
||||
viewMap1.set('automationText', "automationText");
|
||||
cssMap1.set('width', 100);
|
||||
cssMap1.set('height', 100);
|
||||
cssMap1.set('rotate', '90');
|
||||
viewMap1.set("text", "text");
|
||||
viewMap1.set("automationText", "automationText");
|
||||
cssMap1.set("width", 100);
|
||||
cssMap1.set("height", 100);
|
||||
cssMap1.set("rotate", "90");
|
||||
result += execute(layout, createView, count, viewMap1, cssMap1)
|
||||
|
||||
viewMap1.set('clipToBounds', false);
|
||||
viewMap1.set('left', '20');
|
||||
viewMap1.set('top', '20');
|
||||
viewMap1.set('dock', 'top');
|
||||
viewMap1.set('stretchLastChild', false);
|
||||
viewMap1.set("clipToBounds", false);
|
||||
viewMap1.set("left", "20");
|
||||
viewMap1.set("top", "20");
|
||||
viewMap1.set("dock", "top");
|
||||
viewMap1.set("stretchLastChild", false);
|
||||
|
||||
cssMap1.set('paddingLeft', '30px');
|
||||
cssMap1.set('paddingTop', '30px');
|
||||
cssMap1.set('paddingRight', '30px');
|
||||
cssMap1.set('paddingBottom', '30px');
|
||||
cssMap1.set('horizontalAlignment', 'center');
|
||||
cssMap1.set('verticalAlignment', 'center');
|
||||
cssMap1.set("paddingLeft", "30px");
|
||||
cssMap1.set("paddingTop", "30px");
|
||||
cssMap1.set("paddingRight", "30px");
|
||||
cssMap1.set("paddingBottom", "30px");
|
||||
cssMap1.set("horizontalAlignment", "center");
|
||||
cssMap1.set("verticalAlignment", "center");
|
||||
|
||||
result += execute(layout, createView, count, viewMap1, cssMap1)
|
||||
|
||||
viewMap1.set('row', '1');
|
||||
viewMap1.set('rowSpan', '2');
|
||||
viewMap1.set('col', '1');
|
||||
viewMap1.set('colSpan', '2');
|
||||
viewMap1.set("row", "1");
|
||||
viewMap1.set("rowSpan", "2");
|
||||
viewMap1.set("col", "1");
|
||||
viewMap1.set("colSpan", "2");
|
||||
|
||||
cssMap1.set('rotate', '90');
|
||||
cssMap1.set('scaleX', 2);
|
||||
cssMap1.set('scaleY', 2);
|
||||
cssMap1.set('translateX', 20);
|
||||
cssMap1.set('translateY', 20);
|
||||
cssMap1.set('clipPath', 'inset(100px 50px)');
|
||||
cssMap1.set('color', 'red');
|
||||
cssMap1.set('tintColor', 'green');
|
||||
cssMap1.set('placeholderColor', 'green');
|
||||
cssMap1.set('backgroundColor', 'red');
|
||||
cssMap1.set('backgroundImage', '~/logo.png');
|
||||
cssMap1.set("rotate", "90");
|
||||
cssMap1.set("scaleX", 2);
|
||||
cssMap1.set("scaleY", 2);
|
||||
cssMap1.set("translateX", 20);
|
||||
cssMap1.set("translateY", 20);
|
||||
cssMap1.set("clipPath", "inset(100px 50px)");
|
||||
cssMap1.set("color", "red");
|
||||
cssMap1.set("tintColor", "green");
|
||||
cssMap1.set("placeholderColor", "green");
|
||||
cssMap1.set("backgroundColor", "red");
|
||||
cssMap1.set("backgroundImage", "~/logo.png");
|
||||
|
||||
result += execute(layout, createView, count, viewMap1, cssMap1)
|
||||
result += execute(layout, createView, count, setters, cssSetters);
|
||||
@ -214,10 +214,10 @@ function profile(layout: StackLayout, createView: () => View, count: number, rec
|
||||
viewProps: Map<string, any>, cssProps: Map<string, any>): { time: number, count: number } {
|
||||
|
||||
const view = createView();
|
||||
view.recycleNativeView = recycle ? 'always' : 'never';
|
||||
view.recycleNativeView = recycle ? "always" : "never";
|
||||
const style = view.style;
|
||||
// DatePicker throws OOM
|
||||
const c = view.typeName === 'DatePicker' ? 1 : 5;
|
||||
const c = view.typeName === "DatePicker" ? 1 : 5;
|
||||
let total = 0;
|
||||
let x = 0;
|
||||
for (let i = 0; i < c; i++) {
|
||||
@ -260,125 +260,125 @@ function setupSetters(): void {
|
||||
|
||||
setters = new Map<string, any>();
|
||||
// view-base
|
||||
setters.set('id', "someId");
|
||||
setters.set('className', "someClassName");
|
||||
setters.set('bindingContext', "someBindingContext");
|
||||
setters.set("id", "someId");
|
||||
setters.set("className", "someClassName");
|
||||
setters.set("bindingContext", "someBindingContext");
|
||||
|
||||
// view
|
||||
setters.set('automationText', "automationText");
|
||||
setters.set('originX', 0.2);
|
||||
setters.set('originY', 0.2);
|
||||
setters.set('isEnabled', false);
|
||||
setters.set('isUserInteractionEnabled', false);
|
||||
setters.set("automationText", "automationText");
|
||||
setters.set("originX", 0.2);
|
||||
setters.set("originY", 0.2);
|
||||
setters.set("isEnabled", false);
|
||||
setters.set("isUserInteractionEnabled", false);
|
||||
|
||||
// action-bar
|
||||
setters.set('title', 'title');
|
||||
setters.set('text', 'text');
|
||||
setters.set('icon', '~/logo.png');
|
||||
setters.set('visibility', 'collapse');
|
||||
setters.set("title", "title");
|
||||
setters.set("text", "text");
|
||||
setters.set("icon", "~/logo.png");
|
||||
setters.set("visibility", "collapse");
|
||||
|
||||
// activity-indicator
|
||||
setters.set('busy', true);
|
||||
setters.set("busy", true);
|
||||
|
||||
// date-picker
|
||||
setters.set('year', '2010');
|
||||
setters.set('month', '2');
|
||||
setters.set('day', '2');
|
||||
setters.set('maxDate', '2100');
|
||||
setters.set('minDate', '2000');
|
||||
setters.set('date', new Date(2011, 3, 3));
|
||||
setters.set("year", "2010");
|
||||
setters.set("month", "2");
|
||||
setters.set("day", "2");
|
||||
setters.set("maxDate", "2100");
|
||||
setters.set("minDate", "2000");
|
||||
setters.set("date", new Date(2011, 3, 3));
|
||||
|
||||
// editable-text
|
||||
setters.set('keyboardType', 'datetime');
|
||||
setters.set('returnKeyType', 'done');
|
||||
setters.set('editable', false);
|
||||
setters.set('updateTextTrigger', 'focusLost');
|
||||
setters.set('autocapitalizationType', 'words');
|
||||
setters.set('autocorrect', true);
|
||||
setters.set('hint', 'hint');
|
||||
setters.set('maxLength', '10');
|
||||
setters.set("keyboardType", "datetime");
|
||||
setters.set("returnKeyType", "done");
|
||||
setters.set("editable", false);
|
||||
setters.set("updateTextTrigger", "focusLost");
|
||||
setters.set("autocapitalizationType", "words");
|
||||
setters.set("autocorrect", true);
|
||||
setters.set("hint", "hint");
|
||||
setters.set("maxLength", "10");
|
||||
|
||||
// html-view
|
||||
setters.set('html', '<a></a>');
|
||||
setters.set("html", "<a></a>");
|
||||
|
||||
// image-view
|
||||
setters.set('imageSource', '');
|
||||
setters.set('src', '');
|
||||
setters.set('loadMode', 'async');
|
||||
setters.set('isLoading', true);
|
||||
setters.set('stretch', 'none');
|
||||
setters.set("imageSource", "");
|
||||
setters.set("src", "");
|
||||
setters.set("loadMode", "async");
|
||||
setters.set("isLoading", true);
|
||||
setters.set("stretch", "none");
|
||||
|
||||
// layout-base
|
||||
setters.set('clipToBounds', false);
|
||||
setters.set("clipToBounds", false);
|
||||
|
||||
// absolute-layout
|
||||
setters.set('left', '20');
|
||||
setters.set('top', '20');
|
||||
setters.set("left", "20");
|
||||
setters.set("top", "20");
|
||||
|
||||
// dock-layout
|
||||
setters.set('dock', 'top');
|
||||
setters.set('stretchLastChild', false);
|
||||
setters.set("dock", "top");
|
||||
setters.set("stretchLastChild", false);
|
||||
|
||||
// grid-layout props
|
||||
setters.set('row', '1');
|
||||
setters.set('rowSpan', '2');
|
||||
setters.set('col', '1');
|
||||
setters.set('colSpan', '2');
|
||||
setters.set("row", "1");
|
||||
setters.set("rowSpan", "2");
|
||||
setters.set("col", "1");
|
||||
setters.set("colSpan", "2");
|
||||
|
||||
// stack-layout
|
||||
setters.set('orientation', 'horizontal');
|
||||
setters.set("orientation", "horizontal");
|
||||
|
||||
// wrap-layout
|
||||
// custom orientation value
|
||||
// setters.set('orientation', 'vertical');
|
||||
setters.set('itemWidth', '50');
|
||||
setters.set('itemHeight', '50');
|
||||
setters.set("itemWidth", "50");
|
||||
setters.set("itemHeight", "50");
|
||||
|
||||
// list-picker
|
||||
setters.set('items', ['1', '2', '3']);
|
||||
setters.set('selectedIndex', '1');
|
||||
setters.set("items", ["1", "2", "3"]);
|
||||
setters.set("selectedIndex", "1");
|
||||
|
||||
// list-view
|
||||
setters.set('items', ['1', '2', '3']);
|
||||
setters.set('itemTemplate', '<Label text="{{ $value }}" />');
|
||||
setters.set('itemTemplates', '<template key="green"><Label text="{{ $value }}" style.backgroundColor="green" /></template><template key="red"><Label text="{{ $value }}" style.backgroundColor="red" /></template>');
|
||||
setters.set('rowHeight', '50');
|
||||
setters.set("items", ["1", "2", "3"]);
|
||||
setters.set("itemTemplate", "<Label text=\"{{ $value }}\" />");
|
||||
setters.set("itemTemplates", "<template key=\"green\"><Label text=\"{{ $value }}\" style.backgroundColor=\"green\" /></template><template key=\"red\"><Label text=\"{{ $value }}\" style.backgroundColor=\"red\" /></template>");
|
||||
setters.set("rowHeight", "50");
|
||||
|
||||
// page
|
||||
setters.set('actionBarHidden', 'true');
|
||||
setters.set('backgroundSpanUnderStatusBar', 'true');
|
||||
setters.set('enableSwipeBackNavigation', 'false');
|
||||
setters.set("actionBarHidden", "true");
|
||||
setters.set("backgroundSpanUnderStatusBar", "true");
|
||||
setters.set("enableSwipeBackNavigation", "false");
|
||||
|
||||
// progress
|
||||
setters.set('value', '1');
|
||||
setters.set('maxValue', '99');
|
||||
setters.set("value", "1");
|
||||
setters.set("maxValue", "99");
|
||||
|
||||
// repeater
|
||||
setters.set('items', ['1', '2', '3']);
|
||||
setters.set('itemTemplate', '<Label text="{{ $value }}" />');
|
||||
setters.set("items", ["1", "2", "3"]);
|
||||
setters.set("itemTemplate", "<Label text=\"{{ $value }}\" />");
|
||||
// setters.set('itemsLayout', new StackLayout());
|
||||
setters.set('rowHeight', '50');
|
||||
setters.set("rowHeight", "50");
|
||||
|
||||
// scroll-view
|
||||
// custom orientation value
|
||||
//setters.set('orientation', 'horizontal');
|
||||
|
||||
// search-bar
|
||||
setters.set('textFieldHintColor', 'red');
|
||||
setters.set('textFieldBackgroundColor', 'red');
|
||||
setters.set("textFieldHintColor", "red");
|
||||
setters.set("textFieldBackgroundColor", "red");
|
||||
|
||||
// segmented-bar
|
||||
// custom items property
|
||||
|
||||
// slider
|
||||
setters.set('minValue', '5');
|
||||
setters.set("minValue", "5");
|
||||
|
||||
// switch
|
||||
setters.set('checked', 'true');
|
||||
setters.set("checked", "true");
|
||||
|
||||
// tab-view
|
||||
// custom items property
|
||||
setters.set('androidOffscreenTabLimit', '2');
|
||||
setters.set("androidOffscreenTabLimit", "2");
|
||||
|
||||
// text-base
|
||||
// const formattedText = new FormattedString();
|
||||
@ -388,105 +388,105 @@ function setupSetters(): void {
|
||||
// setters.set('formattedText', formattedText);
|
||||
|
||||
// text-base
|
||||
setters.set('secure', 'true');
|
||||
setters.set("secure", "true");
|
||||
|
||||
// time-picker
|
||||
setters.set('minHour', 1);
|
||||
setters.set('hour', 2);
|
||||
setters.set('maxHour', 11);
|
||||
setters.set('minMinute', 1);
|
||||
setters.set('minute', 2);
|
||||
setters.set('maxMinute', 11);
|
||||
setters.set('minuteInterval', 2);
|
||||
setters.set('time', new Date(2011, 2, 2, 3, 3, 3));
|
||||
setters.set("minHour", 1);
|
||||
setters.set("hour", 2);
|
||||
setters.set("maxHour", 11);
|
||||
setters.set("minMinute", 1);
|
||||
setters.set("minute", 2);
|
||||
setters.set("maxMinute", 11);
|
||||
setters.set("minuteInterval", 2);
|
||||
setters.set("time", new Date(2011, 2, 2, 3, 3, 3));
|
||||
|
||||
cssSetters = new Map<string, any>();
|
||||
|
||||
// style
|
||||
cssSetters.set('rotate', '90');
|
||||
cssSetters.set('scaleX', 2);
|
||||
cssSetters.set('scaleY', 2);
|
||||
cssSetters.set('translateX', 20);
|
||||
cssSetters.set('translateY', 20);
|
||||
cssSetters.set("rotate", "90");
|
||||
cssSetters.set("scaleX", 2);
|
||||
cssSetters.set("scaleY", 2);
|
||||
cssSetters.set("translateX", 20);
|
||||
cssSetters.set("translateY", 20);
|
||||
|
||||
cssSetters.set('clipPath', 'inset(100px 50px)');
|
||||
cssSetters.set('color', 'red');
|
||||
cssSetters.set('tintColor', 'green');
|
||||
cssSetters.set('placeholderColor', 'green');
|
||||
cssSetters.set("clipPath", "inset(100px 50px)");
|
||||
cssSetters.set("color", "red");
|
||||
cssSetters.set("tintColor", "green");
|
||||
cssSetters.set("placeholderColor", "green");
|
||||
|
||||
cssSetters.set('backgroundColor', 'red');
|
||||
cssSetters.set('backgroundImage', '~/logo.png');
|
||||
cssSetters.set('backgroundRepeat', 'repeat');
|
||||
cssSetters.set('backgroundSize', '60px 120px');
|
||||
cssSetters.set('backgroundPosition', 'center');
|
||||
cssSetters.set('borderColor', 'blue');
|
||||
cssSetters.set('borderTopColor', 'green');
|
||||
cssSetters.set('borderRightColor', 'green');
|
||||
cssSetters.set('borderBottomColor', 'green');
|
||||
cssSetters.set('borderLeftColor', 'green');
|
||||
cssSetters.set('borderWidth', '10px');
|
||||
cssSetters.set('borderTopWidth', '5px');
|
||||
cssSetters.set('borderRightWidth', '5px');
|
||||
cssSetters.set('borderBottomWidth', '5px');
|
||||
cssSetters.set('borderLeftWidth', '5px');
|
||||
cssSetters.set('borderRadius', '10px');
|
||||
cssSetters.set('borderTopLeftRadius', '5px');
|
||||
cssSetters.set('borderTopRightRadius', '5px');
|
||||
cssSetters.set('borderBottomRightRadius', '5px');
|
||||
cssSetters.set('borderBottomLeftRadius', '5px');
|
||||
cssSetters.set("backgroundColor", "red");
|
||||
cssSetters.set("backgroundImage", "~/logo.png");
|
||||
cssSetters.set("backgroundRepeat", "repeat");
|
||||
cssSetters.set("backgroundSize", "60px 120px");
|
||||
cssSetters.set("backgroundPosition", "center");
|
||||
cssSetters.set("borderColor", "blue");
|
||||
cssSetters.set("borderTopColor", "green");
|
||||
cssSetters.set("borderRightColor", "green");
|
||||
cssSetters.set("borderBottomColor", "green");
|
||||
cssSetters.set("borderLeftColor", "green");
|
||||
cssSetters.set("borderWidth", "10px");
|
||||
cssSetters.set("borderTopWidth", "5px");
|
||||
cssSetters.set("borderRightWidth", "5px");
|
||||
cssSetters.set("borderBottomWidth", "5px");
|
||||
cssSetters.set("borderLeftWidth", "5px");
|
||||
cssSetters.set("borderRadius", "10px");
|
||||
cssSetters.set("borderTopLeftRadius", "5px");
|
||||
cssSetters.set("borderTopRightRadius", "5px");
|
||||
cssSetters.set("borderBottomRightRadius", "5px");
|
||||
cssSetters.set("borderBottomLeftRadius", "5px");
|
||||
|
||||
cssSetters.set('fontSize', '20');
|
||||
cssSetters.set('fontFamily', 'monospace');
|
||||
cssSetters.set('fontStyle', 'italic');
|
||||
cssSetters.set('fontWeight', '100');
|
||||
cssSetters.set('font', 'italic 2 "Open Sans", sans-serif');
|
||||
cssSetters.set("fontSize", "20");
|
||||
cssSetters.set("fontFamily", "monospace");
|
||||
cssSetters.set("fontStyle", "italic");
|
||||
cssSetters.set("fontWeight", "100");
|
||||
cssSetters.set("font", "italic 2 \"Open Sans\", sans-serif");
|
||||
|
||||
// zIndex on android is not what you think...
|
||||
// cssSetters.set('zIndex', '2');
|
||||
cssSetters.set('opacity', '0.5');
|
||||
cssSetters.set("opacity", "0.5");
|
||||
// already set through view properties.
|
||||
// cssSetters.set('visibility', 'collapse');
|
||||
|
||||
cssSetters.set('letterSpacing', '2');
|
||||
cssSetters.set('textAlignment', 'center');
|
||||
cssSetters.set('textDecoration', 'underline');
|
||||
cssSetters.set('textTransform', 'capitalize');
|
||||
cssSetters.set('whiteSpace', 'normal');
|
||||
cssSetters.set("letterSpacing", "2");
|
||||
cssSetters.set("textAlignment", "center");
|
||||
cssSetters.set("textDecoration", "underline");
|
||||
cssSetters.set("textTransform", "capitalize");
|
||||
cssSetters.set("whiteSpace", "normal");
|
||||
|
||||
cssSetters.set('minWidth', 50);
|
||||
cssSetters.set('minHeight', 50);
|
||||
cssSetters.set('width', 100);
|
||||
cssSetters.set('height', 100);
|
||||
cssSetters.set('margin', '25');
|
||||
cssSetters.set('marginLeft', '30px');
|
||||
cssSetters.set('marginTop', '30px');
|
||||
cssSetters.set('marginRight', '30px');
|
||||
cssSetters.set('marginBottom', '30px');
|
||||
cssSetters.set('padding', '25');
|
||||
cssSetters.set('paddingLeft', '30px');
|
||||
cssSetters.set('paddingTop', '30px');
|
||||
cssSetters.set('paddingRight', '30px');
|
||||
cssSetters.set('paddingBottom', '30px');
|
||||
cssSetters.set('horizontalAlignment', 'center');
|
||||
cssSetters.set('verticalAlignment', 'center');
|
||||
cssSetters.set("minWidth", 50);
|
||||
cssSetters.set("minHeight", 50);
|
||||
cssSetters.set("width", 100);
|
||||
cssSetters.set("height", 100);
|
||||
cssSetters.set("margin", "25");
|
||||
cssSetters.set("marginLeft", "30px");
|
||||
cssSetters.set("marginTop", "30px");
|
||||
cssSetters.set("marginRight", "30px");
|
||||
cssSetters.set("marginBottom", "30px");
|
||||
cssSetters.set("padding", "25");
|
||||
cssSetters.set("paddingLeft", "30px");
|
||||
cssSetters.set("paddingTop", "30px");
|
||||
cssSetters.set("paddingRight", "30px");
|
||||
cssSetters.set("paddingBottom", "30px");
|
||||
cssSetters.set("horizontalAlignment", "center");
|
||||
cssSetters.set("verticalAlignment", "center");
|
||||
|
||||
cssSetters.set('transform', 'translate(5, 10), scale(1.2, 1.2), rotate(45)');
|
||||
cssSetters.set("transform", "translate(5, 10), scale(1.2, 1.2), rotate(45)");
|
||||
|
||||
// TabView-specific props
|
||||
cssSetters.set('tabTextColor', 'red');
|
||||
cssSetters.set('tabBackgroundColor', 'red');
|
||||
cssSetters.set('selectedTabTextColor', 'red');
|
||||
cssSetters.set('androidSelectedTabHighlightColor', 'red');
|
||||
cssSetters.set("tabTextColor", "red");
|
||||
cssSetters.set("tabBackgroundColor", "red");
|
||||
cssSetters.set("selectedTabTextColor", "red");
|
||||
cssSetters.set("androidSelectedTabHighlightColor", "red");
|
||||
|
||||
// ListView-specific props
|
||||
cssSetters.set('separatorColor', 'red');
|
||||
cssSetters.set("separatorColor", "red");
|
||||
|
||||
// SegmentedBar-specific props
|
||||
cssSetters.set('selectedBackgroundColor', 'red');
|
||||
cssSetters.set("selectedBackgroundColor", "red");
|
||||
|
||||
// Page-specific props
|
||||
cssSetters.set('statusBarStyle', 'light');
|
||||
cssSetters.set('androidStatusBarBackground', 'red');
|
||||
cssSetters.set("statusBarStyle", "light");
|
||||
cssSetters.set("androidStatusBarBackground", "red");
|
||||
|
||||
// Flexbox-layout props
|
||||
// cssSetters.set('flexDirection', 'column');
|
||||
|
@ -13,16 +13,16 @@ export function onTap() {
|
||||
closeCallback("sample text\n");
|
||||
}
|
||||
|
||||
export function change(args){
|
||||
var button:Button =<Button>args.object;
|
||||
export function change(args) {
|
||||
var button: Button = <Button>args.object;
|
||||
|
||||
var page: Page = <Page>button.parent;
|
||||
|
||||
var page:Page =<Page> button.parent;
|
||||
|
||||
console.log("---------------------page-------------------------")
|
||||
console.log(page)
|
||||
var label:Label = <Label> page.getViewById("label1");
|
||||
label.text="fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo";
|
||||
var label: Label = <Label>page.getViewById("label1");
|
||||
label.text = "fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo";
|
||||
|
||||
var label2:Label = <Label> page.getViewById("label2");
|
||||
label2.text="foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo";
|
||||
var label2: Label = <Label>page.getViewById("label2");
|
||||
label2.text = "foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo";
|
||||
}
|
@ -8,29 +8,29 @@ import { ScrollView } from "tns-core-modules/ui/scroll-view";
|
||||
let red = new Color("red");
|
||||
let green = new Color("green");
|
||||
|
||||
export function onToggle(args: EventData){
|
||||
export function onToggle(args: EventData) {
|
||||
let button = <Button>args.object;
|
||||
let target = button.page.getViewById<View>("target");
|
||||
let debugConsole = button.page.getViewById<TextView>("debugConsole");
|
||||
let scrollView = button.page.getViewById<ScrollView>("scrollView");
|
||||
|
||||
if (button.text === "Color"){
|
||||
if (button.text === "Color") {
|
||||
target[button.id] = target[button.id] ? undefined : red;
|
||||
debugConsole.text += `> border-color: ${target.borderColor}\n`;
|
||||
}
|
||||
else if (button.text === "Width"){
|
||||
else if (button.text === "Width") {
|
||||
target[button.id] = target[button.id] ? 0 : 10;
|
||||
debugConsole.text += `> border-width: ${target.borderWidth}\n`;
|
||||
}
|
||||
else if (button.text === "Radius"){
|
||||
else if (button.text === "Radius") {
|
||||
target[button.id] = target[button.id] ? 0 : 10;
|
||||
debugConsole.text += `> border-radius: ${target.borderRadius}\n`;
|
||||
}
|
||||
else if (button.text === "BGColor"){
|
||||
else if (button.text === "BGColor") {
|
||||
target.backgroundColor = target.backgroundColor ? undefined : green;
|
||||
debugConsole.text += `> background-color: ${target.backgroundColor}\n`;
|
||||
}
|
||||
else if (button.text === "BGImage"){
|
||||
else if (button.text === "BGImage") {
|
||||
target.backgroundImage = target.backgroundImage ? undefined : `~/ui-tests-app/resources/images/test2.png`;
|
||||
debugConsole.text += `> background-image: ${target.backgroundImage}\n`;
|
||||
}
|
||||
|
@ -15,9 +15,9 @@ export function loadExamples() {
|
||||
examples.set("button-border", "button/button-border");
|
||||
examples.set("styles", "button/styles");
|
||||
examples.set("background", "button/background");
|
||||
examples.set("border-playground","button/border-playground");
|
||||
examples.set("issue-4287","button/issue-4287");
|
||||
examples.set("issue-4385","button/issue-4385");
|
||||
examples.set("highlight-4740","button/highlight-4740/highlight-4740");
|
||||
examples.set("border-playground", "button/border-playground");
|
||||
examples.set("issue-4287", "button/issue-4287");
|
||||
examples.set("issue-4385", "button/issue-4385");
|
||||
examples.set("highlight-4740", "button/highlight-4740/highlight-4740");
|
||||
return examples;
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
import { EventData} from "tns-core-modules/data/observable";
|
||||
import { EventData } from "tns-core-modules/data/observable";
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
import { SearchBar } from "tns-core-modules/ui/search-bar";
|
||||
import { isAndroid } from "tns-core-modules/platform";
|
||||
|
||||
export function onLoaded(args: EventData){
|
||||
export function onLoaded(args: EventData) {
|
||||
var page = <Page>args.object;
|
||||
var searchBar = <SearchBar>page.getViewById("sb");
|
||||
if(isAndroid){
|
||||
if (isAndroid) {
|
||||
searchBar.android.clearFocus();
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { EventData} from "tns-core-modules/data/observable";
|
||||
import { EventData } from "tns-core-modules/data/observable";
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
import { SearchBar } from "tns-core-modules/ui/search-bar";
|
||||
import { isAndroid } from "tns-core-modules/platform";
|
||||
|
||||
export function onLoaded(args: EventData){
|
||||
export function onLoaded(args: EventData) {
|
||||
var page = <Page>args.object;
|
||||
var searchBar = <SearchBar>page.getViewById("sb");
|
||||
if(isAndroid){
|
||||
if (isAndroid) {
|
||||
searchBar.android.clearFocus();
|
||||
}
|
||||
}
|
||||
|
@ -9,23 +9,23 @@ const tests = [
|
||||
{ name: "black hex color only", background: "#000000" },
|
||||
{ name: "yellow hex color only", background: "#ffff00" },
|
||||
{ name: "blue color only", background: "blue" },
|
||||
{ name: "repeat image only", background: 'url("~/ui-tests-app/resources/images/icon.png")' },
|
||||
{ name: "repeat image only", background: "url(\"~/ui-tests-app/resources/images/icon.png\")" },
|
||||
|
||||
{ name: "[straight] image only, no-repeat ", background: 'url("~/ui-tests-app/resources/images/icon.png") no-repeat' },
|
||||
{ name: "[straight] green color, image, no-repeat", background: 'green url("~/ui-tests-app/resources/images/icon.png") no-repeat' },
|
||||
{ name: "[straight] yellow hex color, image, no-repeat, position pixels", background: '#ffff00 url("~/ui-tests-app/resources/images/icon.png") no-repeat 200px 200px' },
|
||||
{ name: "[straight] yellow hex color, image, repeat-y, position pixels", background: '#ffff00 url("~/ui-tests-app/resources/images/icon.png") repeat-y 100px 500px' },
|
||||
{ name: "[straight] orange hex color, image, no-repeat, position percents", background: '#F9791F url("~/ui-tests-app/resources/images/icon.png") no-repeat 100% 100%' },
|
||||
{ name: "[straight] green color, image, repeat-x, position percents", background: 'green url("~/ui-tests-app/resources/images/icon.png") repeat-x 100% 100%' },
|
||||
{ name: "[straight] blue color, image, repeat-x, position", background: 'blue url("~/ui-tests-app/resources/images/icon.png") repeat-x 150 150' },
|
||||
{ name: "[straight] image only, no-repeat ", background: "url(\"~/ui-tests-app/resources/images/icon.png\") no-repeat" },
|
||||
{ name: "[straight] green color, image, no-repeat", background: "green url(\"~/ui-tests-app/resources/images/icon.png\") no-repeat" },
|
||||
{ name: "[straight] yellow hex color, image, no-repeat, position pixels", background: "#ffff00 url(\"~/ui-tests-app/resources/images/icon.png\") no-repeat 200px 200px" },
|
||||
{ name: "[straight] yellow hex color, image, repeat-y, position pixels", background: "#ffff00 url(\"~/ui-tests-app/resources/images/icon.png\") repeat-y 100px 500px" },
|
||||
{ name: "[straight] orange hex color, image, no-repeat, position percents", background: "#F9791F url(\"~/ui-tests-app/resources/images/icon.png\") no-repeat 100% 100%" },
|
||||
{ name: "[straight] green color, image, repeat-x, position percents", background: "green url(\"~/ui-tests-app/resources/images/icon.png\") repeat-x 100% 100%" },
|
||||
{ name: "[straight] blue color, image, repeat-x, position", background: "blue url(\"~/ui-tests-app/resources/images/icon.png\") repeat-x 150 150" },
|
||||
|
||||
{ name: "[shuffle] no-repeat, image only", background: 'no-repeat url("~/ui-tests-app/resources/images/icon.png")' },
|
||||
{ name: "[shuffle] no-repeat, green color, image, ", background: 'no-repeat green url("~/ui-tests-app/resources/images/icon.png")' },
|
||||
{ name: "[shuffle] yellow hex color, position pixels, image, no-repeat", background: '#ffff00 200px 200px url("~/ui-tests-app/resources/images/icon.png") no-repeat' },
|
||||
{ name: "[shuffle] image, repeat-y, yellow hex color, position pixels", background: 'url("~/ui-tests-app/resources/images/icon.png") repeat-y #ffff00 100px 500px' },
|
||||
{ name: "[shuffle] position percents, image, no-repeat, orange hex color", background: '100% 100% url("~/ui-tests-app/resources/images/icon.png") no-repeat #F9791F' },
|
||||
{ name: "[shuffle] position percents, image, repeat-x, green color", background: '100% 100% url("~/ui-tests-app/resources/images/icon.png") repeat-x green' },
|
||||
{ name: "[shuffle] image, repeat-x, position, blue color,", background: 'url("~/ui-tests-app/resources/images/icon.png") repeat-x 150 150 blue' },
|
||||
{ name: "[shuffle] no-repeat, image only", background: "no-repeat url(\"~/ui-tests-app/resources/images/icon.png\")" },
|
||||
{ name: "[shuffle] no-repeat, green color, image, ", background: "no-repeat green url(\"~/ui-tests-app/resources/images/icon.png\")" },
|
||||
{ name: "[shuffle] yellow hex color, position pixels, image, no-repeat", background: "#ffff00 200px 200px url(\"~/ui-tests-app/resources/images/icon.png\") no-repeat" },
|
||||
{ name: "[shuffle] image, repeat-y, yellow hex color, position pixels", background: "url(\"~/ui-tests-app/resources/images/icon.png\") repeat-y #ffff00 100px 500px" },
|
||||
{ name: "[shuffle] position percents, image, no-repeat, orange hex color", background: "100% 100% url(\"~/ui-tests-app/resources/images/icon.png\") no-repeat #F9791F" },
|
||||
{ name: "[shuffle] position percents, image, repeat-x, green color", background: "100% 100% url(\"~/ui-tests-app/resources/images/icon.png\") repeat-x green" },
|
||||
{ name: "[shuffle] image, repeat-x, position, blue color,", background: "url(\"~/ui-tests-app/resources/images/icon.png\") repeat-x 150 150 blue" },
|
||||
]
|
||||
|
||||
export function onLoaded(args) {
|
||||
|
@ -85,7 +85,7 @@ export function createPage() {
|
||||
var observer3 = longpressLabel.getGestureObservers(gestures.GestureTypes.longPress)[0];
|
||||
|
||||
swipeLabel.on(gestures.GestureTypes.swipe, function (args: gestures.SwipeGestureEventData) {
|
||||
swipeLabel.text = "Swipe Direction: " + args.direction + ", " + (args.object === swipeLabel);// + getStateAsString(args.state);
|
||||
swipeLabel.text = "Swipe Direction: " + args.direction + ", " + (args.object === swipeLabel); // + getStateAsString(args.state);
|
||||
});
|
||||
|
||||
var observer4 = swipeLabel.getGestureObservers(gestures.GestureTypes.swipe)[0];
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {TextView} from "tns-core-modules/ui/text-view";
|
||||
import { TextView } from "tns-core-modules/ui/text-view";
|
||||
import * as gestures from "tns-core-modules/ui/gestures";
|
||||
|
||||
export function onTouch(args: gestures.TouchGestureEventData) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {TabView} from "tns-core-modules/ui/tab-view";
|
||||
import { TabView } from "tns-core-modules/ui/tab-view";
|
||||
import * as utils from "tns-core-modules/utils/utils";
|
||||
|
||||
const titles = ["Etiam lacinia", "Imperdiet ante", "A interdum", "Quisque tempus", "Sodales viverra"];
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { topmost } from "tns-core-modules/ui/frame";
|
||||
|
||||
export function onTap(args){
|
||||
export function onTap(args) {
|
||||
topmost().goBack();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { topmost } from "tns-core-modules/ui/frame";
|
||||
|
||||
export function onTap(){
|
||||
export function onTap() {
|
||||
topmost().navigate("ui-tests-app/font/font-awesome/issue-3654-2");
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as dialogs from "tns-core-modules/ui/dialogs";
|
||||
import * as observable from "tns-core-modules/data/observable";
|
||||
import * as imageAssetModule from "tns-core-modules/image-asset";
|
||||
import { ImageSource } from 'tns-core-modules/image-source';
|
||||
import { ImageSource } from "tns-core-modules/image-source";
|
||||
|
||||
let _cameraImageAsset = null;
|
||||
let _cameraImageSrc = null;
|
||||
@ -10,7 +10,7 @@ export class ImageViewModel extends observable.Observable {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
let asset = new imageAssetModule.ImageAsset('~/splashscreen.png');
|
||||
let asset = new imageAssetModule.ImageAsset("~/splashscreen.png");
|
||||
asset.options = {
|
||||
width: 300,
|
||||
height: 300,
|
||||
|
@ -28,7 +28,7 @@ export function navigatingTo(args) {
|
||||
|
||||
grid.addChild(image);
|
||||
|
||||
switch(Math.floor(x / 4)) {
|
||||
switch (Math.floor(x / 4)) {
|
||||
case 1:
|
||||
image.borderWidth = "3";
|
||||
break;
|
||||
@ -38,7 +38,7 @@ export function navigatingTo(args) {
|
||||
break;
|
||||
}
|
||||
|
||||
switch(Math.floor(y / 4)) {
|
||||
switch (Math.floor(y / 4)) {
|
||||
case 1:
|
||||
image.borderRadius = "12";
|
||||
break;
|
||||
|
@ -4,7 +4,7 @@ import { Page } from "tns-core-modules/ui/page";
|
||||
import { View } from "tns-core-modules/ui/core/view";
|
||||
|
||||
var page: Page;
|
||||
var borderColor : Color = new Color("#ff0000");
|
||||
var borderColor: Color = new Color("#ff0000");
|
||||
export function navigatingTo(args: EventData) {
|
||||
page = <Page>args.object;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { EventData } from 'tns-core-modules/data/observable';
|
||||
import { Page } from 'tns-core-modules/ui/page';
|
||||
import { EventData } from "tns-core-modules/data/observable";
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
import { Button } from "tns-core-modules/ui/button";
|
||||
import { Label } from "tns-core-modules/ui/label";
|
||||
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
|
||||
@ -8,7 +8,7 @@ import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout";
|
||||
export function toggle(args: EventData) {
|
||||
const page = <Page>((<any>args.object).page);
|
||||
|
||||
const getElementById = id => { return page.getViewById(id); }
|
||||
const getElementById = id => page.getViewById(id)
|
||||
|
||||
const toggleBtn = <Button>getElementById("toggleUserInteraction");
|
||||
const isEnabled = toggleBtn.text === "disable" ? true : false;
|
||||
|
@ -23,7 +23,7 @@ export function loadExamples() {
|
||||
examples.set("1639", "issues/issue-1639");
|
||||
examples.set("3714", "issues/issue-3714");
|
||||
examples.set("1657-ios", "issues/issue-1657-ios");
|
||||
examples.set("tabview-with-scrollview_4022","issues/tabview-with-scrollview_4022");
|
||||
examples.set("tabview-with-scrollview_4022", "issues/tabview-with-scrollview_4022");
|
||||
examples.set("3354-ios", "issues/issue-3354");
|
||||
examples.set("4450", "issues/issue-4450");
|
||||
|
||||
|
@ -8,7 +8,7 @@ export function onLoaded(args: { eventName: string, object: any }) {
|
||||
|
||||
export function onStretchLastChild(args: { eventName: string, object: any }) {
|
||||
var layout = args.object.parent;
|
||||
if(layout.stretchLastChild === true) {
|
||||
if (layout.stretchLastChild === true) {
|
||||
layout.stretchLastChild = false;
|
||||
} else {
|
||||
layout.stretchLastChild = true;
|
||||
|
@ -9,7 +9,7 @@ export function onLoaded(args: { eventName: string, object: any }) {
|
||||
|
||||
export function onOrientation(args: { eventName: string, object: any }) {
|
||||
var layout = args.object.parent;
|
||||
if(layout.orientation === enums.Orientation.vertical) {
|
||||
if (layout.orientation === enums.Orientation.vertical) {
|
||||
layout.orientation = enums.Orientation.horizontal;
|
||||
} else {
|
||||
layout.orientation = enums.Orientation.vertical;
|
||||
|
@ -12,7 +12,7 @@ export function onLoaded(args: { eventName: string, object: any }) {
|
||||
export function onSetLeftSetTop(args: { eventName: string, object: any }) {
|
||||
var layout = args.object.parent;
|
||||
var child = layout.getViewById("setLeftSetTop");
|
||||
if(++count % 2 === 1) {
|
||||
if (++count % 2 === 1) {
|
||||
absoluteLayout.AbsoluteLayout.setLeft(child, 175);
|
||||
absoluteLayout.AbsoluteLayout.setTop(child, 375);
|
||||
} else {
|
||||
|
@ -8,7 +8,7 @@ export function onLoaded(args: { eventName: string, object: any }) {
|
||||
|
||||
export function onStretchLastChild(args: { eventName: string, object: any }) {
|
||||
var layout = args.object.parent;
|
||||
if(layout.stretchLastChild === true) {
|
||||
if (layout.stretchLastChild === true) {
|
||||
layout.stretchLastChild = false;
|
||||
} else {
|
||||
layout.stretchLastChild = true;
|
||||
|
@ -9,7 +9,7 @@ export function onLoaded(args: { eventName: string, object: any }) {
|
||||
|
||||
export function onOrientation(args: { eventName: string, object: any }) {
|
||||
var layout = args.object.parent;
|
||||
if(layout.orientation === enums.Orientation.vertical) {
|
||||
if (layout.orientation === enums.Orientation.vertical) {
|
||||
layout.orientation = enums.Orientation.horizontal;
|
||||
} else {
|
||||
layout.orientation = enums.Orientation.vertical;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Page } from 'tns-core-modules/ui/page';
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
import { Observable } from "tns-core-modules/data/observable";
|
||||
import { EventData } from "tns-core-modules/ui/core/view";
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { EventData, Observable } from 'tns-core-modules/data/observable';
|
||||
import { Page } from 'tns-core-modules/ui/page';
|
||||
import { EventData, Observable } from "tns-core-modules/data/observable";
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
|
||||
export function navigatingTo(args: EventData) {
|
||||
let page = <Page>args.object;
|
||||
|
@ -2,7 +2,7 @@ import { EventData } from "tns-core-modules/data/observable";
|
||||
import { ObservableArray } from "tns-core-modules/data/observable-array";
|
||||
import { View, KeyedTemplate } from "tns-core-modules/ui/core/view";
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
import { ViewModel, Item } from './main-view-model';
|
||||
import { ViewModel, Item } from "./main-view-model";
|
||||
import { ListView } from "tns-core-modules/ui/list-view";
|
||||
import { Label } from "tns-core-modules/ui/label";
|
||||
import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout";
|
||||
@ -35,24 +35,24 @@ export function pageLoaded(args: EventData) {
|
||||
lv4.itemTemplates = new Array<KeyedTemplate>(
|
||||
{
|
||||
key: "red",
|
||||
createView: () => { return createLabel(new Color("red")); }
|
||||
createView: () => createLabel(new Color("red"))
|
||||
},
|
||||
{
|
||||
key: "green",
|
||||
createView: () => { return createLabel(new Color("green")); }
|
||||
createView: () => createLabel(new Color("green"))
|
||||
},
|
||||
{
|
||||
key: "yellow",
|
||||
createView: () => { return createLabel(new Color("yellow")); }
|
||||
createView: () => createLabel(new Color("yellow"))
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
let scrollToBottom = true;
|
||||
export function onScroll(args: EventData){
|
||||
export function onScroll(args: EventData) {
|
||||
let page = (<View>args.object).page;
|
||||
let gridLayout = page.getViewById<GridLayout>("grid-layout");
|
||||
for (let i = 0, length = gridLayout.getChildrenCount(); i < length; i++){
|
||||
for (let i = 0, length = gridLayout.getChildrenCount(); i < length; i++) {
|
||||
let listView = <ListView>gridLayout.getChildAt(i);
|
||||
listView.scrollToIndex(scrollToBottom ? listView.items.length - 1 : 0);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ export class Item extends Observable {
|
||||
set name(value: string) {
|
||||
if (this._name !== value) {
|
||||
this._name = value;
|
||||
this.notifyPropertyChange('name', value)
|
||||
this.notifyPropertyChange("name", value)
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ export class Item extends Observable {
|
||||
set id(value: number) {
|
||||
if (this._id !== value) {
|
||||
this._id = value;
|
||||
this.notifyPropertyChange('id', value)
|
||||
this.notifyPropertyChange("id", value)
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ export class ViewModel extends Observable {
|
||||
|
||||
get items(): ObservableArray<Item> {
|
||||
this._items = new ObservableArray<Item>();
|
||||
for (let i = 0; i < 100; i++){
|
||||
for (let i = 0; i < 100; i++) {
|
||||
this._items.push(new Item(`Item`, i));
|
||||
}
|
||||
return this._items;
|
||||
|
@ -37,13 +37,13 @@ export function pageLoaded(args: EventData) {
|
||||
examples.set("date-picker", "date-picker/date-picker");
|
||||
page.bindingContext = new MainPageViewModel(wrapLayout, examples);
|
||||
|
||||
const parent = page.getViewById('parentLayout');
|
||||
const searchBar = page.getViewById('textView');
|
||||
const parent = page.getViewById("parentLayout");
|
||||
const searchBar = page.getViewById("textView");
|
||||
if (isAndroid) {
|
||||
parent.android.setFocusableInTouchMode(true);
|
||||
parent.android.setFocusable(true);
|
||||
searchBar.android.clearFocus();
|
||||
}else{
|
||||
parent.style.marginBottom=10;
|
||||
} else {
|
||||
parent.style.marginBottom = 10;
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ var images = ["gravatar", "gravatar2", "red"];
|
||||
export function onLoad(args: EventData) {
|
||||
let index = indexCounter++ % 3;
|
||||
let page = <Page>args.object;
|
||||
page.backgroundImage = '~/ui-tests-app/resources/images/' + images[index] + '.png';
|
||||
page.backgroundImage = "~/ui-tests-app/resources/images/" + images[index] + ".png";
|
||||
setLabelText(page, navCounter, "countInfo");
|
||||
getMemoryUsage(args);
|
||||
}
|
||||
@ -28,7 +28,7 @@ export function navigateBack(args: EventData) {
|
||||
|
||||
function setLabelText(page: Page, text: number, id: string) {
|
||||
let label = <Label>page.getViewById(id);
|
||||
label.text = text + '';
|
||||
label.text = text + "";
|
||||
}
|
||||
|
||||
function getMemoryUsage(args: EventData) {
|
||||
|
@ -4,7 +4,7 @@ import { Label } from "tns-core-modules/ui/label";
|
||||
|
||||
const average = 3;
|
||||
const noValue = "noValue";
|
||||
const colors = ['red', 'green'];
|
||||
const colors = ["red", "green"];
|
||||
|
||||
export function addRemove(counts: Array<number>, parent: LayoutBase): string {
|
||||
let result = `addRemove`;
|
||||
@ -29,7 +29,7 @@ export function addRemove(counts: Array<number>, parent: LayoutBase): string {
|
||||
}
|
||||
|
||||
export function setText(counts: Array<number>, parent?: LayoutBase): string {
|
||||
let result = `setText ${parent ? 'with nativeView' : ''}`;
|
||||
let result = `setText ${parent ? "with nativeView" : ""}`;
|
||||
counts.forEach((count) => {
|
||||
const lbl = setup(parent);
|
||||
const time = executeTest(() => {
|
||||
@ -44,7 +44,7 @@ export function setText(counts: Array<number>, parent?: LayoutBase): string {
|
||||
}
|
||||
|
||||
export function setBackgroundColor(counts: Array<number>, parent?: LayoutBase): string {
|
||||
let result = `setBackgroundColor ${parent ? 'with nativeView' : ''}`;
|
||||
let result = `setBackgroundColor ${parent ? "with nativeView" : ""}`;
|
||||
counts.forEach((count) => {
|
||||
if (parent && count > 10000) {
|
||||
result += setResultTime(noValue);
|
||||
@ -66,7 +66,7 @@ export function setBackgroundColor(counts: Array<number>, parent?: LayoutBase):
|
||||
|
||||
const borders = [1, 2, 3];
|
||||
export function setBorderWidths(counts: Array<number>, parent?: LayoutBase): string {
|
||||
let result = `setBorderWidths ${parent ? 'with nativeView' : ''}`;
|
||||
let result = `setBorderWidths ${parent ? "with nativeView" : ""}`;
|
||||
counts.forEach((count) => {
|
||||
if (count > 10000 && parent) {
|
||||
result += setResultTime(noValue);
|
||||
@ -90,7 +90,7 @@ export function setBorderWidths(counts: Array<number>, parent?: LayoutBase): str
|
||||
}
|
||||
|
||||
export function setColor(counts: Array<number>, parent?: LayoutBase): string {
|
||||
let result = `setColor ${parent ? 'with nativeView' : ''}`;
|
||||
let result = `setColor ${parent ? "with nativeView" : ""}`;
|
||||
counts.forEach((count) => {
|
||||
const lbl = setup(parent);
|
||||
const style = lbl.style;
|
||||
@ -128,7 +128,7 @@ export function setColorWithParents(counts: Array<number>, parent: LayoutBase):
|
||||
|
||||
const fontSizes = [10, 20];
|
||||
export function setFontSize(counts: Array<number>, parent?: LayoutBase): string {
|
||||
let result = `setFontSize ${parent ? 'with nativeView' : ''}`;
|
||||
let result = `setFontSize ${parent ? "with nativeView" : ""}`;
|
||||
counts.forEach((count) => {
|
||||
const lbl = setup(parent);
|
||||
const style = lbl.style;
|
||||
@ -165,13 +165,13 @@ export function setFontSizeWithParents(counts: Array<number>, parent: LayoutBase
|
||||
}
|
||||
|
||||
export function setFontWeight(counts: Array<number>, parent?: LayoutBase): string {
|
||||
let result = `setFontWeight ${parent ? 'with nativeView' : ''}`;
|
||||
let result = `setFontWeight ${parent ? "with nativeView" : ""}`;
|
||||
counts.forEach((count) => {
|
||||
const lbl = setup(parent);
|
||||
const style = lbl.style;
|
||||
const time = executeTest(() => {
|
||||
for (let i = 0; i < count; i++) {
|
||||
style.fontWeight = i % 2 === 0 ? 'bold' : 'normal';
|
||||
style.fontWeight = i % 2 === 0 ? "bold" : "normal";
|
||||
}
|
||||
});
|
||||
result += setResultTime(time);
|
||||
@ -192,7 +192,7 @@ export function setFontWeightWithParents(counts: Array<number>, parent: LayoutBa
|
||||
setupParents(parent);
|
||||
const time = executeTest(() => {
|
||||
for (let i = 0; i < count; i++) {
|
||||
style.fontWeight = i % 2 === 0 ? 'bold' : 'normal'
|
||||
style.fontWeight = i % 2 === 0 ? "bold" : "normal"
|
||||
}
|
||||
});
|
||||
result += setResultTime(time);
|
||||
@ -202,7 +202,7 @@ export function setFontWeightWithParents(counts: Array<number>, parent: LayoutBa
|
||||
}
|
||||
|
||||
export function setBindingContext(counts: Array<number>, parent?: LayoutBase): string {
|
||||
let result = `setBindingContext ${parent ? 'with nativeView' : ''}`;
|
||||
let result = `setBindingContext ${parent ? "with nativeView" : ""}`;
|
||||
counts.forEach((count) => {
|
||||
const lbl = setup(parent);
|
||||
const time = executeTest(() => {
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { Observable } from 'tns-core-modules/data/observable'
|
||||
import { ObservableArray } from 'tns-core-modules/data/observable-array'
|
||||
import { SearchBar } from 'tns-core-modules/ui/search-bar';
|
||||
import { Observable } from "tns-core-modules/data/observable"
|
||||
import { ObservableArray } from "tns-core-modules/data/observable-array"
|
||||
import { SearchBar } from "tns-core-modules/ui/search-bar";
|
||||
|
||||
export class Issue5039ViewModel extends Observable {
|
||||
|
||||
private _items = ['apple', 'apple cider', 'apple pie', 'orange', 'orange juice', 'strawberry', 'blueberry']
|
||||
private _items = ["apple", "apple cider", "apple pie", "orange", "orange juice", "strawberry", "blueberry"]
|
||||
public items = new ObservableArray()
|
||||
|
||||
constructor(private _searchBar: SearchBar) {
|
||||
@ -20,7 +20,7 @@ export class Issue5039ViewModel extends Observable {
|
||||
this.filter();
|
||||
}
|
||||
|
||||
filter(value: string = '') {
|
||||
filter(value: string = "") {
|
||||
this.items.splice(0, this.items.length) // remove all items
|
||||
this.items.push(this._items.filter(i => -1 !== i.indexOf(value)))
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Issue5039ViewModel } from './issue-5039-view-model'
|
||||
import { Issue5039ViewModel } from "./issue-5039-view-model"
|
||||
import { SearchBar } from "tns-core-modules/ui/search-bar";
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
|
||||
|
@ -21,7 +21,7 @@ export function loadExamples() {
|
||||
examples.set("tab-view-icons", "tab-view/tab-view-icon");
|
||||
examples.set("tab-view-icon-change", "tab-view/tab-view-icon-change");
|
||||
examples.set("text-transform", "tab-view/text-transform");
|
||||
examples.set("tab-view-bottom-position","tab-view/tab-view-bottom-position");
|
||||
examples.set("issue-5470","tab-view/issue-5470");
|
||||
examples.set("tab-view-bottom-position", "tab-view/tab-view-bottom-position");
|
||||
examples.set("issue-5470", "tab-view/issue-5470");
|
||||
return examples;
|
||||
}
|
||||
|
@ -6,10 +6,10 @@ export function onLoaded(args) {
|
||||
const textField = <TextField>page.getViewById("textField");
|
||||
const textView = <TextView>page.getViewById("textView");
|
||||
|
||||
attachToEvent(textField,"blur");
|
||||
attachToEvent(textField,"focus");
|
||||
attachToEvent(textView,"blur");
|
||||
attachToEvent(textView,"focus");
|
||||
attachToEvent(textField, "blur");
|
||||
attachToEvent(textField, "focus");
|
||||
attachToEvent(textView, "blur");
|
||||
attachToEvent(textView, "focus");
|
||||
}
|
||||
|
||||
function attachToEvent(control, event) {
|
||||
|
@ -5,7 +5,7 @@ import { TextField } from "tns-core-modules/ui/text-field";
|
||||
|
||||
function exectuteOnAll(page: Page, callback: (txt: TextView | TextField) => void) {
|
||||
page.getViewById("container").eachChild((child) => {
|
||||
if(child instanceof TextView || child instanceof TextField) {
|
||||
if (child instanceof TextView || child instanceof TextField) {
|
||||
callback(child);
|
||||
}
|
||||
return true;
|
||||
|
@ -1,23 +1,20 @@
|
||||
{
|
||||
"rules": {
|
||||
"arrow-return-shorthand": true,
|
||||
"class-name": true,
|
||||
"curly": true,
|
||||
"forin": false,
|
||||
"indent": true,
|
||||
"indent": [true, "spaces", 4],
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": [false, 120],
|
||||
"no-arg": true,
|
||||
"no-bitwise": false,
|
||||
"no-consecutive-blank-lines": true,
|
||||
"no-construct": true,
|
||||
"no-debugger": true,
|
||||
"triple-equals": [true, "allow-null-check"],
|
||||
"variable-name": [false, "allow-leading-underscore"],
|
||||
"no-duplicate-variable": true,
|
||||
"no-empty": true,
|
||||
"no-eval": true,
|
||||
"no-unused-variable": [true],
|
||||
"no-duplicate-variable": true,
|
||||
|
||||
"no-bitwise": false,
|
||||
"no-string-literal": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"no-unused-expression": true,
|
||||
@ -29,9 +26,10 @@
|
||||
"check-else",
|
||||
"check-whitespace"
|
||||
],
|
||||
"quotemark": [false, "double"],
|
||||
"quotemark": [true, "double"],
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"triple-equals": [true, "allow-null-check"],
|
||||
"typedef": [false,
|
||||
"callSignature",
|
||||
"indexSignature",
|
||||
@ -40,19 +38,33 @@
|
||||
"variableDeclarator",
|
||||
"memberVariableDeclarator"
|
||||
],
|
||||
"typedef-whitespace": [false,
|
||||
"callSignature",
|
||||
"catchClause",
|
||||
"indexSignature"
|
||||
"typedef-whitespace": [true,
|
||||
{
|
||||
"call-signature": "nospace",
|
||||
"index-signature": "nospace",
|
||||
"parameter": "nospace",
|
||||
"property-declaration": "nospace",
|
||||
"variable-declaration": "nospace"
|
||||
},
|
||||
{
|
||||
"call-signature": "onespace",
|
||||
"index-signature": "onespace",
|
||||
"parameter": "onespace",
|
||||
"property-declaration": "onespace",
|
||||
"variable-declaration": "onespace"
|
||||
}
|
||||
],
|
||||
"whitespace": [false,
|
||||
"variable-name": [false, "allow-leading-underscore"],
|
||||
"whitespace": [true,
|
||||
"check-branch",
|
||||
"check-decl",
|
||||
"check-operator",
|
||||
"check-module",
|
||||
"check-separator",
|
||||
"check-type"
|
||||
],
|
||||
|
||||
"indent":4
|
||||
"check-rest-spread",
|
||||
"check-type",
|
||||
"check-type-operator",
|
||||
"check-preblock"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ trace.addCategories(trace.categories.Test + "," + trace.categories.Error);
|
||||
// ));
|
||||
|
||||
function runTests() {
|
||||
setTimeout(() => tests.runAll(''), 10);
|
||||
setTimeout(() => tests.runAll(""), 10);
|
||||
}
|
||||
|
||||
export function onNavigatedTo(args) {
|
||||
|
@ -4,7 +4,7 @@ var appSettings = require("application-settings");
|
||||
|
||||
import * as TKUnit from "../TKUnit";
|
||||
|
||||
var stringKey:string = "stringKey";
|
||||
var stringKey: string = "stringKey";
|
||||
var boolKey: string = "boolKey";
|
||||
var numberKey: string = "numberKey";
|
||||
var noStringKey: string = "noStringKey";
|
||||
@ -58,7 +58,7 @@ export var testDefaultsWithNoDefaultValueProvided = function () {
|
||||
// << application-settings-nodefault
|
||||
TKUnit.assertEqual(defaultValue, undefined, "Default string value is not undefined");
|
||||
|
||||
TKUnit.assertEqual(appSettings.getBoolean(noBoolKey) , undefined, "Default boolean value is not undefined");
|
||||
TKUnit.assertEqual(appSettings.getBoolean(noBoolKey), undefined, "Default boolean value is not undefined");
|
||||
TKUnit.assertEqual(appSettings.getNumber(noNumberKey), undefined, "Default number value is not undefined");
|
||||
};
|
||||
|
||||
@ -108,7 +108,7 @@ export var testFlush = function () {
|
||||
var flushed = appSettings.flush();
|
||||
// will return boolean indicating whether flush to disk was successful
|
||||
// << application-settings-flush
|
||||
TKUnit.assert(flushed, "Flush failed: "+ flushed);
|
||||
TKUnit.assert(flushed, "Flush failed: " + flushed);
|
||||
TKUnit.assert(appSettings.hasKey(stringKey), "There is no key: " + stringKey);
|
||||
};
|
||||
|
||||
|
@ -344,7 +344,7 @@ export const test_ObservableArray_sortShouldReturnNewSortedArray = function () {
|
||||
export const test_ObservableArray_sortShouldReturnNewSortedArrayAccordingSpecifiedOrder = function () {
|
||||
// >> observable-array-sort-comparer
|
||||
const array = new ObservableArray([10, 100, 1]);
|
||||
const result = array.sort((a: number, b: number) => { return a - b; });
|
||||
const result = array.sort((a: number, b: number) => a - b);
|
||||
// << observable-array-sort-comparer
|
||||
TKUnit.assert(result[2] === 100 && result.length === 3, "ObservableArray sort() should return new sorted array according to specified order!");
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ export var test_fetch = function (done: (err: Error, res?: string) => void) {
|
||||
|
||||
export var test_fetch_text = function (done: (err: Error, res?: string) => void) {
|
||||
// >> fetch-string
|
||||
fetch("https://httpbin.org/get").then(response => { return response.text(); }).then(function (r) {
|
||||
fetch("https://httpbin.org/get").then(response => response.text()).then(function (r) {
|
||||
// Argument (r) is string!
|
||||
// >> (hide)
|
||||
TKUnit.assert(types.isString(r), "Result from text() should be string! Actual result is: " + r);
|
||||
@ -32,7 +32,7 @@ export var test_fetch_text = function (done: (err: Error, res?: string) => void)
|
||||
|
||||
export var test_fetch_json = function (done: (err: Error, res?: string) => void) {
|
||||
// >> fetch-json
|
||||
fetch("https://httpbin.org/get").then(response => { return response.json(); }).then(function (r) {
|
||||
fetch("https://httpbin.org/get").then(response => response.json()).then(function (r) {
|
||||
// Argument (r) is JSON object!
|
||||
// >> (hide)
|
||||
TKUnit.assertNotNull(r, "Result from json() should be JSON object!");
|
||||
@ -44,7 +44,7 @@ export var test_fetch_json = function (done: (err: Error, res?: string) => void)
|
||||
|
||||
export var test_fetch_formData = function (done: (err: Error, res?: string) => void) {
|
||||
// >> fetch-formdata
|
||||
fetch("https://httpbin.org/get").then(response => { return response.formData(); }).then(function (r) {
|
||||
fetch("https://httpbin.org/get").then(response => response.formData()).then(function (r) {
|
||||
// Argument (r) is FormData object!
|
||||
// >> (hide)
|
||||
TKUnit.assert(r instanceof FormData, "Result from formData() should be FormData object! Actual result is: " + r);
|
||||
@ -133,7 +133,7 @@ export var test_fetch_post_json = function (done) {
|
||||
method: "POST",
|
||||
headers: new Headers({ "Content-Type": "application/json" }),
|
||||
body: JSON.stringify({ MyVariableOne: "ValueOne", MyVariableTwo: "ValueTwo" })
|
||||
}).then(r => { return r.json(); }).then(function (r) {
|
||||
}).then(r => r.json()).then(function (r) {
|
||||
// >> (hide)
|
||||
TKUnit.assert(r.json["MyVariableOne"] === "ValueOne" && r.json["MyVariableTwo"] === "ValueTwo", "Content not sent/received properly! Actual result is: " + r.json);
|
||||
done(null);
|
||||
|
@ -183,12 +183,12 @@ export var testFileReadWriteBinary = function () {
|
||||
var sourceFile = fs.File.fromPath(__dirname + "/../" + fileName);
|
||||
var destinationFile = fs.knownFolders.documents().getFile(fileName);
|
||||
|
||||
var source = sourceFile.readSync(e=> { error = e; });
|
||||
var source = sourceFile.readSync(e => { error = e; });
|
||||
|
||||
destinationFile.writeSync(source, e=> { error = e; });
|
||||
destinationFile.writeSync(source, e => { error = e; });
|
||||
|
||||
// >> (hide)
|
||||
var destination = destinationFile.readSync(e=> { error = e; });
|
||||
var destination = destinationFile.readSync(e => { error = e; });
|
||||
TKUnit.assertNull(error);
|
||||
if (platform.device.os === platform.platformNames.ios) {
|
||||
TKUnit.assertTrue(source.isEqualToData(destination));
|
||||
@ -218,17 +218,17 @@ export var testGetKnownFolders = function () {
|
||||
// << file-system-known-folders
|
||||
};
|
||||
|
||||
function _testIOSSpecificKnownFolder(knownFolderName: string){
|
||||
function _testIOSSpecificKnownFolder(knownFolderName: string) {
|
||||
let knownFolder: fs.Folder;
|
||||
let createdFile: fs.File;
|
||||
let testFunc = function testFunc(){
|
||||
let testFunc = function testFunc() {
|
||||
knownFolder = fs.knownFolders.ios[knownFolderName]();
|
||||
if (knownFolder) {
|
||||
createdFile = knownFolder.getFile("createdFile");
|
||||
createdFile.writeTextSync("some text");
|
||||
}
|
||||
};
|
||||
if (platform.isIOS){
|
||||
if (platform.isIOS) {
|
||||
testFunc();
|
||||
if (knownFolder) {
|
||||
TKUnit.assertTrue(knownFolder.isKnown, `The ${knownFolderName} folder should have its "isKnown" property set to true.`);
|
||||
|
@ -1,7 +1,7 @@
|
||||
require("globals");
|
||||
import * as http from "tns-core-modules/http";
|
||||
|
||||
declare var postMessage : any;
|
||||
declare var postMessage: any;
|
||||
|
||||
http.getString("https://httpbin.org/get").then(function (r) {
|
||||
postMessage(r);
|
||||
|
@ -79,7 +79,7 @@ export function testFromFile() {
|
||||
}
|
||||
|
||||
export function testFromAssetFileNotFound(done) {
|
||||
let asset = new imageAssetModule.ImageAsset('invalidFile.png');
|
||||
let asset = new imageAssetModule.ImageAsset("invalidFile.png");
|
||||
asset.options = {
|
||||
width: 0,
|
||||
height: 0,
|
||||
@ -87,7 +87,7 @@ export function testFromAssetFileNotFound(done) {
|
||||
};
|
||||
|
||||
let img = imageSource.fromAsset(asset).then((source) => {
|
||||
done('Should not resolve with invalid file name.');
|
||||
done("Should not resolve with invalid file name.");
|
||||
}, (error) => {
|
||||
TKUnit.assertNotNull(error);
|
||||
done();
|
||||
|
@ -1,10 +1,10 @@
|
||||
import * as stack from "tns-core-modules/ui/layouts/stack-layout";
|
||||
import {unsetValue} from "tns-core-modules/ui/core/view";
|
||||
import { unsetValue } from "tns-core-modules/ui/core/view";
|
||||
|
||||
export function buttonTap(args) {
|
||||
var stackLayout = <stack.StackLayout>args.object.parent;
|
||||
|
||||
for (var i = 0; i < stackLayout.getChildrenCount(); i++){
|
||||
for (var i = 0; i < stackLayout.getChildrenCount(); i++) {
|
||||
var v = stackLayout.getChildAt(i);
|
||||
v.style.fontFamily = unsetValue;
|
||||
v.style.fontSize = unsetValue;
|
||||
|
@ -3,7 +3,7 @@ import * as action from "tns-core-modules/ui/action-bar";
|
||||
|
||||
import * as pages from "tns-core-modules/ui/page";
|
||||
|
||||
var currentPage:pages.Page;
|
||||
var currentPage: pages.Page;
|
||||
// Event handler for Page "loaded" event attached in main-page.xml
|
||||
export function pageLoaded(args: observable.EventData) {
|
||||
// Get the event sender
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as observable from "tns-core-modules/data/observable";
|
||||
import * as trace from "tns-core-modules/trace";
|
||||
import {Button} from "tns-core-modules/ui/button";
|
||||
import {Page} from "tns-core-modules/ui/page";
|
||||
import { Button } from "tns-core-modules/ui/button";
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
trace.addCategories(trace.categories.Layout);
|
||||
trace.enable();
|
||||
|
||||
|
@ -142,7 +142,7 @@ export function test_setInterval_callbackCalledWithExtraArgs(done) {
|
||||
if (counter === 4) {
|
||||
const end = TKUnit.time();
|
||||
timer.clearInterval(id);
|
||||
done(end - start > 250 ? new Error('setInterval too slow.') : null);
|
||||
done(end - start > 250 ? new Error("setInterval too slow.") : null);
|
||||
}
|
||||
}, 50, rnd);
|
||||
};
|
||||
@ -156,7 +156,7 @@ export function test_setInterval_callbackShouldBeCleared(done) {
|
||||
// >> (hide)
|
||||
const end = TKUnit.time();
|
||||
timer.clearInterval(id);
|
||||
done(end - start > 150 ? new Error('setInterval too slow.') : null);
|
||||
done(end - start > 150 ? new Error("setInterval too slow.") : null);
|
||||
// << (hide)
|
||||
timer.clearInterval(id);
|
||||
}, 50);
|
||||
|
@ -154,7 +154,7 @@ export function test_ActionBar_is_not_empty_when_titleView_is_set() {
|
||||
};
|
||||
|
||||
export function test_ActionBarItemBindingToEvent() {
|
||||
const p = <Page>builder.parse('<Page><Page.actionBar><ActionBar><ActionBar.actionItems><ActionItem tap="{{ test }}"/></ActionBar.actionItems></ActionBar></Page.actionBar></Page>');
|
||||
const p = <Page>builder.parse("<Page><Page.actionBar><ActionBar><ActionBar.actionItems><ActionItem tap=\"{{ test }}\"/></ActionBar.actionItems></ActionBar></Page.actionBar></Page>");
|
||||
|
||||
const testAction = function (views: Array<View>) {
|
||||
const page = <Page>views[0];
|
||||
|
@ -1,8 +1,8 @@
|
||||
import * as TKUnit from "../../TKUnit";
|
||||
import * as helper from "../helper";
|
||||
import * as viewModule from "tns-core-modules/ui/core/view";
|
||||
import {Label} from "tns-core-modules/ui/label";
|
||||
import {StackLayout} from "tns-core-modules/ui/layouts/stack-layout";
|
||||
import { Label } from "tns-core-modules/ui/label";
|
||||
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
|
||||
import * as colorModule from "tns-core-modules/color";
|
||||
import * as enums from "tns-core-modules/ui/enums";
|
||||
import { AnimationPromise } from "tns-core-modules/ui/animation";
|
||||
|
@ -7,7 +7,7 @@ import * as stackModule from "tns-core-modules/ui/layouts/stack-layout";
|
||||
import * as labelModule from "tns-core-modules/ui/label";
|
||||
import * as color from "tns-core-modules/color";
|
||||
|
||||
import {SelectorCore} from "tns-core-modules/ui/styling/css-selector";
|
||||
import { SelectorCore } from "tns-core-modules/ui/styling/css-selector";
|
||||
|
||||
const DELTA = 1;
|
||||
const SCALE_DELTA = 0.001;
|
||||
|
@ -277,7 +277,7 @@ export var test_StateHighlighted_also_fires_pressedState = function () {
|
||||
|
||||
helper.waitUntilLayoutReady(view);
|
||||
|
||||
view._goToVisualState('highlighted');
|
||||
view._goToVisualState("highlighted");
|
||||
|
||||
var actualResult = buttonTestsNative.getNativeBackgroundColor(view);
|
||||
TKUnit.assert(actualResult.hex === expectedNormalizedColor, "Actual: " + actualResult.hex + "; Expected: " + expectedNormalizedColor);
|
||||
@ -294,7 +294,7 @@ export var test_StateHighlighted_also_fires_activeState = function () {
|
||||
|
||||
helper.waitUntilLayoutReady(view);
|
||||
|
||||
view._goToVisualState('highlighted');
|
||||
view._goToVisualState("highlighted");
|
||||
|
||||
var actualResult = buttonTestsNative.getNativeBackgroundColor(view);
|
||||
TKUnit.assert(actualResult.hex === expectedNormalizedColor, "Actual: " + actualResult.hex + "; Expected: " + expectedNormalizedColor);
|
||||
@ -393,7 +393,7 @@ export function test_setting_formattedText_With_UnknownFont_DoesNotCrash() {
|
||||
btn.style.fontFamily = "_UnknownFont";
|
||||
|
||||
helper.buildUIAndRunTest(btn, function (views) {
|
||||
TKUnit.waitUntilReady(() => { return btn.isLayoutValid; });
|
||||
TKUnit.waitUntilReady(() => btn.isLayoutValid);
|
||||
|
||||
let span = new spanModule.Span();
|
||||
span.text = "Login";
|
||||
@ -401,6 +401,6 @@ export function test_setting_formattedText_With_UnknownFont_DoesNotCrash() {
|
||||
formattedString.spans.push(span);
|
||||
btn.formattedText = formattedString;
|
||||
|
||||
TKUnit.waitUntilReady(() => { return btn.isLayoutValid; });
|
||||
TKUnit.waitUntilReady(() => btn.isLayoutValid);
|
||||
});
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ export function test_Binding_to_bindingContext_of_View() {
|
||||
const source = new Button();
|
||||
|
||||
target.bind({ targetProperty: "bindingContext", sourceProperty: "text" }, source);
|
||||
source.text = 'a';
|
||||
TKUnit.assertEqual(target.bindingContext, 'a');
|
||||
source.text = "a";
|
||||
TKUnit.assertEqual(target.bindingContext, "a");
|
||||
};
|
||||
|
||||
export function test_Bindable_Bind_ToTarget_OneWay() {
|
||||
@ -220,7 +220,7 @@ export function test_WhenBindingIsSetToAnElement_AndElementIsRemoved_ShouldBeCol
|
||||
stack.addChild(weakRef.get());
|
||||
TKUnit.assertEqual(weakRef.get().text, expectedValue, "Binding is not working properly!");
|
||||
stack.removeChild(weakRef.get());
|
||||
TKUnit.waitUntilReady(() => { return !weakRef.get().isLoaded; });
|
||||
TKUnit.waitUntilReady(() => !weakRef.get().isLoaded);
|
||||
utils.GC();
|
||||
TKUnit.assert(!weakRef.get(), "UIElement is still alive!");
|
||||
testFinished = true;
|
||||
@ -232,7 +232,7 @@ export function test_WhenBindingIsSetToAnElement_AndElementIsRemoved_ShouldBeCol
|
||||
|
||||
page.content = stack;
|
||||
|
||||
TKUnit.waitUntilReady(() => { return testFinished; });
|
||||
TKUnit.waitUntilReady(() => testFinished);
|
||||
done(null);
|
||||
}
|
||||
|
||||
@ -498,7 +498,7 @@ export function test_bindingToNestedPropertyWithValueSyntax() {
|
||||
}, bindingSource);
|
||||
|
||||
TKUnit.assertEqual(testElement.get("targetPropertyName"), "testValue");
|
||||
TKUnit.assertTrue(bindingSource['$value'] === undefined, "We should not add $value to bindingSource.");
|
||||
TKUnit.assertTrue(bindingSource["$value"] === undefined, "We should not add $value to bindingSource.");
|
||||
};
|
||||
|
||||
export function test_TwoElementsBindingToSameBindingContext() {
|
||||
@ -569,8 +569,8 @@ export function test_BindingToParentView_ShouldNotLeaveGarbageInViewModel() {
|
||||
testLabel.bind({ sourceProperty: "$parent.testProperty", targetProperty: "text", expression: "$parent.testProperty" });
|
||||
|
||||
TKUnit.assertEqual(testLabel.text, expectedValue);
|
||||
TKUnit.assertTrue(stackViewModel['$parent'] === undefined, "stackViewModel['$parent'] should be removed from parent binding context.");
|
||||
TKUnit.assertTrue(testLabel.bindingContext['$parent'] === undefined, "testLabel.bindingContext['$parent'] should be removed from parent binding context.");
|
||||
TKUnit.assertTrue(stackViewModel["$parent"] === undefined, "stackViewModel['$parent'] should be removed from parent binding context.");
|
||||
TKUnit.assertTrue(testLabel.bindingContext["$parent"] === undefined, "testLabel.bindingContext['$parent'] should be removed from parent binding context.");
|
||||
};
|
||||
|
||||
helper.buildUIAndRunTest(createStack(), testFunc);
|
||||
@ -595,8 +595,8 @@ export function test_BindingToParentsView_ShouldNotLeaveGarbageInViewModel() {
|
||||
testLabel.bind({ sourceProperty: "$parents['StackLayout'].testProperty", targetProperty: "text", expression: "$parents['StackLayout'].testProperty" });
|
||||
|
||||
TKUnit.assertEqual(testLabel.text, expectedValue);
|
||||
TKUnit.assertTrue(stackViewModel['$parent'] === undefined, "stackViewModel['$parent'] should be removed from parent binding context.");
|
||||
TKUnit.assertTrue(testLabel.bindingContext['$parents'] === undefined, "testLabel.bindingContext['$parents'] should be removed from parent binding context.");
|
||||
TKUnit.assertTrue(stackViewModel["$parent"] === undefined, "stackViewModel['$parent'] should be removed from parent binding context.");
|
||||
TKUnit.assertTrue(testLabel.bindingContext["$parents"] === undefined, "testLabel.bindingContext['$parents'] should be removed from parent binding context.");
|
||||
};
|
||||
|
||||
helper.buildUIAndRunTest(createStack(), testFunc);
|
||||
@ -1084,7 +1084,7 @@ export function test_$ValueSupportWithinExpression() {
|
||||
model.set("anyColor", "red");
|
||||
|
||||
TKUnit.assertEqual(bindableObj.get("text"), "red", "When anyColor is red test property should be red too.");
|
||||
TKUnit.assertTrue(model['$value'] === undefined, "We should not add $value to binding context.");
|
||||
TKUnit.assertTrue(model["$value"] === undefined, "We should not add $value to binding context.");
|
||||
}
|
||||
|
||||
class DummyNestedClass extends Observable {
|
||||
@ -1095,7 +1095,7 @@ class DummyNestedClass extends Observable {
|
||||
public set secondsobject(value: number) {
|
||||
if (this._secondsobject !== value) {
|
||||
this._secondsobject = value;
|
||||
this.notifyPropertyChange('secondsobject', value);
|
||||
this.notifyPropertyChange("secondsobject", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1109,7 +1109,7 @@ class DummyClassWithSamePropertyNames extends Observable {
|
||||
public set seconds(value: number) {
|
||||
if (this._seconds !== value) {
|
||||
this._seconds = value;
|
||||
this.notifyPropertyChange('seconds', value);
|
||||
this.notifyPropertyChange("seconds", value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1119,7 +1119,7 @@ class DummyClassWithSamePropertyNames extends Observable {
|
||||
public set secondsobject(value: DummyNestedClass) {
|
||||
if (this._secondsobject !== value) {
|
||||
this._secondsobject = value;
|
||||
this.notifyPropertyChange('secondsobject', value);
|
||||
this.notifyPropertyChange("secondsobject", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1245,14 +1245,14 @@ export function test_BindingToRelatedProps() {
|
||||
model.prop2 = "Alabala";
|
||||
|
||||
let target1 = new Label();
|
||||
target1.bind({ sourceProperty: 'prop1', targetProperty: 'targetProp1' }, model);
|
||||
target1.bind({ sourceProperty: "prop1", targetProperty: "targetProp1" }, model);
|
||||
|
||||
let target2 = new Label();
|
||||
target2.bind({ sourceProperty: 'prop2', targetProperty: 'targetProp2' }, model);
|
||||
target2.bind({ sourceProperty: "prop2", targetProperty: "targetProp2" }, model);
|
||||
|
||||
model.prop2 = "Tralala";
|
||||
|
||||
TKUnit.assertEqual(target2.get('targetProp2'), "Tralala");
|
||||
TKUnit.assertEqual(target2.get("targetProp2"), "Tralala");
|
||||
}
|
||||
|
||||
export function test_only_Bindable_BindingContext_Null_DoesNotThrow() {
|
||||
@ -1314,18 +1314,18 @@ export function test_BindingToBindingContextProperty_ShouldUseNewContext() {
|
||||
stackLayout.addChild(label);
|
||||
|
||||
label.bind({
|
||||
sourceProperty: 'context',
|
||||
targetProperty: 'bindingContext'
|
||||
sourceProperty: "context",
|
||||
targetProperty: "bindingContext"
|
||||
});
|
||||
|
||||
label.bind({
|
||||
sourceProperty: 'text',
|
||||
targetProperty: 'text'
|
||||
sourceProperty: "text",
|
||||
targetProperty: "text"
|
||||
});
|
||||
|
||||
let testBindingContext = fromObjectRecursive({
|
||||
context: {
|
||||
text: 'Alabala'
|
||||
text: "Alabala"
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -15,11 +15,11 @@ export function getNativeDay(datePicker: datePickerModule.DatePicker): number {
|
||||
}
|
||||
|
||||
export function getNativeMaxDate(datePicker: datePickerModule.DatePicker): Date {
|
||||
return new Date(1000* NSDate.dateWithTimeIntervalSinceDate(0, datePicker.ios.maximumDate).timeIntervalSince1970);
|
||||
return new Date(1000 * NSDate.dateWithTimeIntervalSinceDate(0, datePicker.ios.maximumDate).timeIntervalSince1970);
|
||||
}
|
||||
|
||||
export function getNativeMinDate(datePicker: datePickerModule.DatePicker): Date {
|
||||
return new Date(1000* NSDate.dateWithTimeIntervalSinceDate(0, datePicker.ios.minimumDate).timeIntervalSince1970);
|
||||
return new Date(1000 * NSDate.dateWithTimeIntervalSinceDate(0, datePicker.ios.minimumDate).timeIntervalSince1970);
|
||||
}
|
||||
|
||||
export function setNativeYear(datePicker: datePickerModule.DatePicker, value: number): void {
|
||||
|
@ -112,7 +112,7 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke
|
||||
}
|
||||
|
||||
public test_WhenCreated_NativeDayIsCurrentDay() {
|
||||
const actualValue = datePickerTestsNative.getNativeDay(this.testView);;
|
||||
const actualValue = datePickerTestsNative.getNativeDay(this.testView);
|
||||
const expectedValue = currentDate.getDate();
|
||||
TKUnit.assertEqual(actualValue, expectedValue);
|
||||
}
|
||||
|
@ -71,63 +71,63 @@ export function test_can_go_back() {
|
||||
frame.navigate({ create: () => new Page(), backstackVisible: false });
|
||||
frame.navigate(() => new Page());
|
||||
|
||||
TKUnit.assertTrue(frame.canGoBack(), '1');
|
||||
TKUnit.assertTrue(frame.canGoBack(), "1");
|
||||
frame.goBack();
|
||||
|
||||
TKUnit.assertTrue(frame.canGoBack(), '2');
|
||||
TKUnit.assertTrue(frame.canGoBack(), "2");
|
||||
frame.goBack();
|
||||
|
||||
TKUnit.assertTrue(frame.canGoBack(), '3');
|
||||
TKUnit.assertTrue(frame.canGoBack(), "3");
|
||||
frame.goBack();
|
||||
|
||||
TKUnit.assertFalse(frame.canGoBack(), '4');
|
||||
TKUnit.assertFalse(frame.canGoBack(), "4");
|
||||
frame.goBack();
|
||||
|
||||
frame.navigate({ create: () => new Page(), backstackVisible: false });
|
||||
frame.navigate(() => new Page());
|
||||
|
||||
TKUnit.assertTrue(frame.canGoBack(), '5');
|
||||
TKUnit.assertTrue(frame.canGoBack(), "5");
|
||||
frame.goBack();
|
||||
|
||||
TKUnit.assertFalse(frame.canGoBack(), '6');
|
||||
TKUnit.assertFalse(frame.canGoBack(), "6");
|
||||
frame.goBack();
|
||||
|
||||
frame.navigate(() => new Page());
|
||||
frame.navigate({ create: () => new Page(), clearHistory: true });
|
||||
|
||||
TKUnit.assertFalse(frame.canGoBack(), '7');
|
||||
TKUnit.assertFalse(frame.canGoBack(), "7");
|
||||
frame.goBack();
|
||||
|
||||
frame.navigate(() => new Page());
|
||||
frame.navigate({ create: () => new Page(), backstackVisible: false });
|
||||
|
||||
TKUnit.assertTrue(frame.canGoBack(), '8');
|
||||
TKUnit.assertTrue(frame.canGoBack(), "8");
|
||||
frame.goBack();
|
||||
|
||||
TKUnit.assertTrue(frame.canGoBack(), '9');
|
||||
TKUnit.assertTrue(frame.canGoBack(), "9");
|
||||
frame.goBack();
|
||||
|
||||
TKUnit.assertFalse(frame.canGoBack(), '10');
|
||||
TKUnit.assertFalse(frame.canGoBack(), "10");
|
||||
frame.goBack();
|
||||
|
||||
frame.navigate(() => new Page());
|
||||
frame.navigate({ create: () => new Page(), clearHistory: true });
|
||||
frame.navigate({ create: () => new Page(), backstackVisible: false });
|
||||
|
||||
TKUnit.assertTrue(frame.canGoBack(), '11');
|
||||
TKUnit.assertTrue(frame.canGoBack(), "11");
|
||||
frame.goBack();
|
||||
|
||||
TKUnit.assertFalse(frame.canGoBack(), '12');
|
||||
TKUnit.assertFalse(frame.canGoBack(), "12");
|
||||
frame.goBack();
|
||||
|
||||
frame.navigate({ create: () => new Page(), clearHistory: true });
|
||||
frame.navigate({ create: () => new Page(), backstackVisible: false });
|
||||
frame.navigate(() => new Page());
|
||||
|
||||
TKUnit.assertTrue(frame.canGoBack(), '13');
|
||||
TKUnit.assertTrue(frame.canGoBack(), "13");
|
||||
frame.goBack();
|
||||
|
||||
TKUnit.assertFalse(frame.canGoBack(), '14');
|
||||
TKUnit.assertFalse(frame.canGoBack(), "14");
|
||||
frame.goBack();
|
||||
TKUnit.waitUntilReady(() => frame.navigationQueueIsEmpty());
|
||||
}
|
||||
@ -142,10 +142,10 @@ export function test_go_back_to_backstack_entry() {
|
||||
frame.navigate({ create: () => new Page(), backstackVisible: false });
|
||||
frame.navigate(() => new Page());
|
||||
|
||||
TKUnit.assertTrue(frame.canGoBack(), '1');
|
||||
TKUnit.assertTrue(frame.canGoBack(), "1");
|
||||
frame.goBack(frame.backStack[0]);
|
||||
|
||||
TKUnit.assertFalse(frame.canGoBack(), '2');
|
||||
TKUnit.assertFalse(frame.canGoBack(), "2");
|
||||
frame.goBack();
|
||||
TKUnit.waitUntilReady(() => frame.navigationQueueIsEmpty());
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ export function getClearCurrentPage(): Page {
|
||||
page.bindingContext = unsetValue;
|
||||
page.className = unsetValue;
|
||||
page.id = unsetValue;
|
||||
page.css = '';
|
||||
page.css = "";
|
||||
return page;
|
||||
}
|
||||
|
||||
@ -335,22 +335,22 @@ function compareUsingReflection(recycledNativeView: View, newNativeView: View):
|
||||
const method = methods[i];
|
||||
const returnType = method.getReturnType();
|
||||
const name = method.getName();
|
||||
const skip = name.includes('ViewId')
|
||||
|| name.includes('Accessibility')
|
||||
|| name.includes('hashCode')
|
||||
|| name === 'getId'
|
||||
|| name === 'hasFocus'
|
||||
|| name === 'isDirty'
|
||||
|| name === 'getLeft'
|
||||
|| name === 'getTop'
|
||||
|| name === 'getRight'
|
||||
|| name === 'getBottom'
|
||||
|| name === 'getWidth'
|
||||
|| name === 'getHeight'
|
||||
|| name === 'getX'
|
||||
|| name === 'getY'
|
||||
|| name.includes('getMeasured')
|
||||
|| name === 'toString';
|
||||
const skip = name.includes("ViewId")
|
||||
|| name.includes("Accessibility")
|
||||
|| name.includes("hashCode")
|
||||
|| name === "getId"
|
||||
|| name === "hasFocus"
|
||||
|| name === "isDirty"
|
||||
|| name === "getLeft"
|
||||
|| name === "getTop"
|
||||
|| name === "getRight"
|
||||
|| name === "getBottom"
|
||||
|| name === "getWidth"
|
||||
|| name === "getHeight"
|
||||
|| name === "getX"
|
||||
|| name === "getY"
|
||||
|| name.includes("getMeasured")
|
||||
|| name === "toString";
|
||||
|
||||
if (skip || method.getParameterTypes().length > 0) {
|
||||
continue;
|
||||
@ -375,7 +375,7 @@ function compareUsingReflection(recycledNativeView: View, newNativeView: View):
|
||||
|
||||
const defValue = method.invoke(newer, null);
|
||||
const currValue = method.invoke(recycled, null);
|
||||
if ((currValue + '') !== (defValue + '')) {
|
||||
if ((currValue + "") !== (defValue + "")) {
|
||||
throw new Error(`Actual: ${currValue}, Expected: ${defValue}, for method: ${method.getName()}`);
|
||||
}
|
||||
}
|
||||
@ -401,9 +401,9 @@ function setValue(object: Object, setters: Map<string, any>, customSetters?: Map
|
||||
let value = customSetters && customSetters.has(key) ? customSetters.get(key) : value1;
|
||||
const currentValue = object[key];
|
||||
if (currentValue === value) {
|
||||
if (value === 'horizontal' && key === 'orientation') {
|
||||
if (value === "horizontal" && key === "orientation") {
|
||||
// wrap-layout.orientation default value is 'horizontal'
|
||||
value = 'vertical';
|
||||
value = "vertical";
|
||||
} else if (value === 2) {
|
||||
value = 3;
|
||||
}
|
||||
@ -422,247 +422,247 @@ function setupSetters(): void {
|
||||
|
||||
setters = new Map<string, any>();
|
||||
// view-base
|
||||
setters.set('id', "someId");
|
||||
setters.set('className', "someClassName");
|
||||
setters.set('bindingContext', "someBindingContext");
|
||||
setters.set("id", "someId");
|
||||
setters.set("className", "someClassName");
|
||||
setters.set("bindingContext", "someBindingContext");
|
||||
|
||||
// view
|
||||
setters.set('automationText', "automationText");
|
||||
setters.set('originX', 0.2);
|
||||
setters.set('originY', 0.2);
|
||||
setters.set('isEnabled', false);
|
||||
setters.set('isUserInteractionEnabled', false);
|
||||
setters.set("automationText", "automationText");
|
||||
setters.set("originX", 0.2);
|
||||
setters.set("originY", 0.2);
|
||||
setters.set("isEnabled", false);
|
||||
setters.set("isUserInteractionEnabled", false);
|
||||
|
||||
// action-bar
|
||||
setters.set('title', 'title');
|
||||
setters.set('text', 'text');
|
||||
setters.set('icon', '~/logo.png');
|
||||
setters.set('visibility', 'collapse');
|
||||
setters.set("title", "title");
|
||||
setters.set("text", "text");
|
||||
setters.set("icon", "~/logo.png");
|
||||
setters.set("visibility", "collapse");
|
||||
|
||||
// activity-indicator
|
||||
setters.set('busy', true);
|
||||
setters.set("busy", true);
|
||||
|
||||
// date-picker
|
||||
setters.set('year', '2010');
|
||||
setters.set('month', '2');
|
||||
setters.set('day', '2');
|
||||
setters.set('maxDate', '2100');
|
||||
setters.set('minDate', '2000');
|
||||
setters.set('date', new Date(2011, 3, 3));
|
||||
setters.set("year", "2010");
|
||||
setters.set("month", "2");
|
||||
setters.set("day", "2");
|
||||
setters.set("maxDate", "2100");
|
||||
setters.set("minDate", "2000");
|
||||
setters.set("date", new Date(2011, 3, 3));
|
||||
|
||||
// editable-text
|
||||
setters.set('keyboardType', 'datetime');
|
||||
setters.set('returnKeyType', 'done');
|
||||
setters.set('editable', false);
|
||||
setters.set('updateTextTrigger', 'focusLost');
|
||||
setters.set('autocapitalizationType', 'words');
|
||||
setters.set('autocorrect', true);
|
||||
setters.set('hint', 'hint');
|
||||
setters.set('maxLength', '10');
|
||||
setters.set("keyboardType", "datetime");
|
||||
setters.set("returnKeyType", "done");
|
||||
setters.set("editable", false);
|
||||
setters.set("updateTextTrigger", "focusLost");
|
||||
setters.set("autocapitalizationType", "words");
|
||||
setters.set("autocorrect", true);
|
||||
setters.set("hint", "hint");
|
||||
setters.set("maxLength", "10");
|
||||
|
||||
// html-view
|
||||
setters.set('html', '<a></a>');
|
||||
setters.set("html", "<a></a>");
|
||||
|
||||
// image-view
|
||||
setters.set('imageSource', '');
|
||||
setters.set('src', '');
|
||||
setters.set('loadMode', 'async');
|
||||
setters.set('isLoading', true);
|
||||
setters.set('stretch', 'none');
|
||||
setters.set("imageSource", "");
|
||||
setters.set("src", "");
|
||||
setters.set("loadMode", "async");
|
||||
setters.set("isLoading", true);
|
||||
setters.set("stretch", "none");
|
||||
|
||||
// layout-base
|
||||
setters.set('clipToBounds', false);
|
||||
setters.set("clipToBounds", false);
|
||||
|
||||
// absolute-layout
|
||||
setters.set('left', '20');
|
||||
setters.set('top', '20');
|
||||
setters.set("left", "20");
|
||||
setters.set("top", "20");
|
||||
|
||||
// dock-layout
|
||||
setters.set('dock', 'top');
|
||||
setters.set('stretchLastChild', false);
|
||||
setters.set("dock", "top");
|
||||
setters.set("stretchLastChild", false);
|
||||
|
||||
// grid-layout props
|
||||
setters.set('row', '1');
|
||||
setters.set('rowSpan', '2');
|
||||
setters.set('col', '1');
|
||||
setters.set('colSpan', '2');
|
||||
setters.set("row", "1");
|
||||
setters.set("rowSpan", "2");
|
||||
setters.set("col", "1");
|
||||
setters.set("colSpan", "2");
|
||||
|
||||
// stack-layout
|
||||
setters.set('orientation', 'horizontal');
|
||||
setters.set("orientation", "horizontal");
|
||||
|
||||
// wrap-layout
|
||||
// custom orientation value
|
||||
// setters.set('orientation', 'vertical');
|
||||
setters.set('itemWidth', '50');
|
||||
setters.set('itemHeight', '50');
|
||||
setters.set("itemWidth", "50");
|
||||
setters.set("itemHeight", "50");
|
||||
|
||||
// list-picker
|
||||
setters.set('items', ['1', '2', '3']);
|
||||
setters.set('selectedIndex', '1');
|
||||
setters.set("items", ["1", "2", "3"]);
|
||||
setters.set("selectedIndex", "1");
|
||||
|
||||
// list-view
|
||||
setters.set('items', ['1', '2', '3']);
|
||||
setters.set('itemTemplate', '<Label text="{{ $value }}" />');
|
||||
setters.set('itemTemplates', '<template key="green"><Label text="{{ $value }}" style.backgroundColor="green" /></template><template key="red"><Label text="{{ $value }}" style.backgroundColor="red" /></template>');
|
||||
setters.set('rowHeight', '50');
|
||||
setters.set("items", ["1", "2", "3"]);
|
||||
setters.set("itemTemplate", "<Label text=\"{{ $value }}\" />");
|
||||
setters.set("itemTemplates", "<template key=\"green\"><Label text=\"{{ $value }}\" style.backgroundColor=\"green\" /></template><template key=\"red\"><Label text=\"{{ $value }}\" style.backgroundColor=\"red\" /></template>");
|
||||
setters.set("rowHeight", "50");
|
||||
|
||||
// page
|
||||
setters.set('actionBarHidden', 'true');
|
||||
setters.set('backgroundSpanUnderStatusBar', 'true');
|
||||
setters.set('enableSwipeBackNavigation', 'false');
|
||||
setters.set("actionBarHidden", "true");
|
||||
setters.set("backgroundSpanUnderStatusBar", "true");
|
||||
setters.set("enableSwipeBackNavigation", "false");
|
||||
|
||||
// progress
|
||||
setters.set('value', '1');
|
||||
setters.set('maxValue', '99');
|
||||
setters.set("value", "1");
|
||||
setters.set("maxValue", "99");
|
||||
|
||||
// repeater
|
||||
setters.set('items', ['1', '2', '3']);
|
||||
setters.set('itemTemplate', '<Label text="{{ $value }}" />');
|
||||
setters.set('itemsLayout', new StackLayout());
|
||||
setters.set('rowHeight', '50');
|
||||
setters.set("items", ["1", "2", "3"]);
|
||||
setters.set("itemTemplate", "<Label text=\"{{ $value }}\" />");
|
||||
setters.set("itemsLayout", new StackLayout());
|
||||
setters.set("rowHeight", "50");
|
||||
|
||||
// scroll-view
|
||||
// custom orientation value
|
||||
//setters.set('orientation', 'horizontal');
|
||||
|
||||
// search-bar
|
||||
setters.set('textFieldHintColor', 'red');
|
||||
setters.set('textFieldBackgroundColor', 'red');
|
||||
setters.set("textFieldHintColor", "red");
|
||||
setters.set("textFieldBackgroundColor", "red");
|
||||
|
||||
// segmented-bar
|
||||
// custom items property
|
||||
|
||||
// slider
|
||||
setters.set('minValue', '5');
|
||||
setters.set("minValue", "5");
|
||||
|
||||
// switch
|
||||
setters.set('checked', 'true');
|
||||
setters.set("checked", "true");
|
||||
|
||||
// tab-view
|
||||
// custom items property
|
||||
setters.set('androidOffscreenTabLimit', '2');
|
||||
setters.set("androidOffscreenTabLimit", "2");
|
||||
|
||||
// text-base
|
||||
const formattedText = new FormattedString();
|
||||
const span = new Span();
|
||||
span.text = 'span';
|
||||
span.text = "span";
|
||||
formattedText.spans.push(span);
|
||||
setters.set('formattedText', formattedText);
|
||||
setters.set("formattedText", formattedText);
|
||||
|
||||
// text-base
|
||||
setters.set('secure', 'true');
|
||||
setters.set("secure", "true");
|
||||
|
||||
// time-picker
|
||||
setters.set('minHour', 1);
|
||||
setters.set('hour', 2);
|
||||
setters.set('maxHour', 11);
|
||||
setters.set('minMinute', 1);
|
||||
setters.set('minute', 2);
|
||||
setters.set('maxMinute', 11);
|
||||
setters.set('minuteInterval', 2);
|
||||
setters.set('time', new Date(2011, 2, 2, 3, 3, 3));
|
||||
setters.set("minHour", 1);
|
||||
setters.set("hour", 2);
|
||||
setters.set("maxHour", 11);
|
||||
setters.set("minMinute", 1);
|
||||
setters.set("minute", 2);
|
||||
setters.set("maxMinute", 11);
|
||||
setters.set("minuteInterval", 2);
|
||||
setters.set("time", new Date(2011, 2, 2, 3, 3, 3));
|
||||
|
||||
cssSetters = new Map<string, any>();
|
||||
|
||||
// style
|
||||
cssSetters.set('rotate', '90');
|
||||
cssSetters.set('scaleX', 2);
|
||||
cssSetters.set('scaleY', 2);
|
||||
cssSetters.set('translateX', 20);
|
||||
cssSetters.set('translateY', 20);
|
||||
cssSetters.set("rotate", "90");
|
||||
cssSetters.set("scaleX", 2);
|
||||
cssSetters.set("scaleY", 2);
|
||||
cssSetters.set("translateX", 20);
|
||||
cssSetters.set("translateY", 20);
|
||||
|
||||
cssSetters.set('clipPath', 'inset(100px 50px)');
|
||||
cssSetters.set('color', 'red');
|
||||
cssSetters.set('tintColor', 'green');
|
||||
cssSetters.set('placeholderColor', 'green');
|
||||
cssSetters.set("clipPath", "inset(100px 50px)");
|
||||
cssSetters.set("color", "red");
|
||||
cssSetters.set("tintColor", "green");
|
||||
cssSetters.set("placeholderColor", "green");
|
||||
|
||||
cssSetters.set('backgroundColor', 'red');
|
||||
cssSetters.set('backgroundImage', '~/logo.png');
|
||||
cssSetters.set('backgroundRepeat', 'repeat');
|
||||
cssSetters.set('backgroundSize', '60px 120px');
|
||||
cssSetters.set('backgroundPosition', 'center');
|
||||
cssSetters.set('borderColor', 'blue');
|
||||
cssSetters.set('borderTopColor', 'green');
|
||||
cssSetters.set('borderRightColor', 'green');
|
||||
cssSetters.set('borderBottomColor', 'green');
|
||||
cssSetters.set('borderLeftColor', 'green');
|
||||
cssSetters.set('borderWidth', '10px');
|
||||
cssSetters.set('borderTopWidth', '5px');
|
||||
cssSetters.set('borderRightWidth', '5px');
|
||||
cssSetters.set('borderBottomWidth', '5px');
|
||||
cssSetters.set('borderLeftWidth', '5px');
|
||||
cssSetters.set('borderRadius', '10px');
|
||||
cssSetters.set('borderTopLeftRadius', '5px');
|
||||
cssSetters.set('borderTopRightRadius', '5px');
|
||||
cssSetters.set('borderBottomRightRadius', '5px');
|
||||
cssSetters.set('borderBottomLeftRadius', '5px');
|
||||
cssSetters.set("backgroundColor", "red");
|
||||
cssSetters.set("backgroundImage", "~/logo.png");
|
||||
cssSetters.set("backgroundRepeat", "repeat");
|
||||
cssSetters.set("backgroundSize", "60px 120px");
|
||||
cssSetters.set("backgroundPosition", "center");
|
||||
cssSetters.set("borderColor", "blue");
|
||||
cssSetters.set("borderTopColor", "green");
|
||||
cssSetters.set("borderRightColor", "green");
|
||||
cssSetters.set("borderBottomColor", "green");
|
||||
cssSetters.set("borderLeftColor", "green");
|
||||
cssSetters.set("borderWidth", "10px");
|
||||
cssSetters.set("borderTopWidth", "5px");
|
||||
cssSetters.set("borderRightWidth", "5px");
|
||||
cssSetters.set("borderBottomWidth", "5px");
|
||||
cssSetters.set("borderLeftWidth", "5px");
|
||||
cssSetters.set("borderRadius", "10px");
|
||||
cssSetters.set("borderTopLeftRadius", "5px");
|
||||
cssSetters.set("borderTopRightRadius", "5px");
|
||||
cssSetters.set("borderBottomRightRadius", "5px");
|
||||
cssSetters.set("borderBottomLeftRadius", "5px");
|
||||
|
||||
cssSetters.set('fontSize', '20');
|
||||
cssSetters.set('fontFamily', 'monospace');
|
||||
cssSetters.set('fontStyle', 'italic');
|
||||
cssSetters.set('fontWeight', '100');
|
||||
cssSetters.set('font', 'italic 2 "Open Sans", sans-serif');
|
||||
cssSetters.set("fontSize", "20");
|
||||
cssSetters.set("fontFamily", "monospace");
|
||||
cssSetters.set("fontStyle", "italic");
|
||||
cssSetters.set("fontWeight", "100");
|
||||
cssSetters.set("font", "italic 2 \"Open Sans\", sans-serif");
|
||||
|
||||
// zIndex on android is not what you think...
|
||||
// cssSetters.set('zIndex', '2');
|
||||
cssSetters.set('opacity', '0.5');
|
||||
cssSetters.set("opacity", "0.5");
|
||||
// already set through view properties.
|
||||
// cssSetters.set('visibility', 'collapse');
|
||||
|
||||
cssSetters.set('letterSpacing', '2');
|
||||
cssSetters.set('textAlignment', 'center');
|
||||
cssSetters.set('textDecoration', 'underline');
|
||||
cssSetters.set('textTransform', 'capitalize');
|
||||
cssSetters.set('whiteSpace', 'normal');
|
||||
cssSetters.set("letterSpacing", "2");
|
||||
cssSetters.set("textAlignment", "center");
|
||||
cssSetters.set("textDecoration", "underline");
|
||||
cssSetters.set("textTransform", "capitalize");
|
||||
cssSetters.set("whiteSpace", "normal");
|
||||
|
||||
cssSetters.set('minWidth', 50);
|
||||
cssSetters.set('minHeight', 50);
|
||||
cssSetters.set('width', 100);
|
||||
cssSetters.set('height', 100);
|
||||
cssSetters.set('margin', '25');
|
||||
cssSetters.set('marginLeft', '30px');
|
||||
cssSetters.set('marginTop', '30px');
|
||||
cssSetters.set('marginRight', '30px');
|
||||
cssSetters.set('marginBottom', '30px');
|
||||
cssSetters.set('padding', '25');
|
||||
cssSetters.set('paddingLeft', '30px');
|
||||
cssSetters.set('paddingTop', '30px');
|
||||
cssSetters.set('paddingRight', '30px');
|
||||
cssSetters.set('paddingBottom', '30px');
|
||||
cssSetters.set('horizontalAlignment', 'center');
|
||||
cssSetters.set('verticalAlignment', 'center');
|
||||
cssSetters.set("minWidth", 50);
|
||||
cssSetters.set("minHeight", 50);
|
||||
cssSetters.set("width", 100);
|
||||
cssSetters.set("height", 100);
|
||||
cssSetters.set("margin", "25");
|
||||
cssSetters.set("marginLeft", "30px");
|
||||
cssSetters.set("marginTop", "30px");
|
||||
cssSetters.set("marginRight", "30px");
|
||||
cssSetters.set("marginBottom", "30px");
|
||||
cssSetters.set("padding", "25");
|
||||
cssSetters.set("paddingLeft", "30px");
|
||||
cssSetters.set("paddingTop", "30px");
|
||||
cssSetters.set("paddingRight", "30px");
|
||||
cssSetters.set("paddingBottom", "30px");
|
||||
cssSetters.set("horizontalAlignment", "center");
|
||||
cssSetters.set("verticalAlignment", "center");
|
||||
|
||||
cssSetters.set('transform', 'translate(5, 10), scale(1.2, 1.2), rotate(45)');
|
||||
cssSetters.set("transform", "translate(5, 10), scale(1.2, 1.2), rotate(45)");
|
||||
|
||||
// TabView-specific props
|
||||
cssSetters.set('tabTextColor', 'red');
|
||||
cssSetters.set('tabBackgroundColor', 'red');
|
||||
cssSetters.set('selectedTabTextColor', 'red');
|
||||
cssSetters.set('androidSelectedTabHighlightColor', 'red');
|
||||
cssSetters.set("tabTextColor", "red");
|
||||
cssSetters.set("tabBackgroundColor", "red");
|
||||
cssSetters.set("selectedTabTextColor", "red");
|
||||
cssSetters.set("androidSelectedTabHighlightColor", "red");
|
||||
|
||||
// ListView-specific props
|
||||
cssSetters.set('separatorColor', 'red');
|
||||
cssSetters.set("separatorColor", "red");
|
||||
|
||||
// SegmentedBar-specific props
|
||||
cssSetters.set('selectedBackgroundColor', 'red');
|
||||
cssSetters.set("selectedBackgroundColor", "red");
|
||||
|
||||
// Page-specific props
|
||||
cssSetters.set('statusBarStyle', 'light');
|
||||
cssSetters.set('androidStatusBarBackground', 'red');
|
||||
cssSetters.set("statusBarStyle", "light");
|
||||
cssSetters.set("androidStatusBarBackground", "red");
|
||||
|
||||
// Flexbox-layout props
|
||||
cssSetters.set('flexDirection', 'column');
|
||||
cssSetters.set('flexWrap', 'wrap');
|
||||
cssSetters.set('justifyContent', 'center');
|
||||
cssSetters.set('alignItems', 'center');
|
||||
cssSetters.set('alignContent', 'center');
|
||||
cssSetters.set('order', '2');
|
||||
cssSetters.set('flexGrow', '1');
|
||||
cssSetters.set('flexShrink', '0');
|
||||
cssSetters.set('flexWrapBefore', 'true');
|
||||
cssSetters.set('alignSelf', 'center');
|
||||
cssSetters.set('flexFlow', 'row-reverse wrap');
|
||||
cssSetters.set('flex', '2 0.2');
|
||||
cssSetters.set("flexDirection", "column");
|
||||
cssSetters.set("flexWrap", "wrap");
|
||||
cssSetters.set("justifyContent", "center");
|
||||
cssSetters.set("alignItems", "center");
|
||||
cssSetters.set("alignContent", "center");
|
||||
cssSetters.set("order", "2");
|
||||
cssSetters.set("flexGrow", "1");
|
||||
cssSetters.set("flexShrink", "0");
|
||||
cssSetters.set("flexWrapBefore", "true");
|
||||
cssSetters.set("alignSelf", "center");
|
||||
cssSetters.set("flexFlow", "row-reverse wrap");
|
||||
cssSetters.set("flex", "2 0.2");
|
||||
|
||||
const nativeGetters = defaultNativeGetters = new Map<string, (view) => any>();
|
||||
|
||||
|
@ -23,7 +23,7 @@ export var testLoadHTMLString = function () {
|
||||
page.content = htmlView;
|
||||
|
||||
// >> htmlview-using
|
||||
htmlView.html = '<span><font color="#ff0000">Test</font></span>';
|
||||
htmlView.html = "<span><font color=\"#ff0000\">Test</font></span>";
|
||||
// << htmlview-using
|
||||
|
||||
if (htmlView.ios) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as TKUnit from "../../TKUnit";
|
||||
import * as layoutHelper from "./layout-helper";
|
||||
import * as testModule from "../../ui-test";
|
||||
import {LayoutBase, unsetValue, PercentLength} from "tns-core-modules/ui/layouts/layout-base";
|
||||
import { LayoutBase, unsetValue, PercentLength } from "tns-core-modules/ui/layouts/layout-base";
|
||||
import * as platform from "tns-core-modules/platform";
|
||||
|
||||
function getNativeLayoutParams(nativeView: android.view.View): org.nativescript.widgets.CommonLayoutParams {
|
||||
|
6
tests/app/ui/layouts/layout-helper.d.ts
vendored
6
tests/app/ui/layouts/layout-helper.d.ts
vendored
@ -1,6 +1,6 @@
|
||||
import {Button} from "tns-core-modules/ui/button";
|
||||
import {StackLayout} from "tns-core-modules/ui/layouts/stack-layout";
|
||||
import {GridLayout} from "tns-core-modules/ui/layouts/grid-layout";
|
||||
import { Button } from "tns-core-modules/ui/button";
|
||||
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
|
||||
import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout";
|
||||
|
||||
export interface MeasuredView {
|
||||
measureCount: number;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {Button} from "tns-core-modules/ui/button";
|
||||
import {StackLayout} from "tns-core-modules/ui/layouts/stack-layout";
|
||||
import {GridLayout} from "tns-core-modules/ui/layouts/grid-layout";
|
||||
import { Button } from "tns-core-modules/ui/button";
|
||||
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
|
||||
import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout";
|
||||
import * as utils from "tns-core-modules/utils/utils";
|
||||
import * as TKUnit from "../../TKUnit";
|
||||
import * as def from "./layout-helper";
|
||||
|
@ -141,14 +141,14 @@ export class StackLayoutTest extends testModule.UITest<StackLayout> {
|
||||
private assertChildTexts(expected, layout, message) {
|
||||
let texts: Array<string> = [];
|
||||
layout.eachChildView((child: { text: string }) => texts.push(child.text));
|
||||
TKUnit.assertEqual(expected, texts.join('|'), message);
|
||||
TKUnit.assertEqual(expected, texts.join("|"), message);
|
||||
}
|
||||
|
||||
public test_insertChildAtPosition() {
|
||||
this.assertChildTexts("btn1|btn2", this.rootLayout, "initial 2 buttons");
|
||||
|
||||
let newChild = new Button();
|
||||
newChild.text = 'in-between';
|
||||
newChild.text = "in-between";
|
||||
this.rootLayout.insertChild(newChild, 1);
|
||||
|
||||
this.assertChildTexts("btn1|in-between|btn2", this.rootLayout, "button inserted at correct location");
|
||||
|
@ -899,13 +899,13 @@ export class ListViewTest extends testModule.UITest<listViewModule.ListView> {
|
||||
if (listView.android) {
|
||||
//(<any>listView)._dumpRealizedTemplates();
|
||||
let realizedItems = <Map<android.view.View, View>>(<any>listView)._realizedItems;
|
||||
TKUnit.assertTrue(realizedItems.size <= 6, 'Realized items must be 6 or less');
|
||||
TKUnit.assertTrue(realizedItems.size <= 6, "Realized items must be 6 or less");
|
||||
|
||||
let realizedTemplates = <Map<string, Map<android.view.View, View>>>(<any>listView)._realizedTemplates;
|
||||
TKUnit.assertEqual(realizedTemplates.size, 3, 'Realized templates');
|
||||
TKUnit.assertTrue(realizedTemplates.get("red").size <= 2, 'Red realized items must be 2 or less');
|
||||
TKUnit.assertTrue(realizedTemplates.get("green").size <= 2, 'Green realized items must be 2 or less');
|
||||
TKUnit.assertTrue(realizedTemplates.get("blue").size <= 2, 'Blue realized items must be 2 or less');
|
||||
TKUnit.assertEqual(realizedTemplates.size, 3, "Realized templates");
|
||||
TKUnit.assertTrue(realizedTemplates.get("red").size <= 2, "Red realized items must be 2 or less");
|
||||
TKUnit.assertTrue(realizedTemplates.get("green").size <= 2, "Green realized items must be 2 or less");
|
||||
TKUnit.assertTrue(realizedTemplates.get("blue").size <= 2, "Blue realized items must be 2 or less");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {topmost} from "tns-core-modules/ui/frame";
|
||||
import { topmost } from "tns-core-modules/ui/frame";
|
||||
import * as TKUnit from "../../TKUnit";
|
||||
import {Page, ShownModallyData} from "tns-core-modules/ui/page";
|
||||
import { Page, ShownModallyData } from "tns-core-modules/ui/page";
|
||||
|
||||
export var modalPage: Page;
|
||||
export function onShowingModally(args) {
|
||||
|
@ -691,7 +691,7 @@ export function test_WhenPageIsNavigatedToItCanShowAnotherPageAsModal() {
|
||||
|
||||
helper.navigate(masterPageFactory);
|
||||
|
||||
TKUnit.waitUntilReady(() => { return modalUnloaded > 0; });
|
||||
TKUnit.waitUntilReady(() => modalUnloaded > 0);
|
||||
TKUnit.assertEqual(shownModally, 1, "shownModally");
|
||||
TKUnit.assertEqual(modalLoaded, 1, "modalLoaded");
|
||||
TKUnit.assertEqual(modalUnloaded, 1, "modalUnloaded");
|
||||
|
@ -62,7 +62,7 @@ export function test_WhenShowingModalPageUnloadedIsNotFiredForTheMasterPage() {
|
||||
};
|
||||
|
||||
helper.navigate(masterPageFactory);
|
||||
TKUnit.waitUntilReady(() => { return modalUnloaded > 0; });
|
||||
TKUnit.waitUntilReady(() => modalUnloaded > 0);
|
||||
TKUnit.assert(!masterPageUnloaded, "Master page should not raise 'unloaded' when showing modal!");
|
||||
masterPage.off(View.loadedEvent, navigatedToEventHandler);
|
||||
masterPage.off(View.unloadedEvent, unloadedEventHandler);
|
||||
@ -370,7 +370,7 @@ export function test_showing_native_viewcontroller_doesnt_throw_exception() {
|
||||
testPage.on(Page.navigatingFromEvent, () => navigatingFrom++);
|
||||
testPage.on(Page.navigatedFromEvent, () => navigatedFrom++);
|
||||
|
||||
helper.navigate(() => { return testPage; });
|
||||
helper.navigate(() => testPage);
|
||||
|
||||
TKUnit.assertEqual(1, navigatingTo, "navigatingTo");
|
||||
TKUnit.assertEqual(1, loaded, "navigatingTo");
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {ShownModallyData} from "tns-core-modules/ui/page";
|
||||
import { ShownModallyData } from "tns-core-modules/ui/page";
|
||||
|
||||
export function onShownModally(args: ShownModallyData) {
|
||||
args.context.childPage = args.object;
|
||||
|
@ -26,7 +26,7 @@ for (var i = 0; i < 100; i++) {
|
||||
|
||||
export function test_recycling() {
|
||||
const setters = new Map<string, stackLayoutModule.StackLayout>();
|
||||
setters.set('itemsLayout', new stackLayoutModule.StackLayout());
|
||||
setters.set("itemsLayout", new stackLayoutModule.StackLayout());
|
||||
helper.nativeView_recycling_test(() => new repeaterModule.Repeater(), null, null, setters);
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ class ScrollLayoutTest extends UITest<ScrollView> {
|
||||
this.waitUntilTestElementLayoutIsValid();
|
||||
|
||||
this.testView.scrollToVerticalOffset(layoutHelper.dp(100), true);
|
||||
TKUnit.waitUntilReady(() => { return TKUnit.areClose(layoutHelper.dip(this.testView.verticalOffset), 100, 0.9); });
|
||||
TKUnit.waitUntilReady(() => TKUnit.areClose(layoutHelper.dip(this.testView.verticalOffset), 100, 0.9));
|
||||
|
||||
// The scrolling animation should be finished by now
|
||||
TKUnit.assertAreClose(layoutHelper.dip(this.testView.verticalOffset), 100, 0.9, "this.testView.verticalOffset");
|
||||
@ -138,7 +138,7 @@ class ScrollLayoutTest extends UITest<ScrollView> {
|
||||
// No synchronous change.
|
||||
TKUnit.assertEqual(this.testView.horizontalOffset, 0, "this.testView.horizontalOffset");
|
||||
|
||||
TKUnit.waitUntilReady(() => { return TKUnit.areClose(layoutHelper.dip(this.testView.horizontalOffset), 100, 0.9); });
|
||||
TKUnit.waitUntilReady(() => TKUnit.areClose(layoutHelper.dip(this.testView.horizontalOffset), 100, 0.9));
|
||||
|
||||
// The scrolling animation should be finished by now
|
||||
TKUnit.assertAreClose(layoutHelper.dip(this.testView.horizontalOffset), 100, 0.9, "this.testView.horizontalOffset");
|
||||
|
@ -1,17 +1,17 @@
|
||||
import { EventData } from 'tns-core-modules/data/observable';
|
||||
import { EventData } from "tns-core-modules/data/observable";
|
||||
import { SearchBar } from "tns-core-modules/ui/search-bar"
|
||||
|
||||
export function navigatingTo(args: EventData) {
|
||||
console.log("page navigating to");
|
||||
}
|
||||
// >> searchbar-clear
|
||||
export function onClear(args){
|
||||
export function onClear(args) {
|
||||
console.log("clear search-bar text");
|
||||
}
|
||||
// << searchbar-clear
|
||||
// >> searchbar-submit
|
||||
export function onSubmit(args){
|
||||
var searchbar:SearchBar = <SearchBar>args.object;
|
||||
console.log("Search submit result: "+searchbar.text);
|
||||
export function onSubmit(args) {
|
||||
var searchbar: SearchBar = <SearchBar>args.object;
|
||||
console.log("Search submit result: " + searchbar.text);
|
||||
}
|
||||
// << searchbar-submit
|
@ -21,7 +21,7 @@ function _createSegmentedBar(): segmentedBarModule.SegmentedBar {
|
||||
|
||||
export function test_recycling() {
|
||||
const setters = new Map<string, Array<any>>();
|
||||
setters.set('items', _createItems(3));
|
||||
setters.set("items", _createItems(3));
|
||||
helper.nativeView_recycling_test(() => new segmentedBarModule.SegmentedBar(), null, null, setters);
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ export function test_values_change_native_values() {
|
||||
TKUnit.assertEqual(getNativeMaxValue(slider), isIOS ? 20 : 10, "4: Wrong native slider.maxValue");
|
||||
|
||||
slider.value = 15;
|
||||
TKUnit.assertEqual(getNativeValue(slider), isIOS ? 15: 5, "5: wrong native slider.value");
|
||||
TKUnit.assertEqual(getNativeValue(slider), isIOS ? 15 : 5, "5: wrong native slider.value");
|
||||
TKUnit.assertEqual(getNativeMaxValue(slider), isIOS ? 20 : 10, "5: Wrong native slider.maxValue");
|
||||
};
|
||||
|
||||
|
@ -1367,7 +1367,7 @@ export function test_alone_attr_selector() {
|
||||
|
||||
export function test_UsingSameSelectors_ShouldApplyLatest() {
|
||||
let testButton = new buttonModule.Button();
|
||||
testButton.className = 'green';
|
||||
testButton.className = "green";
|
||||
|
||||
let testCss = ".green { background-color: #FF0000; } .green { background-color: #00FF00; }";
|
||||
|
||||
@ -1380,7 +1380,7 @@ export function test_UsingSameSelectors_ShouldApplyLatest() {
|
||||
|
||||
export function test_UsingSameSelectorsWithSpecific_ShouldApplyLatest() {
|
||||
let testButton = new buttonModule.Button();
|
||||
testButton.className = 'red green';
|
||||
testButton.className = "red green";
|
||||
|
||||
let testCss = ".red { background-color: #FF0000; } Button.green { background-color: #00FF00; }";
|
||||
|
||||
@ -1395,7 +1395,7 @@ export function test_CascadingClassNamesAppliesAfterPageLoad() {
|
||||
const stack = new stackModule.StackLayout();
|
||||
const label = new labelModule.Label();
|
||||
label.text = "Some text";
|
||||
label.className = 'lab1';
|
||||
label.className = "lab1";
|
||||
stack.addChild(label);
|
||||
|
||||
application.addCss(".added { background-color: red; } .added .lab1 { background-color: blue; } .lab1 { color: red}");
|
||||
|
@ -117,7 +117,7 @@ export function testWhenNavigatingBackToANonCachedPageContainingATabViewWithALis
|
||||
_clickTheFirstButtonInTheListViewNatively(tabView);
|
||||
|
||||
frameModule.goBack();
|
||||
TKUnit.waitUntilReady(() => topFrame.navigationQueueIsEmpty());//() => topFrame.currentPage === tabViewPage);
|
||||
TKUnit.waitUntilReady(() => topFrame.navigationQueueIsEmpty()); //() => topFrame.currentPage === tabViewPage);
|
||||
|
||||
frameModule.goBack();
|
||||
|
||||
|
@ -23,7 +23,7 @@ export class TabViewTest extends UITest<tabViewModule.TabView> {
|
||||
|
||||
public test_recycling() {
|
||||
const setters = new Map<string, Array<any>>();
|
||||
setters.set('items', this._createItems(3));
|
||||
setters.set("items", this._createItems(3));
|
||||
helper.nativeView_recycling_test(() => new tabViewModule.TabView(), null, null, setters);
|
||||
}
|
||||
|
||||
|
@ -638,7 +638,7 @@ export function test_android_ime_actions_move_focus() {
|
||||
const addTextField = () => {
|
||||
const tf = new TextField();
|
||||
(<any>tf).returnPress = 0
|
||||
tf.on('returnPress', (args) => (<any>args.object).returnPress++);
|
||||
tf.on("returnPress", (args) => (<any>args.object).returnPress++);
|
||||
stack.addChild(tf);
|
||||
}
|
||||
|
||||
|
@ -605,7 +605,7 @@ export function test_NativeSetter_called_when_add_and_remove_and_recycled() {
|
||||
// TKUnit.assertEqual(secondView.viewPropCounter, isIOS ? 2 : 3, "8");
|
||||
|
||||
TKUnit.assertEqual(secondView.cssPropCounter, 2, "7");
|
||||
TKUnit.assertEqual(secondView.viewPropCounter,2, "8");
|
||||
TKUnit.assertEqual(secondView.viewPropCounter, 2, "8");
|
||||
});
|
||||
};
|
||||
|
||||
@ -1050,7 +1050,7 @@ export function test_background_image_doesnt_throw() {
|
||||
var btn = new Button();
|
||||
// There is no need to wait until image is downloaded.
|
||||
// It was throwing an exception when starting the download...
|
||||
btn.style.backgroundImage = 'https://www.bodybuilding.com/images/2016/june/8-benefits-to-working-out-in-the-morning-header-v2-830x467.jpg';
|
||||
btn.style.backgroundImage = "https://www.bodybuilding.com/images/2016/june/8-benefits-to-working-out-in-the-morning-header-v2-830x467.jpg";
|
||||
helper.buildUIAndRunTest(btn, function (views: Array<View>) {
|
||||
helper.waitUntilLayoutReady(btn);
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
// >> web-view-loaded
|
||||
import { EventData } from 'tns-core-modules/data/observable';
|
||||
import { EventData } from "tns-core-modules/data/observable";
|
||||
import { WebView } from "tns-core-modules/ui/web-view";
|
||||
import { isAndroid } from "tns-core-modules/platform"
|
||||
|
||||
@ -7,17 +7,17 @@ export function navigatingTo(args: EventData) {
|
||||
console.log("page navigating to");
|
||||
}
|
||||
|
||||
export function webViewTouch(args){
|
||||
export function webViewTouch(args) {
|
||||
console.log("touch event");
|
||||
}
|
||||
|
||||
export function webViewPan(args){
|
||||
export function webViewPan(args) {
|
||||
console.log("pan gesture");
|
||||
}
|
||||
|
||||
export function webViewLoaded(args){
|
||||
var webview:WebView = <WebView>args.object;
|
||||
if(isAndroid){
|
||||
export function webViewLoaded(args) {
|
||||
var webview: WebView = <WebView>args.object;
|
||||
if (isAndroid) {
|
||||
webview.android.getSettings().setDisplayZoomControls(false);
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ export class WebViewTest extends testModule.UITest<webViewModule.WebView> {
|
||||
webView.on(webViewModule.WebView.loadFinishedEvent, function (args: webViewModule.LoadEventData) {
|
||||
// >> (hide)
|
||||
let actual;
|
||||
let expectedTitle = 'MyTitle';
|
||||
let expectedTitle = "MyTitle";
|
||||
|
||||
if (webView.ios) {
|
||||
actual = webView.ios.title;
|
||||
@ -91,7 +91,7 @@ export class WebViewTest extends testModule.UITest<webViewModule.WebView> {
|
||||
|
||||
webView.on(webViewModule.WebView.loadFinishedEvent, function (args: webViewModule.LoadEventData) {
|
||||
let actual;
|
||||
let expectedTitle = 'MyTitle';
|
||||
let expectedTitle = "MyTitle";
|
||||
|
||||
if (webView.ios) {
|
||||
actual = webView.ios.title;
|
||||
@ -127,7 +127,7 @@ export class WebViewTest extends testModule.UITest<webViewModule.WebView> {
|
||||
// >> (hide)
|
||||
|
||||
let actual;
|
||||
const expected = 'MyTitle';
|
||||
const expected = "MyTitle";
|
||||
|
||||
if (webView.ios) {
|
||||
actual = webView.ios.title;
|
||||
@ -153,7 +153,7 @@ export class WebViewTest extends testModule.UITest<webViewModule.WebView> {
|
||||
message = "Error loading " + args.url + ": " + args.error;
|
||||
}
|
||||
});
|
||||
webView.src = '<!DOCTYPE html><html><head><title>MyTitle</title><meta charset="utf-8" /></head><body><span style="color:red">TestÖ</span></body></html>';
|
||||
webView.src = "<!DOCTYPE html><html><head><title>MyTitle</title><meta charset=\"utf-8\" /></head><body><span style=\"color:red\">TestÖ</span></body></html>";
|
||||
// << webview-string
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ export function test_ignore_zero_length_request_body() {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "https://httpbin.org/get");
|
||||
|
||||
xhr.send('');
|
||||
xhr.send("");
|
||||
}
|
||||
|
||||
export function test_raises_onload_Event(done) {
|
||||
@ -246,9 +246,9 @@ export function test_xhr_events() {
|
||||
let loadCallbackFired = false, loadEventFired = false;
|
||||
xhr.onload = () => loadCallbackFired = true;
|
||||
let badEvent = () => { throw new Error("Shouldn't call me") }
|
||||
xhr.addEventListener('load', () => loadEventFired = true);
|
||||
xhr.addEventListener('load', badEvent);
|
||||
xhr.removeEventListener('load', badEvent);
|
||||
xhr.addEventListener("load", () => loadEventFired = true);
|
||||
xhr.addEventListener("load", badEvent);
|
||||
xhr.removeEventListener("load", badEvent);
|
||||
|
||||
xhr._errorFlag = false;
|
||||
xhr._setReadyState(xhr.DONE);
|
||||
@ -257,23 +257,23 @@ export function test_xhr_events() {
|
||||
|
||||
let errorCallbackData = null, errorEventData = null;
|
||||
xhr.onerror = (e) => errorCallbackData = e;
|
||||
xhr.addEventListener('error', (e) => errorEventData = e);
|
||||
xhr.addEventListener('error', badEvent);
|
||||
xhr.removeEventListener('error', badEvent);
|
||||
xhr.addEventListener("error", (e) => errorEventData = e);
|
||||
xhr.addEventListener("error", badEvent);
|
||||
xhr.removeEventListener("error", badEvent);
|
||||
|
||||
xhr._errorFlag = true;
|
||||
xhr._setReadyState(xhr.DONE, 'error data');
|
||||
TKUnit.assertEqual(errorCallbackData, 'error data');
|
||||
TKUnit.assertEqual(errorEventData, 'error data');
|
||||
xhr._setReadyState(xhr.DONE, "error data");
|
||||
TKUnit.assertEqual(errorCallbackData, "error data");
|
||||
TKUnit.assertEqual(errorEventData, "error data");
|
||||
}
|
||||
|
||||
export function test_xhr_responseType_rss() {
|
||||
const xhr = <any>new XMLHttpRequest();
|
||||
const rawRssFeed = '<rss> <channel><item><title>Test</title></item></channel></rss>';
|
||||
const rawRssFeed = "<rss> <channel><item><title>Test</title></item></channel></rss>";
|
||||
const response = {
|
||||
statusCode: 200,
|
||||
content: {
|
||||
toString: function(){ return this.raw },
|
||||
toString: function() { return this.raw },
|
||||
raw: rawRssFeed
|
||||
},
|
||||
headers: {
|
||||
@ -291,8 +291,8 @@ export function test_xhr_responseType_text() {
|
||||
const response = {
|
||||
statusCode: 200,
|
||||
content: {
|
||||
toString: function(){ return this.raw },
|
||||
raw: 'response body'
|
||||
toString: function() { return this.raw },
|
||||
raw: "response body"
|
||||
},
|
||||
headers: {
|
||||
"Content-Type": "text/plain"
|
||||
@ -302,7 +302,7 @@ export function test_xhr_responseType_text() {
|
||||
xhr._loadResponse(response);
|
||||
|
||||
TKUnit.assertEqual(xhr.responseType, "text");
|
||||
TKUnit.assertEqual(xhr.response, 'response body');
|
||||
TKUnit.assertEqual(xhr.response, "response body");
|
||||
}
|
||||
|
||||
export function test_xhr_responseType_switched_to_JSON_if_header_present() {
|
||||
@ -310,8 +310,8 @@ export function test_xhr_responseType_switched_to_JSON_if_header_present() {
|
||||
const response = {
|
||||
statusCode: 200,
|
||||
content: {
|
||||
toString: function(){ return this.raw },
|
||||
raw: '{"data": 42}'
|
||||
toString: function() { return this.raw },
|
||||
raw: "{\"data\": 42}"
|
||||
},
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
@ -332,7 +332,7 @@ export function test_xhr_responseType_switched_to_JSON_if_headers_content_type_h
|
||||
toString: function () {
|
||||
return this.raw
|
||||
},
|
||||
raw: '{"data": 42}'
|
||||
raw: "{\"data\": 42}"
|
||||
},
|
||||
headers: {
|
||||
"Content-Type": "type/media.type+json"
|
||||
@ -350,7 +350,7 @@ export function test_sets_status_and_statusText(done) {
|
||||
if (xhr.readyState > 3) {
|
||||
try {
|
||||
TKUnit.assertEqual(xhr.status, 200);
|
||||
TKUnit.assertEqual(xhr.statusText, 'OK');
|
||||
TKUnit.assertEqual(xhr.statusText, "OK");
|
||||
done(null);
|
||||
}
|
||||
catch (err) {
|
||||
@ -391,7 +391,7 @@ export function test_getResponseHeader() {
|
||||
statusCode: 200,
|
||||
content: {
|
||||
toString: function() { return this.raw },
|
||||
raw: '{"data": 42}'
|
||||
raw: "{\"data\": 42}"
|
||||
},
|
||||
headers: {
|
||||
"content-type": "application/json"
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Page} from "tns-core-modules/ui/page";
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
|
||||
export class InheritedPage extends Page {
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {Page} from "tns-core-modules/ui/page";
|
||||
import {Label} from "tns-core-modules/ui/label";
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
import { Label } from "tns-core-modules/ui/label";
|
||||
|
||||
export function pageLoaded(args) {
|
||||
var page = <Page>args.object;
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {Label} from "tns-core-modules/ui/label";
|
||||
import {Observable} from "tns-core-modules/data/observable";
|
||||
import {Page} from "tns-core-modules/ui/page";
|
||||
import { Label } from "tns-core-modules/ui/label";
|
||||
import { Observable } from "tns-core-modules/data/observable";
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
|
||||
export function loaded(args) {
|
||||
(<Observable>(<Label>args.object).page.bindingContext).set("testPassed", true);
|
||||
|
@ -9,8 +9,8 @@ export module knownTemplates {
|
||||
export class TemplateView extends LayoutBase {
|
||||
public template: string;
|
||||
|
||||
public static testEvent: string = "test";
|
||||
|
||||
public static testEvent: string = "test";
|
||||
|
||||
public parseTemplate() {
|
||||
this.addChild(parse(this.template));
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ export function test_parse_ShouldThrowErrorWhenInvalidCodeFileIsSpecified() {
|
||||
};
|
||||
|
||||
export function test_parse_ShouldResolveExportsFromCodeFileForTemplates() {
|
||||
var p = <Page>builder.parse('<Page codeFile="~/xml-declaration/custom-code-file" xmlns:customControls="xml-declaration/mymodulewithxml"><ListView items="{{ items }}" itemLoading="{{ itemLoading }}"><ListView.itemTemplate><customControls:MyControl loaded="loaded" /></ListView.itemTemplate></ListView></Page>');
|
||||
var p = <Page>builder.parse("<Page codeFile=\"~/xml-declaration/custom-code-file\" xmlns:customControls=\"xml-declaration/mymodulewithxml\"><ListView items=\"{{ items }}\" itemLoading=\"{{ itemLoading }}\"><ListView.itemTemplate><customControls:MyControl loaded=\"loaded\" /></ListView.itemTemplate></ListView></Page>");
|
||||
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
var ctrl;
|
||||
@ -469,7 +469,7 @@ export function test_parse_ShouldParseBindingToSpecialProperty() {
|
||||
export function test_parse_ShouldParseBindingsWithCommaInsideSingleQuote() {
|
||||
var expected = "Hi,test"
|
||||
var bindingString = "{{ 'Hi,' + myProp }}";
|
||||
var p = <Page>builder.parse('<Page><Label text="' + bindingString + '" /></Page>');
|
||||
var p = <Page>builder.parse("<Page><Label text=\"" + bindingString + "\" /></Page>");
|
||||
var obj = new observable.Observable();
|
||||
obj.set("myProp", "test");
|
||||
p.bindingContext = obj;
|
||||
@ -480,7 +480,7 @@ export function test_parse_ShouldParseBindingsWithCommaInsideSingleQuote() {
|
||||
|
||||
export function test_parse_ShouldParseBindingsWithCommaInsideDoubleQuote() {
|
||||
var expected = "Hi,test"
|
||||
var bindingString = '{{ "Hi," + myProp }}';
|
||||
var bindingString = "{{ \"Hi,\" + myProp }}";
|
||||
var p = <Page>builder.parse("<Page><Label text='" + bindingString + "' /></Page>");
|
||||
var obj = new observable.Observable();
|
||||
obj.set("myProp", "test");
|
||||
@ -502,7 +502,7 @@ export function test_parse_CanBindBackgroundImage() {
|
||||
};
|
||||
|
||||
export function test_parse_ShouldParseLowerCaseDashedComponentDeclaration() {
|
||||
var p = <Page>builder.parse('<page><stack-layout><label text="Label" /><segmented-bar><segmented-bar.items><segmented-bar-item title="test" /></segmented-bar.items></segmented-bar></stack-layout></page>');
|
||||
var p = <Page>builder.parse("<page><stack-layout><label text=\"Label\" /><segmented-bar><segmented-bar.items><segmented-bar-item title=\"test\" /></segmented-bar.items></segmented-bar></stack-layout></page>");
|
||||
var ctrl = <stackLayoutModule.StackLayout>p.content;
|
||||
|
||||
TKUnit.assert(ctrl instanceof stackLayoutModule.StackLayout, "Expected result: StackLayout!; Actual result: " + ctrl);
|
||||
@ -511,28 +511,28 @@ export function test_parse_ShouldParseLowerCaseDashedComponentDeclaration() {
|
||||
};
|
||||
|
||||
export function test_parse_ShouldParseCustomComponentWithoutXml() {
|
||||
var p = <Page>builder.parse('<Page xmlns:customControls="xml-declaration/mymodule"><customControls:MyControl /></Page>');
|
||||
var p = <Page>builder.parse("<Page xmlns:customControls=\"xml-declaration/mymodule\"><customControls:MyControl /></Page>");
|
||||
var ctrl = p.content;
|
||||
|
||||
TKUnit.assert(ctrl instanceof myCustomControlWithoutXml.MyControl, "Expected result: custom control is defined!; Actual result: " + ctrl);
|
||||
};
|
||||
|
||||
export function test_parse_ShouldParseCustomComponentWithoutXmlFromTNSModules() {
|
||||
var p = <Page>builder.parse('<Page xmlns' + ':customControls="ui/label"><customControls:Label /></Page>');
|
||||
var p = <Page>builder.parse("<Page xmlns" + ":customControls=\"ui/label\"><customControls:Label /></Page>");
|
||||
var ctrl = p.content;
|
||||
|
||||
TKUnit.assert(ctrl instanceof Label, "Expected result: custom control is defined!; Actual result: " + ctrl);
|
||||
};
|
||||
|
||||
export function test_parse_ShouldParseCustomComponentWithoutXmlFromTNSModulesWhenNotSpecified() {
|
||||
var p = <Page>builder.parse('<Page xmlns' + ':customControls="ui/label"><customControls:Label /></Page>');
|
||||
var p = <Page>builder.parse("<Page xmlns" + ":customControls=\"ui/label\"><customControls:Label /></Page>");
|
||||
var ctrl = p.content;
|
||||
|
||||
TKUnit.assert(ctrl instanceof Label, "Expected result: custom control is defined!; Actual result: " + ctrl);
|
||||
};
|
||||
|
||||
export function test_parse_ShouldParseCustomComponentWithXml() {
|
||||
var p = <Page>builder.parse('<Page xmlns:customControls="xml-declaration/mymodulewithxml"><customControls:MyControl /></Page>');
|
||||
var p = <Page>builder.parse("<Page xmlns:customControls=\"xml-declaration/mymodulewithxml\"><customControls:MyControl /></Page>");
|
||||
var panel = <stackLayoutModule.StackLayout>p.content;
|
||||
var lbl = <Label>panel.getChildAt(0);
|
||||
|
||||
@ -540,21 +540,21 @@ export function test_parse_ShouldParseCustomComponentWithXml() {
|
||||
};
|
||||
|
||||
export function test_parse_ShouldParseCustomComponentWithXml_WithAttributes() {
|
||||
var p = <Page>builder.parse('<Page xmlns:customControls="xml-declaration/mymodulewithxml"><customControls:MyControl visibility="collapse" /></Page>');
|
||||
var p = <Page>builder.parse("<Page xmlns:customControls=\"xml-declaration/mymodulewithxml\"><customControls:MyControl visibility=\"collapse\" /></Page>");
|
||||
var panel = <stackLayoutModule.StackLayout>p.content;
|
||||
|
||||
TKUnit.assertEqual(panel.visibility, "collapse", "panel.visibility");
|
||||
};
|
||||
|
||||
export function test_parse_ShouldParseCustomComponentWithXml_WithCustomAttributes() {
|
||||
var p = <Page>builder.parse('<Page xmlns:customControls="xml-declaration/mymodulewithxml"><customControls:MyControl myProperty="myValue" /></Page>');
|
||||
var p = <Page>builder.parse("<Page xmlns:customControls=\"xml-declaration/mymodulewithxml\"><customControls:MyControl myProperty=\"myValue\" /></Page>");
|
||||
var panel = <stackLayoutModule.StackLayout>p.content;
|
||||
|
||||
TKUnit.assertEqual(panel["myProperty"], "myValue", "customControl.myProperty");
|
||||
};
|
||||
|
||||
export function test_parse_ShouldParseCustomComponentWithXmlNoJS() {
|
||||
var p = <Page>builder.parse('<Page xmlns:customControls="xml-declaration/mymodulewithxml"><customControls:my-control-no-js /></Page>');
|
||||
var p = <Page>builder.parse("<Page xmlns:customControls=\"xml-declaration/mymodulewithxml\"><customControls:my-control-no-js /></Page>");
|
||||
var panel = <stackLayoutModule.StackLayout>p.content;
|
||||
var lbl = <Label>panel.getChildAt(0);
|
||||
|
||||
@ -562,21 +562,21 @@ export function test_parse_ShouldParseCustomComponentWithXmlNoJS() {
|
||||
};
|
||||
|
||||
export function test_parse_ShouldParseCustomComponentWithXmlNoJS_WithAttributes() {
|
||||
var p = <Page>builder.parse('<Page xmlns:customControls="xml-declaration/mymodulewithxml"><customControls:my-control-no-js visibility="collapse" /></Page>');
|
||||
var p = <Page>builder.parse("<Page xmlns:customControls=\"xml-declaration/mymodulewithxml\"><customControls:my-control-no-js visibility=\"collapse\" /></Page>");
|
||||
var panel = <stackLayoutModule.StackLayout>p.content;
|
||||
|
||||
TKUnit.assertEqual(panel.visibility, "collapse", "panel.visibility");
|
||||
};
|
||||
|
||||
export function test_parse_ShouldParseCustomComponentWithXmlNoJS_WithCustomAttributes() {
|
||||
var p = <Page>builder.parse('<Page xmlns:customControls="xml-declaration/mymodulewithxml"><customControls:my-control-no-js myProperty="myValue" /></Page>');
|
||||
var p = <Page>builder.parse("<Page xmlns:customControls=\"xml-declaration/mymodulewithxml\"><customControls:my-control-no-js myProperty=\"myValue\" /></Page>");
|
||||
var panel = <stackLayoutModule.StackLayout>p.content;
|
||||
|
||||
TKUnit.assertEqual(panel["myProperty"], "myValue", "customControl.myProperty");
|
||||
};
|
||||
|
||||
export function test_parse_ShouldParseCustomComponentWithoutXmlInListViewTemplate() {
|
||||
var p = <Page>builder.parse('<Page xmlns:customControls="xml-declaration/mymodule"><ListView items="{{ items }}" itemLoading="{{ itemLoading }}"><ListView.itemTemplate><customControls:MyControl /></ListView.itemTemplate></ListView></Page>');
|
||||
var p = <Page>builder.parse("<Page xmlns:customControls=\"xml-declaration/mymodule\"><ListView items=\"{{ items }}\" itemLoading=\"{{ itemLoading }}\"><ListView.itemTemplate><customControls:MyControl /></ListView.itemTemplate></ListView></Page>");
|
||||
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
let ctrl;
|
||||
@ -595,7 +595,7 @@ export function test_parse_ShouldParseCustomComponentWithoutXmlInListViewTemplat
|
||||
}
|
||||
|
||||
export function test_parse_ShouldParseNestedListViewInListViewTemplate() {
|
||||
var p = <Page>builder.parse('<Page xmlns="http://schemas.nativescript.org/tns.xsd"><ListView items="{{ items }}" itemLoading="{{ itemLoading }}"><ListView.itemTemplate><ListView items="{{ subItems }}" /></ListView.itemTemplate></ListView></Page>');
|
||||
var p = <Page>builder.parse("<Page xmlns=\"http://schemas.nativescript.org/tns.xsd\"><ListView items=\"{{ items }}\" itemLoading=\"{{ itemLoading }}\"><ListView.itemTemplate><ListView items=\"{{ subItems }}\" /></ListView.itemTemplate></ListView></Page>");
|
||||
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
let ctrl;
|
||||
@ -614,7 +614,7 @@ export function test_parse_ShouldParseNestedListViewInListViewTemplate() {
|
||||
}
|
||||
|
||||
export function test_parse_ShouldEvaluateEventBindingExpressionInListViewTemplate() {
|
||||
var p = <Page>builder.parse('<Page xmlns="http://schemas.nativescript.org/tns.xsd"><ListView items="{{ items }}" itemLoading="{{ itemLoading }}"><ListView.itemTemplate><SegmentedBar items="{{ $parents[\'ListView\'].segmentedBarItems }}" selectedIndexChanged="{{ $parents[\'ListView\'].changed }}" /></ListView.itemTemplate></ListView></Page>');
|
||||
var p = <Page>builder.parse("<Page xmlns=\"http://schemas.nativescript.org/tns.xsd\"><ListView items=\"{{ items }}\" itemLoading=\"{{ itemLoading }}\"><ListView.itemTemplate><SegmentedBar items=\"{{ $parents['ListView'].segmentedBarItems }}\" selectedIndexChanged=\"{{ $parents['ListView'].changed }}\" /></ListView.itemTemplate></ListView></Page>");
|
||||
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
let ctrl: segmentedBar.SegmentedBar = null;
|
||||
@ -696,7 +696,7 @@ export function test_parse_NestedRepeaters() {
|
||||
}
|
||||
|
||||
export function test_parseSpansDirectlyOnLabel() {
|
||||
var p = <Page>builder.parse('<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatedTo="pageNavigated"><StackLayout><Label id="testLabel"><Span text="We are" fontSize="10"/><Span text="Awesome" fontWeight="bold"/></Label></StackLayout></Page>');
|
||||
var p = <Page>builder.parse("<Page xmlns=\"http://schemas.nativescript.org/tns.xsd\" navigatedTo=\"pageNavigated\"><StackLayout><Label id=\"testLabel\"><Span text=\"We are\" fontSize=\"10\"/><Span text=\"Awesome\" fontWeight=\"bold\"/></Label></StackLayout></Page>");
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
var page = <Page>views[0];
|
||||
var testLabel = <Label>page.getViewById("testLabel");
|
||||
@ -709,7 +709,7 @@ export function test_parseSpansDirectlyOnLabel() {
|
||||
}
|
||||
|
||||
export function test_parseSpansDirectlyOnButton() {
|
||||
var p = <Page>builder.parse('<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatedTo="pageNavigated"><StackLayout><Button id="testButton"><Span text="We are" fontSize="10"/><Span text="Awesome" fontWeight="bold"/></Button></StackLayout></Page>');
|
||||
var p = <Page>builder.parse("<Page xmlns=\"http://schemas.nativescript.org/tns.xsd\" navigatedTo=\"pageNavigated\"><StackLayout><Button id=\"testButton\"><Span text=\"We are\" fontSize=\"10\"/><Span text=\"Awesome\" fontWeight=\"bold\"/></Button></StackLayout></Page>");
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
var page = <Page>views[0];
|
||||
var testButton = <Button>page.getViewById("testButton");
|
||||
@ -722,7 +722,7 @@ export function test_parseSpansDirectlyOnButton() {
|
||||
}
|
||||
|
||||
export function test_parseFormattedStringWithoutFormattedText() {
|
||||
var p = <Page>builder.parse('<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatedTo="pageNavigated"><StackLayout><Button id="testButton"><FormattedString><FormattedString.spans><Span text="author"/><Span text=" num_comments"/></FormattedString.spans></FormattedString></Button></StackLayout></Page>');
|
||||
var p = <Page>builder.parse("<Page xmlns=\"http://schemas.nativescript.org/tns.xsd\" navigatedTo=\"pageNavigated\"><StackLayout><Button id=\"testButton\"><FormattedString><FormattedString.spans><Span text=\"author\"/><Span text=\" num_comments\"/></FormattedString.spans></FormattedString></Button></StackLayout></Page>");
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
var page = <Page>views[0];
|
||||
var testButton = <Button>page.getViewById("testButton");
|
||||
@ -735,7 +735,7 @@ export function test_parseFormattedStringWithoutFormattedText() {
|
||||
}
|
||||
|
||||
export function test_parseFormattedStringFullSyntax() {
|
||||
var p = <Page>builder.parse('<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatedTo="pageNavigated"><StackLayout><Button id="testButton"><Button.formattedText><FormattedString><FormattedString.spans><Span text="author"/><Span text=" num_comments"/></FormattedString.spans></FormattedString></Button.formattedText></Button></StackLayout></Page>');
|
||||
var p = <Page>builder.parse("<Page xmlns=\"http://schemas.nativescript.org/tns.xsd\" navigatedTo=\"pageNavigated\"><StackLayout><Button id=\"testButton\"><Button.formattedText><FormattedString><FormattedString.spans><Span text=\"author\"/><Span text=\" num_comments\"/></FormattedString.spans></FormattedString></Button.formattedText></Button></StackLayout></Page>");
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
var page = <Page>views[0];
|
||||
var testButton = <Button>page.getViewById("testButton");
|
||||
@ -748,7 +748,7 @@ export function test_parseFormattedStringFullSyntax() {
|
||||
}
|
||||
|
||||
export function test_parseSpansDirectlyToFormattedString() {
|
||||
var p = <Page>builder.parse('<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatedTo="pageNavigated"><StackLayout><Button id="testButton"><FormattedString><Span text="author"/><Span text=" num_comments"/></FormattedString></Button></StackLayout></Page>');
|
||||
var p = <Page>builder.parse("<Page xmlns=\"http://schemas.nativescript.org/tns.xsd\" navigatedTo=\"pageNavigated\"><StackLayout><Button id=\"testButton\"><FormattedString><Span text=\"author\"/><Span text=\" num_comments\"/></FormattedString></Button></StackLayout></Page>");
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
var page = <Page>views[0];
|
||||
var testButton = <Button>page.getViewById("testButton");
|
||||
@ -761,14 +761,14 @@ export function test_parseSpansDirectlyToFormattedString() {
|
||||
}
|
||||
|
||||
export function test_searchbar_donotcrash_whentext_isempty() {
|
||||
var p = <Page>builder.parse('<Page><SearchBar text="" hint="Search" /></Page>');
|
||||
var p = <Page>builder.parse("<Page><SearchBar text=\"\" hint=\"Search\" /></Page>");
|
||||
var sb = <searchBarModule.SearchBar>p.content;
|
||||
|
||||
TKUnit.assertEqual(sb.text, "");
|
||||
};
|
||||
|
||||
export function test_searchbar_donotcrash_whentext_isspace() {
|
||||
var p = <Page>builder.parse('<Page><SearchBar text=" " hint="Search" /></Page>');
|
||||
var p = <Page>builder.parse("<Page><SearchBar text=\" \" hint=\"Search\" /></Page>");
|
||||
var sb = <searchBarModule.SearchBar>p.content;
|
||||
|
||||
TKUnit.assertEqual(sb.text, " ");
|
||||
@ -872,22 +872,22 @@ export function test_EventInCodelessFragment() {
|
||||
|
||||
export function test_tabview_selectedindex_will_work_from_xml() {
|
||||
var p = <Page>builder.parse(
|
||||
'<Page>' +
|
||||
'<TabView selectedIndex= "1">' +
|
||||
'<TabView.items>' +
|
||||
'<TabViewItem title="First">' +
|
||||
'<TabViewItem.view>' +
|
||||
'<Label text="First View" />' +
|
||||
'</TabViewItem.view>' +
|
||||
'</TabViewItem>' +
|
||||
'<TabViewItem title= "Second">' +
|
||||
'<TabViewItem.view>' +
|
||||
'<Label text="Second View" />' +
|
||||
'</TabViewItem.view>' +
|
||||
'</TabViewItem>' +
|
||||
'</TabView.items>' +
|
||||
'</TabView>' +
|
||||
'</Page>');
|
||||
"<Page>" +
|
||||
"<TabView selectedIndex= \"1\">" +
|
||||
"<TabView.items>" +
|
||||
"<TabViewItem title=\"First\">" +
|
||||
"<TabViewItem.view>" +
|
||||
"<Label text=\"First View\" />" +
|
||||
"</TabViewItem.view>" +
|
||||
"</TabViewItem>" +
|
||||
"<TabViewItem title= \"Second\">" +
|
||||
"<TabViewItem.view>" +
|
||||
"<Label text=\"Second View\" />" +
|
||||
"</TabViewItem.view>" +
|
||||
"</TabViewItem>" +
|
||||
"</TabView.items>" +
|
||||
"</TabView>" +
|
||||
"</Page>");
|
||||
|
||||
function testAction(views: Array<viewModule.View>) {
|
||||
let tab: TabView = <TabView>p.content;
|
||||
@ -920,13 +920,13 @@ export function test_hasSourceCodeLocations() {
|
||||
}
|
||||
|
||||
export function test_Setting_digits_for_text_Label_is_not_converted_to_number() {
|
||||
var p = <Page>builder.parse('<Page><Label id="testLabel" text="01234"/></Page>');
|
||||
var p = <Page>builder.parse("<Page><Label id=\"testLabel\" text=\"01234\"/></Page>");
|
||||
var testLabel = <Label>p.getViewById("testLabel");
|
||||
TKUnit.assertEqual(testLabel.text, "01234");
|
||||
}
|
||||
|
||||
export function test_Setting_digits_for_text_Button_is_not_converted_to_number() {
|
||||
var p = <Page>builder.parse('<Page><Button id="testButton" text="01234"/></Page>');
|
||||
var p = <Page>builder.parse("<Page><Button id=\"testButton\" text=\"01234\"/></Page>");
|
||||
var testButton = <Button>p.getViewById("testButton");
|
||||
TKUnit.assertEqual(testButton.text, "01234");
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ export var test_XmlParser_EntityReferencesInAttributeValuesAreDecoded = function
|
||||
var xmlParser = new xmlModule.XmlParser(function (event: xmlModule.ParserEvent) {
|
||||
switch (event.eventType) {
|
||||
case xmlModule.ParserEventType.StartElement:
|
||||
data = event.attributes['text'];
|
||||
data = event.attributes["text"];
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
export var checkKey = function(key: string) : void {
|
||||
export var checkKey = function (key: string): void {
|
||||
if (typeof key !== "string") {
|
||||
throw new Error("key: '" + key + "' must be a string");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export var ensureValidValue = function (value: any, valueType: string): void {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { getNativeApplication, android as androidApp} from "../application";
|
||||
import { getNativeApplication, android as androidApp } from "../application";
|
||||
|
||||
export enum connectionType {
|
||||
none = 0,
|
||||
@ -32,15 +32,15 @@ export function getConnectionType(): number {
|
||||
}
|
||||
|
||||
let type = activeNetworkInfo.getTypeName().toLowerCase();
|
||||
if (type.indexOf(wifi) !== -1){
|
||||
if (type.indexOf(wifi) !== -1) {
|
||||
return connectionType.wifi;
|
||||
}
|
||||
|
||||
if (type.indexOf(mobile) !== -1){
|
||||
if (type.indexOf(mobile) !== -1) {
|
||||
return connectionType.mobile;
|
||||
}
|
||||
|
||||
if (type.indexOf(ethernet) !== -1){
|
||||
if (type.indexOf(ethernet) !== -1) {
|
||||
return connectionType.ethernet;
|
||||
}
|
||||
|
||||
|
@ -342,7 +342,7 @@ export function parseAngle(value: string, start: number = 0): Parsed<Angle> {
|
||||
const angleResult = parseUnit(value, start);
|
||||
if (angleResult) {
|
||||
const { start, end, value } = angleResult;
|
||||
return (angleUnitsToRadMap[value.unit] || ((_,__,___) => null))(start, end, value.value);
|
||||
return (angleUnitsToRadMap[value.unit] || ((_, __, ___) => null))(start, end, value.value);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -461,27 +461,27 @@ export function parseBackgroundPosition(text: string, start: number = 0, keyword
|
||||
|
||||
const directionRegEx = /\s*to\s*(left|right|top|bottom)\s*(left|right|top|bottom)?\s*/gy;
|
||||
const sideDirections = {
|
||||
top: Math.PI * 0/2,
|
||||
right: Math.PI * 1/2,
|
||||
bottom: Math.PI * 2/2,
|
||||
left: Math.PI * 3/2
|
||||
top: Math.PI * 0 / 2,
|
||||
right: Math.PI * 1 / 2,
|
||||
bottom: Math.PI * 2 / 2,
|
||||
left: Math.PI * 3 / 2
|
||||
}
|
||||
const cornerDirections = {
|
||||
top: {
|
||||
right: Math.PI * 1/4,
|
||||
left: Math.PI * 7/4
|
||||
right: Math.PI * 1 / 4,
|
||||
left: Math.PI * 7 / 4
|
||||
},
|
||||
right: {
|
||||
top: Math.PI * 1/4,
|
||||
bottom: Math.PI * 3/4
|
||||
top: Math.PI * 1 / 4,
|
||||
bottom: Math.PI * 3 / 4
|
||||
},
|
||||
bottom: {
|
||||
right: Math.PI * 3/4,
|
||||
left: Math.PI * 5/4
|
||||
right: Math.PI * 3 / 4,
|
||||
left: Math.PI * 5 / 4
|
||||
},
|
||||
left: {
|
||||
top: Math.PI * 7/4,
|
||||
bottom: Math.PI * 5/4
|
||||
top: Math.PI * 7 / 4,
|
||||
bottom: Math.PI * 5 / 4
|
||||
}
|
||||
}
|
||||
function parseDirection(text: string, start: number = 0): Parsed<Angle> {
|
||||
@ -519,7 +519,7 @@ function parseArgumentsList<T>(text: string, start: number, argument: (value: st
|
||||
return { start, end, value };
|
||||
}
|
||||
|
||||
for(var index = 0; true; index++) {
|
||||
for (var index = 0; true; index++) {
|
||||
const arg = argument(text, end, index);
|
||||
if (!arg) {
|
||||
return null;
|
||||
@ -608,7 +608,7 @@ function parseSlash(text: string, start: number): Parsed<"/"> {
|
||||
export function parseBackground(text: string, start: number = 0): Parsed<Background> {
|
||||
const value: any = {};
|
||||
let end = start;
|
||||
while(end < text.length) {
|
||||
while (end < text.length) {
|
||||
const keyword = parseKeyword(text, end);
|
||||
const color = parseColor(text, end, keyword);
|
||||
if (color) {
|
||||
@ -751,7 +751,7 @@ export function parseSimpleSelectorSequence(text: string, start: number): Parsed
|
||||
}
|
||||
let end = simpleSelector.end;
|
||||
let value = <SimpleSelectorSequence>[];
|
||||
while(simpleSelector) {
|
||||
while (simpleSelector) {
|
||||
value.push(simpleSelector.value);
|
||||
end = simpleSelector.end;
|
||||
simpleSelector = parseSimpleSelector(text, end);
|
||||
@ -804,7 +804,7 @@ export function parseSelector(text: string, start: number = 0): Parsed<Selector>
|
||||
end = combinator.end;
|
||||
}
|
||||
expectSimpleSelector = combinator && combinator.value !== " "; // Simple selector must follow non trailing white space combinator
|
||||
} while(combinator);
|
||||
} while (combinator);
|
||||
return { start, end, value };
|
||||
}
|
||||
|
||||
@ -942,7 +942,7 @@ export class CSS3Parser {
|
||||
do {
|
||||
inputToken = this.consumeAToken();
|
||||
tokens.push(inputToken);
|
||||
} while(inputToken);
|
||||
} while (inputToken);
|
||||
return tokens;
|
||||
}
|
||||
|
||||
@ -957,7 +957,7 @@ export class CSS3Parser {
|
||||
return result;
|
||||
}
|
||||
const char = this.text[this.nextInputCodePointIndex];
|
||||
switch(char) {
|
||||
switch (char) {
|
||||
case "\"": return this.consumeAStringToken();
|
||||
case "'": return this.consumeAStringToken();
|
||||
case "(":
|
||||
@ -996,7 +996,7 @@ export class CSS3Parser {
|
||||
case "U":
|
||||
if (this.text[this.nextInputCodePointIndex + 1] === "+") {
|
||||
const thirdChar = this.text[this.nextInputCodePointIndex + 2];
|
||||
if (thirdChar >= '0' && thirdChar <= '9' || thirdChar === "?") {
|
||||
if (thirdChar >= "0" && thirdChar <= "9" || thirdChar === "?") {
|
||||
// TODO: Handle unicode stuff such as U+002B
|
||||
throw new Error("Unicode tokens not supported!");
|
||||
}
|
||||
@ -1164,9 +1164,9 @@ export class CSS3Parser {
|
||||
}
|
||||
}
|
||||
|
||||
while(this.nextInputCodePointIndex < this.text.length) {
|
||||
while (this.nextInputCodePointIndex < this.text.length) {
|
||||
const char = this.text[this.nextInputCodePointIndex++];
|
||||
switch(char) {
|
||||
switch (char) {
|
||||
case ")": return urlToken;
|
||||
case " ":
|
||||
case "\t":
|
||||
@ -1258,8 +1258,8 @@ export class CSS3Parser {
|
||||
public consumeAListOfRules(): Rule[] {
|
||||
const rules: Rule[] = [];
|
||||
let inputToken: InputToken;
|
||||
while(inputToken = this.consumeAToken()) {
|
||||
switch(inputToken) {
|
||||
while (inputToken = this.consumeAToken()) {
|
||||
switch (inputToken) {
|
||||
case " ": continue;
|
||||
case "<!--":
|
||||
case "-->":
|
||||
@ -1302,7 +1302,7 @@ export class CSS3Parser {
|
||||
prelude: [],
|
||||
block: undefined
|
||||
}
|
||||
while(inputToken = this.consumeAToken()) {
|
||||
while (inputToken = this.consumeAToken()) {
|
||||
if (inputToken === ";") {
|
||||
return atRule;
|
||||
} else if (inputToken === "{") {
|
||||
@ -1332,7 +1332,7 @@ export class CSS3Parser {
|
||||
block: undefined
|
||||
};
|
||||
let inputToken: InputToken;
|
||||
while(inputToken = this.consumeAToken()) {
|
||||
while (inputToken = this.consumeAToken()) {
|
||||
if (inputToken === "{") {
|
||||
let block = this.consumeASimpleBlock(inputToken);
|
||||
qualifiedRule.block = block;
|
||||
@ -1361,7 +1361,7 @@ export class CSS3Parser {
|
||||
private consumeAComponentValue(): InputToken {
|
||||
// const inputToken = this.consumeAToken();
|
||||
const inputToken = this.consumeAToken();
|
||||
switch(inputToken) {
|
||||
switch (inputToken) {
|
||||
case "{":
|
||||
case "[":
|
||||
case "(":
|
||||
@ -1392,7 +1392,7 @@ export class CSS3Parser {
|
||||
values: []
|
||||
};
|
||||
let nextInputToken;
|
||||
while(nextInputToken = this.text[this.nextInputCodePointIndex]) {
|
||||
while (nextInputToken = this.text[this.nextInputCodePointIndex]) {
|
||||
if (nextInputToken === endianToken) {
|
||||
this.nextInputCodePointIndex++;
|
||||
const end = this.nextInputCodePointIndex;
|
||||
@ -1421,7 +1421,7 @@ export class CSS3Parser {
|
||||
return funcToken;
|
||||
}
|
||||
const nextInputToken = this.text[this.nextInputCodePointIndex];
|
||||
switch(nextInputToken) {
|
||||
switch (nextInputToken) {
|
||||
case ")":
|
||||
this.nextInputCodePointIndex++;
|
||||
const end = this.nextInputCodePointIndex;
|
||||
@ -1434,7 +1434,7 @@ export class CSS3Parser {
|
||||
}
|
||||
// TODO: Else we won't advance
|
||||
}
|
||||
} while(true);
|
||||
} while (true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ function addPropertiesFromObject(observable: ObservableFromObject, source: any,
|
||||
if (recursive
|
||||
&& !Array.isArray(value)
|
||||
&& value
|
||||
&& typeof value === 'object'
|
||||
&& typeof value === "object"
|
||||
&& !(value instanceof Observable)) {
|
||||
value = fromObjectRecursive(value);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user