mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 20:11:24 +08:00
chore: cleanup
This commit is contained in:
@ -1 +1 @@
|
|||||||
{"eventType":"StartElement","position":{"line":2,"column":1},"elementName":"DocumentElement","attributes":{"param":"value"}}{"eventType":"StartElement","position":{"line":3,"column":3},"elementName":"First.Element","attributes":{"some.attr":"some.value"}}{"eventType":"Text","position":{"line":3,"column":41},"data":"\n ¶ Some Text ®\n "}{"eventType":"EndElement","position":{"line":5,"column":3},"elementName":"First.Element"}{"eventType":"StartElement","position":{"line":7,"column":3},"elementName":"SecondElement","attributes":{"param2":"something"}}{"eventType":"Text","position":{"line":7,"column":37},"data":"\n Pre-Text "}{"eventType":"StartElement","position":{"line":8,"column":14},"elementName":"Inline"}{"eventType":"Text","position":{"line":8,"column":22},"data":"Inlined text"}{"eventType":"EndElement","position":{"line":8,"column":34},"elementName":"Inline"}{"eventType":"Text","position":{"line":8,"column":43},"data":" Post-text.\n "}{"eventType":"EndElement","position":{"line":9,"column":3},"elementName":"SecondElement"}{"eventType":"StartElement","position":{"line":10,"column":3},"elementName":"entities"}{"eventType":"Text","position":{"line":10,"column":13},"data":"Xml tags begin with \"<\" and end with \">\" Ampersand is & and apostrophe is '"}{"eventType":"EndElement","position":{"line":10,"column":123},"elementName":"entities"}{"eventType":"StartElement","position":{"line":11,"column":3},"elementName":"script"}{"eventType":"CDATA","position":{"line":12,"column":5},"data":"\nfunction sum(a,b)\n{\n return a+b;\n}\n"}{"eventType":"EndElement","position":{"line":18,"column":3},"elementName":"script"}{"eventType":"Comment","position":{"line":19,"column":3},"data":"\n Hello,\n I am a multi-line XML comment.\n"}{"eventType":"EndElement","position":{"line":23,"column":1},"elementName":"DocumentElement"}
|
{"eventType":"StartElement","position":{"line":2,"column":1},"elementName":"DocumentElement","attributes":{"param":"value"}}{"eventType":"StartElement","position":{"line":3,"column":3},"elementName":"First.Element","attributes":{"some.attr":"some.value"}}{"eventType":"Text","position":{"line":3,"column":41},"data":"\n ¶ Some Text ®\n "}{"eventType":"EndElement","position":{"line":5,"column":3},"elementName":"First.Element"}{"eventType":"StartElement","position":{"line":7,"column":3},"elementName":"SecondElement","attributes":{"param2":"something"}}{"eventType":"Text","position":{"line":7,"column":37},"data":"\n Pre-Text "}{"eventType":"StartElement","position":{"line":8,"column":14},"elementName":"Inline"}{"eventType":"Text","position":{"line":8,"column":22},"data":"Inlined text"}{"eventType":"EndElement","position":{"line":8,"column":34},"elementName":"Inline"}{"eventType":"Text","position":{"line":8,"column":43},"data":" Post-text.\n "}{"eventType":"EndElement","position":{"line":9,"column":3},"elementName":"SecondElement"}{"eventType":"StartElement","position":{"line":10,"column":3},"elementName":"entities"}{"eventType":"Text","position":{"line":10,"column":13},"data":"Xml tags begin with \"<\" and end with \">\" Ampersand is & and apostrophe is '"}{"eventType":"EndElement","position":{"line":10,"column":123},"elementName":"entities"}{"eventType":"StartElement","position":{"line":11,"column":3},"elementName":"script"}{"eventType":"CDATA","position":{"line":12,"column":5},"data":"\nfunction sum(a,b)\n{\n return a+b;\n}\n"}{"eventType":"EndElement","position":{"line":18,"column":3},"elementName":"script"}{"eventType":"Comment","position":{"line":19,"column":3},"data":"\n Hello,\n I am a multi-line XML comment.\n"}{"eventType":"EndElement","position":{"line":23,"column":1},"elementName":"DocumentElement"}
|
@ -20,4 +20,4 @@ function sum(a,b)
|
|||||||
Hello,
|
Hello,
|
||||||
I am a multi-line XML comment.
|
I am a multi-line XML comment.
|
||||||
-->
|
-->
|
||||||
</DocumentElement>
|
</DocumentElement>
|
@ -186,15 +186,15 @@ export var testFileRead = function () {
|
|||||||
// << file-system-example-text
|
// << file-system-example-text
|
||||||
};
|
};
|
||||||
|
|
||||||
export var testFileReadWriteBinary = function () {
|
export function testFileReadWriteBinary() {
|
||||||
// >> file-system-read-binary
|
// >> file-system-read-binary
|
||||||
var fileName = 'logo.png';
|
const fileName = 'logo.png';
|
||||||
var error;
|
let error;
|
||||||
|
const appFolder = fs.knownFolders.currentApp().path;
|
||||||
|
const sourceFile = fs.File.fromPath(appFolder + '/assets/' + fileName);
|
||||||
|
const destinationFile = fs.knownFolders.documents().getFile(fileName);
|
||||||
|
|
||||||
var sourceFile = fs.File.fromPath(__dirname + '/assets/' + fileName);
|
const source = sourceFile.readSync((e) => {
|
||||||
var destinationFile = fs.knownFolders.documents().getFile(fileName);
|
|
||||||
|
|
||||||
var source = sourceFile.readSync((e) => {
|
|
||||||
error = e;
|
error = e;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ export var testFileReadWriteBinary = function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// >> (hide)
|
// >> (hide)
|
||||||
var destination = destinationFile.readSync((e) => {
|
const destination = destinationFile.readSync((e) => {
|
||||||
error = e;
|
error = e;
|
||||||
});
|
});
|
||||||
TKUnit.assertNull(error);
|
TKUnit.assertNull(error);
|
||||||
@ -216,14 +216,14 @@ export var testFileReadWriteBinary = function () {
|
|||||||
destinationFile.removeSync();
|
destinationFile.removeSync();
|
||||||
// << (hide)
|
// << (hide)
|
||||||
// << file-system-read-binary
|
// << file-system-read-binary
|
||||||
};
|
}
|
||||||
|
|
||||||
export var testFileReadWriteBinaryAsync = function () {
|
export function testFileReadWriteBinaryAsync() {
|
||||||
// >> file-system-read-binary-async
|
// >> file-system-read-binary-async
|
||||||
var fileName = 'logo.png';
|
const fileName = 'logo.png';
|
||||||
|
const appFolder = fs.knownFolders.currentApp().path;
|
||||||
var sourceFile = fs.File.fromPath(__dirname + '/assets/' + fileName);
|
const sourceFile = fs.File.fromPath(appFolder + '/assets/' + fileName);
|
||||||
var destinationFile = fs.knownFolders.documents().getFile(fileName);
|
const destinationFile = fs.knownFolders.documents().getFile(fileName);
|
||||||
|
|
||||||
// Read the file
|
// Read the file
|
||||||
sourceFile.read().then(
|
sourceFile.read().then(
|
||||||
@ -263,7 +263,7 @@ export var testFileReadWriteBinaryAsync = function () {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
// << file-system-read-binary-async
|
// << file-system-read-binary-async
|
||||||
};
|
}
|
||||||
|
|
||||||
export var testGetKnownFolders = function () {
|
export var testGetKnownFolders = function () {
|
||||||
// >> file-system-known-folders
|
// >> file-system-known-folders
|
||||||
|
@ -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.
|
// Uncomment this when find way to check android Drawable color set by setColorFilter() method.
|
||||||
if (__APPLE__) {
|
export function test_set_color() {
|
||||||
exports.test_set_color = function () {
|
if (__APPLE__) {
|
||||||
var ai = new activityIndicatorModule.ActivityIndicator();
|
var ai = new activityIndicatorModule.ActivityIndicator();
|
||||||
ai.color = new color.Color('red');
|
ai.color = new color.Color('red');
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ if (__APPLE__) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
helper.buildUIAndRunTest(ai, testAction);
|
helper.buildUIAndRunTest(ai, testAction);
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This method is only for the code snippet
|
// 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';
|
import { MyButton, MyStackLayout } from '../layouts/layout-helper';
|
||||||
|
|
||||||
// >> article-item-tap
|
// >> article-item-tap
|
||||||
function listViewItemTap(args) {
|
export function listViewItemTap(args) {
|
||||||
var itemIndex = args.index;
|
var itemIndex = args.index;
|
||||||
// >> (hide)
|
// >> (hide)
|
||||||
console.log(itemIndex);
|
console.log(itemIndex);
|
||||||
// << (hide)
|
// << (hide)
|
||||||
}
|
}
|
||||||
exports.listViewItemTap = listViewItemTap;
|
|
||||||
// << article-item-tap
|
// << article-item-tap
|
||||||
|
|
||||||
// >> article-load-items
|
// >> article-load-items
|
||||||
@ -20,10 +19,9 @@ function listViewLoadMoreItems(args) {
|
|||||||
}
|
}
|
||||||
// << article-load-items
|
// << article-load-items
|
||||||
listViewLoadMoreItems('test');
|
listViewLoadMoreItems('test');
|
||||||
// function loaded(args) {
|
// export function loaded(args) {
|
||||||
// args.object.bindingContext = { items: [1,2,3,4,5] };
|
// args.object.bindingContext = { items: [1,2,3,4,5] };
|
||||||
// }
|
// }
|
||||||
// exports.loaded = loaded;
|
|
||||||
|
|
||||||
var FEW_ITEMS = [0, 1, 2];
|
var FEW_ITEMS = [0, 1, 2];
|
||||||
var MANY_ITEMS = new Array<number>(100);
|
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';
|
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
|
// >> article-set-bindingcontext
|
||||||
function pageLoaded(args) {
|
export function pageLoaded(args) {
|
||||||
const page = args.object;
|
const page = args.object;
|
||||||
page.bindingContext = { name: 'Some name' };
|
page.bindingContext = { name: 'Some name' };
|
||||||
}
|
}
|
||||||
exports.pageLoaded = pageLoaded;
|
|
||||||
// << article-set-bindingcontext
|
// << article-set-bindingcontext
|
||||||
import * as TKUnit from '../../tk-unit';
|
import * as TKUnit from '../../tk-unit';
|
||||||
import * as helper from '../../ui-helper';
|
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 { isIOS, isAndroid, Utils, Placeholder, CreateViewEventData, View } from '@nativescript/core';
|
||||||
import * as helper from '../../ui-helper';
|
import * as helper from '../../ui-helper';
|
||||||
|
|
||||||
function creatingView(args) {
|
export function creatingView(args) {
|
||||||
let nativeView;
|
let nativeView;
|
||||||
if (__APPLE__) {
|
if (__APPLE__) {
|
||||||
nativeView = UITextView.new();
|
nativeView = UITextView.new();
|
||||||
@ -14,8 +14,6 @@ function creatingView(args) {
|
|||||||
|
|
||||||
args.view = nativeView;
|
args.view = nativeView;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.creatingView = creatingView;
|
|
||||||
// << article-creating-view
|
// << article-creating-view
|
||||||
|
|
||||||
export function test_placeholder_creatingView() {
|
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.
|
// Uncomment this when find way to check android Drawable color set by setColorFilter() method.
|
||||||
if (__APPLE__) {
|
export function test_set_color() {
|
||||||
exports.test_set_color = function () {
|
if (__APPLE__) {
|
||||||
var progress = new progressModule.Progress();
|
var progress = new progressModule.Progress();
|
||||||
progress.color = new color.Color('red');
|
progress.color = new color.Color('red');
|
||||||
|
|
||||||
@ -67,9 +67,11 @@ if (__APPLE__) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
helper.buildUIAndRunTest(progress, testAction);
|
helper.buildUIAndRunTest(progress, testAction);
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
exports.test_set_backgroundColor = function () {
|
export function test_set_backgroundColor() {
|
||||||
|
if (__APPLE__) {
|
||||||
var progress = new progressModule.Progress();
|
var progress = new progressModule.Progress();
|
||||||
progress.backgroundColor = new color.Color('red');
|
progress.backgroundColor = new color.Color('red');
|
||||||
|
|
||||||
@ -78,7 +80,7 @@ if (__APPLE__) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
helper.buildUIAndRunTest(progress, testAction);
|
helper.buildUIAndRunTest(progress, testAction);
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function test_set_maxValue_should_adjust_value() {
|
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.
|
// ### Binding the Progress and Slider value properties to a observable view-model property.
|
||||||
|
|
||||||
// >> article-binding-slider-properties
|
// >> article-binding-slider-properties
|
||||||
// function pageLoaded(args) {
|
// export function pageLoaded(args) {
|
||||||
// var page = args.object;
|
// var page = args.object;
|
||||||
// var obj = new Observable();
|
// var obj = new Observable();
|
||||||
// obj.set("someProperty", 42);
|
// obj.set("someProperty", 42);
|
||||||
// page.bindingContext = obj;
|
// page.bindingContext = obj;
|
||||||
// }
|
// }
|
||||||
// exports.pageLoaded = pageLoaded;
|
|
||||||
// << article-binding-slider-properties
|
// << article-binding-slider-properties
|
||||||
|
|
||||||
interface SliderValues {
|
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.
|
// Uncomment this when find way to check android Drawable color set by setColorFilter() method.
|
||||||
if (__APPLE__) {
|
export function test_set_color() {
|
||||||
exports.test_set_color = function () {
|
if (__APPLE__) {
|
||||||
const slider = new Slider();
|
const slider = new Slider();
|
||||||
slider.color = new Color('red');
|
slider.color = new Color('red');
|
||||||
|
|
||||||
@ -106,9 +105,11 @@ if (__APPLE__) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
helper.buildUIAndRunTest(slider, testAction);
|
helper.buildUIAndRunTest(slider, testAction);
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
exports.test_set_backgroundColor = function () {
|
export function test_set_backgroundColor() {
|
||||||
|
if (__APPLE__) {
|
||||||
const slider = new Slider();
|
const slider = new Slider();
|
||||||
slider.backgroundColor = new Color('red');
|
slider.backgroundColor = new Color('red');
|
||||||
|
|
||||||
@ -117,7 +118,7 @@ if (__APPLE__) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
helper.buildUIAndRunTest(slider, testAction);
|
helper.buildUIAndRunTest(slider, testAction);
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function test_default_TNS_values() {
|
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.
|
// ### Binding the Switch checked property and Button isEanbled property to a observable view-model property.
|
||||||
|
|
||||||
// >> article-binding-switch-property
|
// >> article-binding-switch-property
|
||||||
function pageLoaded(args) {
|
export function pageLoaded(args) {
|
||||||
var page = args.object;
|
var page = args.object;
|
||||||
var obj = new Observable();
|
var obj = new Observable();
|
||||||
obj.set('someProperty', false);
|
obj.set('someProperty', false);
|
||||||
page.bindingContext = obj;
|
page.bindingContext = obj;
|
||||||
}
|
}
|
||||||
exports.pageLoaded = pageLoaded;
|
|
||||||
// << article-binding-switch-property
|
// << article-binding-switch-property
|
||||||
|
|
||||||
export function test_recycling() {
|
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.
|
// 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();
|
var mySwitch = new Switch();
|
||||||
mySwitch.color = new Color('red');
|
mySwitch.color = new Color('red');
|
||||||
|
|
||||||
@ -46,9 +46,11 @@ if (__APPLE__) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
helper.buildUIAndRunTest(mySwitch, testAction);
|
helper.buildUIAndRunTest(mySwitch, testAction);
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
exports.test_set_backgroundColor = function () {
|
export function test_set_backgroundColor() {
|
||||||
|
if (__APPLE__) {
|
||||||
var mySwitch = new Switch();
|
var mySwitch = new Switch();
|
||||||
mySwitch.backgroundColor = new Color('red');
|
mySwitch.backgroundColor = new Color('red');
|
||||||
|
|
||||||
@ -57,7 +59,7 @@ if (__APPLE__) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
helper.buildUIAndRunTest(mySwitch, testAction);
|
helper.buildUIAndRunTest(mySwitch, testAction);
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function test_set_TNS_checked_updates_native_checked() {
|
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 two TextFields text property to observable view-model property.
|
||||||
// >> binding-text-property-textfield
|
// >> binding-text-property-textfield
|
||||||
function pageLoaded(args) {
|
export function pageLoaded(args) {
|
||||||
var page = args.object;
|
var page = args.object;
|
||||||
var obj = new Observable();
|
var obj = new Observable();
|
||||||
obj.set('someProperty', 'Please change this text!');
|
obj.set('someProperty', 'Please change this text!');
|
||||||
page.bindingContext = obj;
|
page.bindingContext = obj;
|
||||||
}
|
}
|
||||||
exports.pageLoaded = pageLoaded;
|
|
||||||
// << binding-text-property-textfield
|
// << binding-text-property-textfield
|
||||||
|
|
||||||
export function test_recycling() {
|
export function test_recycling() {
|
||||||
@ -177,14 +176,14 @@ export var testBindTextDirectlyToModel = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Supported for ios only.
|
// Supported for ios only.
|
||||||
if (isIOS) {
|
export function test_set_color() {
|
||||||
exports.test_set_color = function () {
|
if (__APPLE__) {
|
||||||
helper.buildUIAndRunTest(_createTextFieldFunc(), function (views: Array<View>) {
|
helper.buildUIAndRunTest(_createTextFieldFunc(), function (views: Array<View>) {
|
||||||
var textField = <TextField>views[0];
|
var textField = <TextField>views[0];
|
||||||
textField.color = new Color('red');
|
textField.color = new Color('red');
|
||||||
TKUnit.assert(textField.color.ios.CGColor.isEqual(textField.ios.textColor.CGColor), 'textField.color');
|
TKUnit.assert(textField.color.ios.CGColor.isEqual(textField.ios.textColor.CGColor), 'textField.color');
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export var testBindTextToBindingContext = function () {
|
export var testBindTextToBindingContext = function () {
|
||||||
|
@ -18,7 +18,6 @@ export function pageLoaded(args) {
|
|||||||
obj.set('someProperty', 'Please change this text!');
|
obj.set('someProperty', 'Please change this text!');
|
||||||
page.bindingContext = obj;
|
page.bindingContext = obj;
|
||||||
}
|
}
|
||||||
exports.pageLoaded = pageLoaded;
|
|
||||||
// << observable-declare
|
// << observable-declare
|
||||||
|
|
||||||
export function test_recycling() {
|
export function test_recycling() {
|
||||||
@ -73,14 +72,15 @@ export var testSetTextUndefined = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Supported for ios only.
|
// 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>) {
|
helper.buildUIAndRunTest(_createTextViewFunc(), function (views: Array<View>) {
|
||||||
var textView = <TextView>views[0];
|
var textView = <TextView>views[0];
|
||||||
textView.color = new Color('red');
|
textView.color = new Color('red');
|
||||||
TKUnit.assertEqual(textView.color.ios.CGColor, textView.ios.textColor.CGColor, 'textView.color');
|
TKUnit.assertEqual(textView.color.ios.CGColor, textView.ios.textColor.CGColor, 'textView.color');
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export var testBindTextDirectlyToModel = function () {
|
export var testBindTextDirectlyToModel = function () {
|
||||||
|
@ -24,7 +24,7 @@ export function test_loadWithOptionsNoXML() {
|
|||||||
var v = Builder.load({
|
var v = Builder.load({
|
||||||
path: '~/xml-declaration/mymodule',
|
path: '~/xml-declaration/mymodule',
|
||||||
name: 'MyControl',
|
name: 'MyControl',
|
||||||
exports: exports,
|
exports: this,
|
||||||
page: new Page(),
|
page: new Page(),
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ export function test_loadWithOptionsNoXML_CSSIsApplied() {
|
|||||||
newPage.content = Builder.load({
|
newPage.content = Builder.load({
|
||||||
path: '~/xml-declaration/mymodule',
|
path: '~/xml-declaration/mymodule',
|
||||||
name: 'MyControl',
|
name: 'MyControl',
|
||||||
exports: exports,
|
exports: this,
|
||||||
page: newPage,
|
page: newPage,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ export function test_loadWithOptionsWithXML() {
|
|||||||
var v = Builder.load({
|
var v = Builder.load({
|
||||||
path: '~/xml-declaration/mymodulewithxml',
|
path: '~/xml-declaration/mymodulewithxml',
|
||||||
name: 'MyControl',
|
name: 'MyControl',
|
||||||
exports: exports,
|
exports: this,
|
||||||
page: new Page(),
|
page: new Page(),
|
||||||
});
|
});
|
||||||
TKUnit.assertTrue(v instanceof View, 'Expected result: View; Actual result: ' + v + ';');
|
TKUnit.assertTrue(v instanceof View, 'Expected result: View; Actual result: ' + v + ';');
|
||||||
@ -79,7 +79,7 @@ export function test_loadWithOptionsWithXML_CSSIsApplied() {
|
|||||||
newPage.content = Builder.load({
|
newPage.content = Builder.load({
|
||||||
path: '~/xml-declaration/mymodulewithxml',
|
path: '~/xml-declaration/mymodulewithxml',
|
||||||
name: 'MyControl',
|
name: 'MyControl',
|
||||||
exports: exports,
|
exports: this,
|
||||||
page: newPage,
|
page: newPage,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import { isIOS, Device } from '@nativescript/core/platform';
|
|||||||
import lazy from '@nativescript/core/utils/lazy';
|
import lazy from '@nativescript/core/utils/lazy';
|
||||||
|
|
||||||
const sdkVersion = lazy(() => parseInt(Device.sdkVersion));
|
const sdkVersion = lazy(() => parseInt(Device.sdkVersion));
|
||||||
|
const appFolder = fs.knownFolders.currentApp().path;
|
||||||
|
|
||||||
export var test_XmlParser_IsDefined = function () {
|
export var test_XmlParser_IsDefined = function () {
|
||||||
TKUnit.assertNotEqual(xmlModule.XmlParser, undefined, 'Class XmlParser should be defined!');
|
TKUnit.assertNotEqual(xmlModule.XmlParser, undefined, 'Class XmlParser should be defined!');
|
||||||
@ -92,7 +93,7 @@ export var test_XmlParser_OnErrorIsCalledWhenAnErrorOccurs = function () {
|
|||||||
},
|
},
|
||||||
function (error: Error) {
|
function (error: Error) {
|
||||||
e = error;
|
e = error;
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
xmlParser.parse('<element></otherElement>');
|
xmlParser.parse('<element></otherElement>');
|
||||||
TKUnit.assert(e !== undefined, 'Expected result: error; Actual result: ' + e + ';');
|
TKUnit.assert(e !== undefined, 'Expected result: error; Actual result: ' + e + ';');
|
||||||
@ -103,8 +104,8 @@ export var test_XmlParser_IntegrationTest = function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var actualResult = '';
|
let actualResult = '';
|
||||||
var xmlParser = new xmlModule.XmlParser(function (event: xmlModule.ParserEvent) {
|
const xmlParser = new xmlModule.XmlParser(function (event: xmlModule.ParserEvent) {
|
||||||
if (event.eventType === xmlModule.ParserEventType.Text && event.data.trim() === '') {
|
if (event.eventType === xmlModule.ParserEventType.Text && event.data.trim() === '') {
|
||||||
// Ignore ignorable whitespace.
|
// Ignore ignorable whitespace.
|
||||||
return;
|
return;
|
||||||
@ -113,20 +114,20 @@ export var test_XmlParser_IntegrationTest = function () {
|
|||||||
actualResult += event.toString();
|
actualResult += event.toString();
|
||||||
});
|
});
|
||||||
|
|
||||||
var file = fs.File.fromPath(fs.path.join(__dirname, 'xml.xml'));
|
let file = fs.File.fromPath(appFolder + '/assets/xml.xml');
|
||||||
var xmlString = file.readTextSync();
|
let xmlString = file.readTextSync();
|
||||||
xmlString = xmlString.replace(/(\r\n|\n|\r)/gm, '\n');
|
xmlString = xmlString.replace(/(\r\n|\n|\r)/gm, '\n');
|
||||||
xmlParser.parse(xmlString);
|
xmlParser.parse(xmlString);
|
||||||
|
|
||||||
var expectedResult: string;
|
let expectedResult: string;
|
||||||
file = fs.File.fromPath(fs.path.join(__dirname, 'xml.expected'));
|
file = fs.File.fromPath(appFolder + '/assets/xml.expected');
|
||||||
expectedResult = file.readTextSync();
|
expectedResult = file.readTextSync();
|
||||||
|
|
||||||
var i;
|
let i;
|
||||||
var maxLength = Math.max(actualResult.length, expectedResult.length);
|
const maxLength = Math.max(actualResult.length, expectedResult.length);
|
||||||
for (i = 0; i < maxLength; i++) {
|
for (i = 0; i < maxLength; i++) {
|
||||||
var actualChar;
|
let actualChar;
|
||||||
var actualCharCode;
|
let actualCharCode;
|
||||||
if (i <= actualResult.length) {
|
if (i <= actualResult.length) {
|
||||||
actualChar = actualResult.charAt(i);
|
actualChar = actualResult.charAt(i);
|
||||||
actualCharCode = actualResult.charCodeAt(i);
|
actualCharCode = actualResult.charCodeAt(i);
|
||||||
@ -213,10 +214,10 @@ export var test_XmlParser_NamespacesTest = function () {
|
|||||||
TKUnit.assert(actualResult === expectedResult, 'Actual: ' + actualResult + '; Expected: ' + expectedResult);
|
TKUnit.assert(actualResult === expectedResult, 'Actual: ' + actualResult + '; Expected: ' + expectedResult);
|
||||||
},
|
},
|
||||||
undefined,
|
undefined,
|
||||||
true
|
true,
|
||||||
);
|
);
|
||||||
|
|
||||||
var file = fs.File.fromPath(fs.path.join(__dirname, 'xml-with-namespaces.xml'));
|
var file = fs.File.fromPath(appFolder + '/assets/xml-with-namespaces.xml');
|
||||||
var xmlString = file.readTextSync();
|
var xmlString = file.readTextSync();
|
||||||
xmlParser.parse(xmlString);
|
xmlParser.parse(xmlString);
|
||||||
};
|
};
|
||||||
|
@ -3,10 +3,7 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"diagnostics": false,
|
"diagnostics": false,
|
||||||
"paths": {
|
"paths": {
|
||||||
"~/*": ["src/*"],
|
"~/*": ["src/*"]
|
||||||
"tns-core-modules/*": ["@nativescript/core/*"],
|
|
||||||
"@nativescript/core": ["../../packages/core/index.ts"],
|
|
||||||
"@nativescript/core/*": ["../../packages/core/*"]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nativescript/android": "~8.9.0",
|
"@nativescript/android": "~8.9.0",
|
||||||
"@nativescript/ios": "~8.9.0",
|
"@nativescript/ios": "esm",
|
||||||
"@nativescript/visionos": "~8.9.0",
|
"@nativescript/visionos": "~8.9.0",
|
||||||
"@nativescript/webpack": "file:../../dist/packages/webpack5",
|
"@nativescript/webpack": "file:../../dist/packages/webpack5",
|
||||||
"typescript": "~5.8.0"
|
"typescript": "~5.8.0"
|
||||||
|
@ -30,12 +30,6 @@
|
|||||||
"forDevice": false,
|
"forDevice": false,
|
||||||
"prepare": false
|
"prepare": false
|
||||||
},
|
},
|
||||||
"defaultConfiguration": "main",
|
|
||||||
"configurations": {
|
|
||||||
"main": {
|
|
||||||
"flags": "--env.env=main --env.target=main --no-hmr --env.commonjs"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependsOn": ["^build"]
|
"dependsOn": ["^build"]
|
||||||
},
|
},
|
||||||
"prepare": {
|
"prepare": {
|
||||||
|
7
packages/core/globals/index.d.ts
vendored
7
packages/core/globals/index.d.ts
vendored
@ -1,7 +0,0 @@
|
|||||||
import { Observable } from '../data/observable';
|
|
||||||
export declare class NativeScriptGlobalState {
|
|
||||||
events: Observable;
|
|
||||||
launched: boolean;
|
|
||||||
}
|
|
||||||
export function installPolyfills(moduleName: string, exportNames: string[]): void;
|
|
||||||
export function initGlobal(): void;
|
|
Reference in New Issue
Block a user