mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: cleanup
This commit is contained in:
@@ -49,8 +49,8 @@ export function test_set_TNS_value_updates_native_value() {
|
||||
}
|
||||
|
||||
// Uncomment this when find way to check android Drawable color set by setColorFilter() method.
|
||||
if (__APPLE__) {
|
||||
exports.test_set_color = function () {
|
||||
export function test_set_color() {
|
||||
if (__APPLE__) {
|
||||
var ai = new activityIndicatorModule.ActivityIndicator();
|
||||
ai.color = new color.Color('red');
|
||||
|
||||
@@ -59,7 +59,7 @@ if (__APPLE__) {
|
||||
}
|
||||
|
||||
helper.buildUIAndRunTest(ai, testAction);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// This method is only for the code snippet
|
||||
|
||||
@@ -5,13 +5,12 @@ import { isAndroid, Page, View, KeyedTemplate, Utils, Observable, EventData, Obs
|
||||
import { MyButton, MyStackLayout } from '../layouts/layout-helper';
|
||||
|
||||
// >> article-item-tap
|
||||
function listViewItemTap(args) {
|
||||
export function listViewItemTap(args) {
|
||||
var itemIndex = args.index;
|
||||
// >> (hide)
|
||||
console.log(itemIndex);
|
||||
// << (hide)
|
||||
}
|
||||
exports.listViewItemTap = listViewItemTap;
|
||||
// << article-item-tap
|
||||
|
||||
// >> article-load-items
|
||||
@@ -20,10 +19,9 @@ function listViewLoadMoreItems(args) {
|
||||
}
|
||||
// << article-load-items
|
||||
listViewLoadMoreItems('test');
|
||||
// function loaded(args) {
|
||||
// export function loaded(args) {
|
||||
// args.object.bindingContext = { items: [1,2,3,4,5] };
|
||||
// }
|
||||
// exports.loaded = loaded;
|
||||
|
||||
var FEW_ITEMS = [0, 1, 2];
|
||||
var MANY_ITEMS = new Array<number>(100);
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { Page, ShownModallyData, NavigatedData, View, PercentLength, unsetValue, EventData, Frame, NavigationEntry, TabView, TabViewItem, Button, Color, Label, StackLayout, Application, Utils, Builder } from '@nativescript/core';
|
||||
|
||||
// >> article-set-bindingcontext
|
||||
function pageLoaded(args) {
|
||||
export function pageLoaded(args) {
|
||||
const page = args.object;
|
||||
page.bindingContext = { name: 'Some name' };
|
||||
}
|
||||
exports.pageLoaded = pageLoaded;
|
||||
// << article-set-bindingcontext
|
||||
import * as TKUnit from '../../tk-unit';
|
||||
import * as helper from '../../ui-helper';
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as TKUnit from '../../tk-unit';
|
||||
import { isIOS, isAndroid, Utils, Placeholder, CreateViewEventData, View } from '@nativescript/core';
|
||||
import * as helper from '../../ui-helper';
|
||||
|
||||
function creatingView(args) {
|
||||
export function creatingView(args) {
|
||||
let nativeView;
|
||||
if (__APPLE__) {
|
||||
nativeView = UITextView.new();
|
||||
@@ -14,8 +14,6 @@ function creatingView(args) {
|
||||
|
||||
args.view = nativeView;
|
||||
}
|
||||
|
||||
exports.creatingView = creatingView;
|
||||
// << article-creating-view
|
||||
|
||||
export function test_placeholder_creatingView() {
|
||||
|
||||
@@ -57,8 +57,8 @@ export function test_set_value_greater_than_max_should_set_value_to_max() {
|
||||
}
|
||||
|
||||
// Uncomment this when find way to check android Drawable color set by setColorFilter() method.
|
||||
if (__APPLE__) {
|
||||
exports.test_set_color = function () {
|
||||
export function test_set_color() {
|
||||
if (__APPLE__) {
|
||||
var progress = new progressModule.Progress();
|
||||
progress.color = new color.Color('red');
|
||||
|
||||
@@ -67,9 +67,11 @@ if (__APPLE__) {
|
||||
}
|
||||
|
||||
helper.buildUIAndRunTest(progress, testAction);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
exports.test_set_backgroundColor = function () {
|
||||
export function test_set_backgroundColor() {
|
||||
if (__APPLE__) {
|
||||
var progress = new progressModule.Progress();
|
||||
progress.backgroundColor = new color.Color('red');
|
||||
|
||||
@@ -78,7 +80,7 @@ if (__APPLE__) {
|
||||
}
|
||||
|
||||
helper.buildUIAndRunTest(progress, testAction);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function test_set_maxValue_should_adjust_value() {
|
||||
|
||||
@@ -9,13 +9,12 @@ import { Slider } from '@nativescript/core/ui/slider';
|
||||
// ### Binding the Progress and Slider value properties to a observable view-model property.
|
||||
|
||||
// >> article-binding-slider-properties
|
||||
// function pageLoaded(args) {
|
||||
// export function pageLoaded(args) {
|
||||
// var page = args.object;
|
||||
// var obj = new Observable();
|
||||
// obj.set("someProperty", 42);
|
||||
// page.bindingContext = obj;
|
||||
// }
|
||||
// exports.pageLoaded = pageLoaded;
|
||||
// << article-binding-slider-properties
|
||||
|
||||
interface SliderValues {
|
||||
@@ -96,8 +95,8 @@ export function test_set_native_value_triggers_propertyChanged() {
|
||||
}
|
||||
|
||||
// Uncomment this when find way to check android Drawable color set by setColorFilter() method.
|
||||
if (__APPLE__) {
|
||||
exports.test_set_color = function () {
|
||||
export function test_set_color() {
|
||||
if (__APPLE__) {
|
||||
const slider = new Slider();
|
||||
slider.color = new Color('red');
|
||||
|
||||
@@ -106,9 +105,11 @@ if (__APPLE__) {
|
||||
}
|
||||
|
||||
helper.buildUIAndRunTest(slider, testAction);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
exports.test_set_backgroundColor = function () {
|
||||
export function test_set_backgroundColor() {
|
||||
if (__APPLE__) {
|
||||
const slider = new Slider();
|
||||
slider.backgroundColor = new Color('red');
|
||||
|
||||
@@ -117,7 +118,7 @@ if (__APPLE__) {
|
||||
}
|
||||
|
||||
helper.buildUIAndRunTest(slider, testAction);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function test_default_TNS_values() {
|
||||
|
||||
@@ -5,13 +5,12 @@ import { Switch, Color, Observable, PropertyChangeData, EventData, View, Binding
|
||||
// ### Binding the Switch checked property and Button isEanbled property to a observable view-model property.
|
||||
|
||||
// >> article-binding-switch-property
|
||||
function pageLoaded(args) {
|
||||
export function pageLoaded(args) {
|
||||
var page = args.object;
|
||||
var obj = new Observable();
|
||||
obj.set('someProperty', false);
|
||||
page.bindingContext = obj;
|
||||
}
|
||||
exports.pageLoaded = pageLoaded;
|
||||
// << article-binding-switch-property
|
||||
|
||||
export function test_recycling() {
|
||||
@@ -36,8 +35,9 @@ export function test_default_native_values() {
|
||||
}
|
||||
|
||||
// Uncomment this when find way to check android Drawable color set by setColorFilter() method.
|
||||
if (__APPLE__) {
|
||||
exports.test_set_color = function () {
|
||||
|
||||
export function test_set_color() {
|
||||
if (__APPLE__) {
|
||||
var mySwitch = new Switch();
|
||||
mySwitch.color = new Color('red');
|
||||
|
||||
@@ -46,9 +46,11 @@ if (__APPLE__) {
|
||||
}
|
||||
|
||||
helper.buildUIAndRunTest(mySwitch, testAction);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
exports.test_set_backgroundColor = function () {
|
||||
export function test_set_backgroundColor() {
|
||||
if (__APPLE__) {
|
||||
var mySwitch = new Switch();
|
||||
mySwitch.backgroundColor = new Color('red');
|
||||
|
||||
@@ -57,7 +59,7 @@ if (__APPLE__) {
|
||||
}
|
||||
|
||||
helper.buildUIAndRunTest(mySwitch, testAction);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function test_set_TNS_checked_updates_native_checked() {
|
||||
|
||||
@@ -5,13 +5,12 @@ import { getNativeText, getNativeHint, typeTextNatively, typeTextNativelyWithRet
|
||||
|
||||
// ### Binding two TextFields text property to observable view-model property.
|
||||
// >> binding-text-property-textfield
|
||||
function pageLoaded(args) {
|
||||
export function pageLoaded(args) {
|
||||
var page = args.object;
|
||||
var obj = new Observable();
|
||||
obj.set('someProperty', 'Please change this text!');
|
||||
page.bindingContext = obj;
|
||||
}
|
||||
exports.pageLoaded = pageLoaded;
|
||||
// << binding-text-property-textfield
|
||||
|
||||
export function test_recycling() {
|
||||
@@ -177,14 +176,14 @@ export var testBindTextDirectlyToModel = function () {
|
||||
};
|
||||
|
||||
// Supported for ios only.
|
||||
if (isIOS) {
|
||||
exports.test_set_color = function () {
|
||||
export function test_set_color() {
|
||||
if (__APPLE__) {
|
||||
helper.buildUIAndRunTest(_createTextFieldFunc(), function (views: Array<View>) {
|
||||
var textField = <TextField>views[0];
|
||||
textField.color = new Color('red');
|
||||
TKUnit.assert(textField.color.ios.CGColor.isEqual(textField.ios.textColor.CGColor), 'textField.color');
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export var testBindTextToBindingContext = function () {
|
||||
|
||||
@@ -18,7 +18,6 @@ export function pageLoaded(args) {
|
||||
obj.set('someProperty', 'Please change this text!');
|
||||
page.bindingContext = obj;
|
||||
}
|
||||
exports.pageLoaded = pageLoaded;
|
||||
// << observable-declare
|
||||
|
||||
export function test_recycling() {
|
||||
@@ -73,14 +72,15 @@ export var testSetTextUndefined = function () {
|
||||
};
|
||||
|
||||
// Supported for ios only.
|
||||
if (__APPLE__) {
|
||||
exports.test_set_color = function () {
|
||||
|
||||
export function test_set_color() {
|
||||
if (__APPLE__) {
|
||||
helper.buildUIAndRunTest(_createTextViewFunc(), function (views: Array<View>) {
|
||||
var textView = <TextView>views[0];
|
||||
textView.color = new Color('red');
|
||||
TKUnit.assertEqual(textView.color.ios.CGColor, textView.ios.textColor.CGColor, 'textView.color');
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export var testBindTextDirectlyToModel = function () {
|
||||
|
||||
Reference in New Issue
Block a user