[](https://github.com/NativeScript/NativeScript/actions/workflows/apps_automated.yml)
- [](https://github.com/NativeScript/NativeScript/blob/master/LICENSE)
+ [](https://github.com/NativeScript/NativeScript/blob/main/LICENSE)
[](https://www.npmjs.com/@nativescript/core)
[](https://nativescript.org/discord)
@@ -32,23 +32,23 @@ $ npm run setup
$ npm start
```
-We love you and your pull requests 🤗. Please follow our [contributing guide](https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md) and see [our code of governance](https://github.com/NativeScript/management/blob/master/nativescript-governance.md) to become as involved as you want to be.
+We love you and your pull requests 🤗. Please follow our [contributing guide](https://github.com/NativeScript/NativeScript/blob/main/tools/notes/CONTRIBUTING.md) and see [our code of governance](https://github.com/NativeScript/management/blob/master/nativescript-governance.md) to become as involved as you want to be.
## @nativescript/*
-* [@nativescript/core](https://github.com/NativeScript/NativeScript/tree/master/packages/core)
+* [@nativescript/core](https://github.com/NativeScript/NativeScript/tree/main/packages/core)
* Core iOS/Android for NativeScript.
* [@nativescript/types](https://www.npmjs.com/package/@nativescript/types)
* Types for both iOS/Android below wrapped up as a convenience. *Most commonly used.*
-* [@nativescript/types-ios](https://github.com/NativeScript/NativeScript/tree/master/packages/types-ios)
+* [@nativescript/types-ios](https://github.com/NativeScript/NativeScript/tree/main/packages/types-ios)
* Types for iOS.
-* [@nativescript/types-android](https://github.com/NativeScript/NativeScript/tree/master/packages/types-android)
+* [@nativescript/types-android](https://github.com/NativeScript/NativeScript/tree/main/packages/types-android)
* Types for Android.
-* [@nativescript/types-minimal](https://github.com/NativeScript/NativeScript/tree/master/packages/types-minimal)
+* [@nativescript/types-minimal](https://github.com/NativeScript/NativeScript/tree/main/packages/types-minimal)
* A very minimal set of types for only the latest Android and iOS sdks. Most commonly used to optimize Web-based IDE's which auto load all type declarations from node_modules.
-* [@nativescript/ui-mobile-base](https://github.com/NativeScript/NativeScript/tree/master/packages/ui-mobile-base)
+* [@nativescript/ui-mobile-base](https://github.com/NativeScript/NativeScript/tree/main/packages/ui-mobile-base)
* UI mobile base native classes used by core.
-* [@nativescript/webpack](https://github.com/NativeScript/NativeScript/tree/master/packages/webpack)
+* [@nativescript/webpack](https://github.com/NativeScript/NativeScript/tree/main/packages/webpack5)
* Webpack build utilities and configs used by NativeScript apps.
## Quick Links
@@ -78,7 +78,15 @@ Outside the source centralized in this repo, NativeScript consists of a few othe
- This repo contains the NativeScript command-line interface, which lets you create, build, and run apps using NativeScript. The CLI is written in TypeScript.
- **[Docs](//github.com/NativeScript/docs-new)**
- This repo contains NativeScript documentation, which is available at . The docs are written in Markdown.
-- **[Official Plugins](https://github.com/NativeScript/plugins)
- - This repo contains a [plugin workspace](https://docs.nativescript.org/plugins/plugin-workspace-guide.html) the TSC (Technical Steering Committee) maintains offering several often useful plugins.
+- **[Plugins](https://github.com/NativeScript/plugins)**
+ - This repo contains a [plugin workspace](https://docs.nativescript.org/plugins/plugin-workspace-guide.html) with several often useful plugins.
+- **[Firebase](https://github.com/NativeScript/firebase)**
+ - Modular Firebase 🔥 implementation for iOS & Android.
+- **[ML Kit](https://github.com/NativeScript/mlkit)**
+ - Google's [ML Kit SDKs for iOS and Android](https://developers.google.com/ml-kit).
+- **[Payments](https://github.com/NativeScript/payments)**
+ - In-App Purchase, Subscriptions, Google Pay and Apple Pay.
+- **[Artwork](https://github.com/NativeScript/artwork)**
+ - Want to use our logo or colors? This repo contains ready to use media material.
Made with ❤️
diff --git a/apps/automated/.npmrc b/apps/automated/.npmrc
index 521a9f7c0..3b5969206 100644
--- a/apps/automated/.npmrc
+++ b/apps/automated/.npmrc
@@ -1 +1,6 @@
legacy-peer-deps=true
+
+# npm 9+ this defaults to `true` meaning `file:` dependencies are packed and then installed
+# but since we want to link the source files in this case, we disable this behavior and
+# opt to link the dependency as-is instead. (eg. @nativescript/core)
+install-links=false
diff --git a/apps/automated/src/application/application-tests-common.ts b/apps/automated/src/application/application-tests-common.ts
index 780c5c9f7..dba7f33ff 100644
--- a/apps/automated/src/application/application-tests-common.ts
+++ b/apps/automated/src/application/application-tests-common.ts
@@ -19,7 +19,7 @@ export function testInitialized() {
export function testDisplayedEvent() {
// global.isDisplayedEventFired flag is set in app.ts application.displayedEvent handler
- TKUnit.assert((global).isDisplayedEventFired, 'application.displayedEvent not fired');
+ TKUnit.assert(global.isDisplayedEventFired, 'application.displayedEvent not fired');
}
export function testOrientation() {
diff --git a/apps/automated/src/fetch/fetch-tests.ts b/apps/automated/src/fetch/fetch-tests.ts
index cf7d8cb44..e4c507f11 100644
--- a/apps/automated/src/fetch/fetch-tests.ts
+++ b/apps/automated/src/fetch/fetch-tests.ts
@@ -8,7 +8,7 @@ export var test_fetch_defined = function () {
export var test_fetch = function (done: (err: Error, res?: string) => void) {
// >> fetch-response
- fetch('https://httpbin.org/get')
+ fetch('https://http-echo.nativescript.org/get')
.then(function (r) {
// Argument (r) is Response!
// >> (hide)
@@ -22,7 +22,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')
+ fetch('https://http-echo.nativescript.org/get')
.then((response) => response.text())
.then(function (r) {
// Argument (r) is string!
@@ -37,7 +37,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')
+ fetch('https://http-echo.nativescript.org/get')
.then((response) => response.json())
.then(function (r) {
// Argument (r) is JSON object!
@@ -52,7 +52,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')
+ fetch('https://http-echo.nativescript.org/get')
.then((response) => response.formData())
.then(function (r) {
// Argument (r) is FormData object!
@@ -67,7 +67,7 @@ export var test_fetch_formData = function (done: (err: Error, res?: string) => v
export var test_fetch_blob = function (done: (err: Error, res?: string) => void) {
// >> fetch-blob
- fetch('https://httpbin.org/get')
+ fetch('https://http-echo.nativescript.org/get')
.then((response) => response.blob())
.then(function (r) {
// Argument (r) is Blob object!
@@ -82,7 +82,7 @@ export var test_fetch_blob = function (done: (err: Error, res?: string) => void)
export var test_fetch_arraybuffer = function (done: (err: Error, res?: string) => void) {
// >> fetch-arraybuffer
- fetch('https://httpbin.org/get')
+ fetch('https://http-echo.nativescript.org/get')
.then((response) => response.arrayBuffer())
.then(function (r) {
// Argument (r) is ArrayBuffer object!
@@ -101,7 +101,7 @@ export var test_fetch_fail_invalid_url = function (done) {
return completed;
};
- fetch('hgfttp://httpbin.org/get')
+ fetch('hgfttp://http-echo.nativescript.org/get')
.catch(function (e) {
completed = true;
done(null);
@@ -111,7 +111,7 @@ export var test_fetch_fail_invalid_url = function (done) {
// Note: fetch is unable to do url validation
// export var test_fetch_invalid_url_fail_message = function (done) {
-// fetch("hgfttp://httpbin.org/get").catch(function (e: TypeError) {
+// fetch("hgfttp://http-echo.nativescript.org/get").catch(function (e: TypeError) {
// TKUnit.assert(e.message.match(/Network request failed:.{2,}/), "Failure message should contain details on the failure. Actual message was: " + e.message);
// done(null);
// }).catch(failOnError(done));
@@ -119,7 +119,7 @@ export var test_fetch_fail_invalid_url = function (done) {
export var test_fetch_response_status = function (done) {
// >> fetch-status-response
- fetch('https://httpbin.org/get')
+ fetch('https://http-echo.nativescript.org/get')
.then(function (response) {
// Argument (response) is Response!
var statusCode = response.status;
@@ -134,7 +134,7 @@ export var test_fetch_response_status = function (done) {
export var test_fetch_response_headers = function (done) {
// >> fetch-headers-response
- fetch('https://httpbin.org/get')
+ fetch('https://http-echo.nativescript.org/get')
.then(function (response) {
// Argument (response) is Response!
// var all = response.headers.getAll();
@@ -148,7 +148,7 @@ export var test_fetch_response_headers = function (done) {
};
export var test_fetch_headers_sent = function (done) {
- fetch('https://httpbin.org/get', {
+ fetch('https://http-echo.nativescript.org/get', {
method: 'GET',
headers: new Headers({ 'Content-Type': 'application/json' }),
})
@@ -165,7 +165,7 @@ export var test_fetch_post_form_data = function (done) {
data.append('MyVariableOne', 'ValueOne');
data.append('MyVariableTwo', 'ValueTwo');
- fetch('https://httpbin.org/post', {
+ fetch('https://http-echo.nativescript.org/post', {
method: 'POST',
headers: new Headers({ 'Content-Type': 'application/x-www-form-urlencoded' }),
body: data,
@@ -182,7 +182,7 @@ export var test_fetch_post_form_data = function (done) {
export var test_fetch_post_json = function (done) {
// >> fetch-post-json
- fetch('https://httpbin.org/post', {
+ fetch('https://http-echo.nativescript.org/post', {
method: 'POST',
headers: new Headers({ 'Content-Type': 'application/json' }),
body: JSON.stringify({ MyVariableOne: 'ValueOne', MyVariableTwo: 'ValueTwo' }),
diff --git a/apps/automated/src/globals/globals-tests.ts b/apps/automated/src/globals/globals-tests.ts
index 987480f31..65c10e14d 100644
--- a/apps/automated/src/globals/globals-tests.ts
+++ b/apps/automated/src/globals/globals-tests.ts
@@ -6,8 +6,8 @@ export function test_global_system_import() {
TKUnit.assert(System, 'System not defined');
TKUnit.assert(typeof System.import === 'function', 'System.import not a function');
- TKUnit.assert((global).System, 'global.System not defined');
- TKUnit.assert(typeof (global).System.import === 'function', 'global.System.import not a function');
+ TKUnit.assert(global.System, 'global.System not defined');
+ TKUnit.assert(typeof global.System.import === 'function', 'global.System.import not a function');
}
export function test_global_zonedCallback() {
diff --git a/apps/automated/src/http/http-string-worker.ts b/apps/automated/src/http/http-string-worker.ts
index 2f01d7896..045e8eaa3 100644
--- a/apps/automated/src/http/http-string-worker.ts
+++ b/apps/automated/src/http/http-string-worker.ts
@@ -5,7 +5,7 @@ postMessage('stub');
//
// import { getString } from '@nativescript/core/http';
//
-// getString('https://httpbin.org/get').then(
+// getString('https://http-echo.nativescript.org/get').then(
// function (r) {
// postMessage(r);
// },
diff --git a/apps/automated/src/http/http-tests.ts b/apps/automated/src/http/http-tests.ts
index 344c6fc25..5901bdb88 100644
--- a/apps/automated/src/http/http-tests.ts
+++ b/apps/automated/src/http/http-tests.ts
@@ -9,7 +9,7 @@ export var test_getString_isDefined = function () {
};
export var test_getString = function (done: (err: Error, res?: string) => void) {
- http.getString('https://httpbin.org/get').then(
+ http.getString('https://http-echo.nativescript.org/get').then(
function (r) {
//// Argument (r) is string!
done(null);
@@ -22,7 +22,7 @@ export var test_getString = function (done: (err: Error, res?: string) => void)
};
export var test_getString_fail = function (done) {
- http.getString({ url: 'hgfttp://httpbin.org/get', method: 'GET', timeout: 2000 }).catch(function (e) {
+ http.getString({ url: 'hgfttps://http-echo.nativescript.org/get', method: 'GET', timeout: 2000 }).catch(function (e) {
done(null);
});
};
@@ -31,7 +31,7 @@ export var test_getString_fail = function (done) {
// export var test_getString_fail_when_result_is_not_string = function (done) {
// var result;
-// http.getString({ url: "https://httpbin.org/image/png", method: "GET" }).then(function (e) {
+// http.getString({ url: "https://http-echo.nativescript.org/image/png/logo.png", method: "GET" }).then(function (e) {
// result = e;
// try {
// TKUnit.assert(result instanceof Error, "Result from getString().catch() should be Error! Current type is " + typeof result);
@@ -50,7 +50,7 @@ export var test_getJSON_isDefined = function () {
export var test_getJSON = function (done) {
var result;
- http.getJSON('https://httpbin.org/get').then(
+ http.getJSON('https://http-echo.nativescript.org/get').then(
function (r) {
//// Argument (r) is JSON!
//completed = true;
@@ -74,7 +74,7 @@ export var test_getJSON = function (done) {
export var test_getJSON_fail = function (done) {
var result;
- http.getJSON({ url: 'hgfttp://httpbin.org/get', method: 'GET', timeout: 2000 }).catch(function (e) {
+ http.getJSON({ url: 'hgfttps://http-echo.nativescript.org/', method: 'GET', timeout: 2000 }).catch(function (e) {
result = e;
try {
TKUnit.assert(result instanceof Error, 'Result from getJSON().catch() should be Error! Current type is ' + typeof result);
@@ -88,7 +88,7 @@ export var test_getJSON_fail = function (done) {
export var test_getJSON_fail_when_result_is_not_JSON = function (done) {
var result;
- http.getJSON({ url: 'https://httpbin.org/html', method: 'GET' }).catch(function (e) {
+ http.getJSON({ url: 'https://http-echo.nativescript.org/html', method: 'GET' }).catch(function (e) {
result = e;
try {
TKUnit.assert(result instanceof Error, 'Result from getJSON().catch() should be Error! Current type is ' + typeof result);
@@ -102,7 +102,7 @@ export var test_getJSON_fail_when_result_is_not_JSON = function (done) {
export var test_getJSONP = function (done) {
var result;
- http.getJSON('https://jsfiddle.net/echo/jsonp/').then(
+ http.getJSON('https://http-echo.nativescript.org/jsonp').then(
function (r) {
result = r;
try {
@@ -122,7 +122,7 @@ export var test_getJSONP = function (done) {
export var test_getJSON_fail_when_result_is_not_JSONP = function (done) {
var result;
- http.getJSON({ url: 'https://httpbin.org/html', method: 'GET' }).catch(function (e) {
+ http.getJSON({ url: 'https://http-echo.nativescript.org/html', method: 'GET' }).catch(function (e) {
result = e;
try {
TKUnit.assert(result instanceof Error, 'Result from getJSON().catch() should be Error! Current type is ' + typeof result);
@@ -138,7 +138,7 @@ export var test_gzip_request_explicit = function (done) {
http
.request({
- url: 'https://postman-echo.com/gzip',
+ url: 'https://http-echo.nativescript.org/gzip',
method: 'GET',
headers: {
'Accept-Encoding': 'gzip',
@@ -165,7 +165,7 @@ export var test_gzip_request_implicit = function (done) {
http
.request({
- url: 'https://postman-echo.com/gzip',
+ url: 'https://http-echo.nativescript.org/gzip',
method: 'GET',
})
.then(
@@ -191,7 +191,7 @@ export var test_getImage_isDefined = function () {
export var test_getImage = function (done) {
var result;
- http.getImage('https://httpbin.org/image/png').then(
+ http.getImage('https://http-echo.nativescript.org/image/png/logo.png').then(
(r) => {
// Argument (r) is ImageSource!
result = r;
@@ -226,7 +226,7 @@ export var test_getImage_fail = function (done) {
export var test_getImage_fail_when_result_is_not_image = function (done) {
var result;
- http.getImage({ url: 'https://httpbin.org/html', method: 'GET' }).catch(function (e) {
+ http.getImage({ url: 'https://http-echo.nativescript.org/html', method: 'GET' }).catch(function (e) {
result = e;
try {
TKUnit.assert(result instanceof Error, 'Result from getImage().catch() should be Error! Current type is ' + typeof result);
@@ -266,7 +266,7 @@ export var test_getContentAsFile = function (done) {
var result;
var filePath = fs.path.join(fs.knownFolders.documents().path, 'test.png');
- http.getFile('https://httpbin.org/image/png?testQuery=query&anotherParam=param', filePath).then(
+ http.getFile('https://http-echo.nativescript.org/image/png/logo.png?testQuery=query&anotherParam=param', filePath).then(
function (r) {
//// Argument (r) is File!
result = r;
@@ -332,7 +332,7 @@ export var test_request_requestShouldTimeout = function (done) {
export var test_request_responseStatusCodeShouldBeDefined = function (done) {
var result: http.HttpResponse;
- http.request({ url: 'https://httpbin.org/get', method: 'GET' }).then(
+ http.request({ url: 'https://http-echo.nativescript.org/get', method: 'GET' }).then(
function (response) {
//// Argument (response) is HttpResponse!
var statusCode = response.statusCode;
@@ -352,7 +352,7 @@ export var test_request_responseStatusCodeShouldBeDefined = function (done) {
};
export var test_headRequest_responseStatusCodeShouldBeDefined = function (done) {
- http.request({ url: 'https://httpbin.org/get', method: 'HEAD' }).then(
+ http.request({ url: 'https://http-echo.nativescript.org/get', method: 'HEAD' }).then(
function (response) {
try {
TKUnit.assert(typeof response.statusCode !== 'undefined', 'response.statusCode should be defined!');
@@ -370,7 +370,7 @@ export var test_headRequest_responseStatusCodeShouldBeDefined = function (done)
export var test_request_responseHeadersShouldBeDefined = function (done) {
var result: http.HttpResponse;
- http.request({ url: 'https://httpbin.org/get', method: 'GET' }).then(
+ http.request({ url: 'https://http-echo.nativescript.org/get', method: 'GET' }).then(
function (response) {
//// Argument (response) is HttpResponse!
//for (var header in response.headers) {
@@ -394,7 +394,7 @@ export var test_request_responseHeadersShouldBeDefined = function (done) {
export var test_request_responseContentShouldBeDefined = function (done) {
var result: http.HttpResponse;
- http.request({ url: 'https://httpbin.org/get', method: 'GET' }).then(
+ http.request({ url: 'https://http-echo.nativescript.org/get', method: 'GET' }).then(
function (response) {
//// Argument (response) is HttpResponse!
//// Content property of the response is HttpContent!
@@ -416,7 +416,7 @@ export var test_request_responseContentShouldBeDefined = function (done) {
export var test_request_responseContentToStringShouldReturnString = function (done) {
var result;
- http.request({ url: 'https://httpbin.org/get', method: 'GET' }).then(
+ http.request({ url: 'https://http-echo.nativescript.org/get', method: 'GET' }).then(
function (response) {
result = response.content.toString();
try {
@@ -435,7 +435,7 @@ export var test_request_responseContentToStringShouldReturnString = function (do
export var test_request_responseContentToJSONShouldReturnJSON = function (done) {
var result;
- http.request({ url: 'https://httpbin.org/get', method: 'GET' }).then(
+ http.request({ url: 'https://http-echo.nativescript.org/get', method: 'GET' }).then(
function (response) {
result = response.content.toJSON();
try {
@@ -454,7 +454,7 @@ export var test_request_responseContentToJSONShouldReturnJSON = function (done)
export var test_request_responseContentToImageShouldReturnCorrectImage = function (done) {
var result;
- http.request({ url: 'https://httpbin.org/image/png', method: 'GET' }).then(
+ http.request({ url: 'https://http-echo.nativescript.org/image/png/logo.png', method: 'GET' }).then(
function (response) {
response.content.toImage().then((source) => {
result = source;
@@ -475,7 +475,7 @@ export var test_request_responseContentToImageShouldReturnCorrectImage = functio
export var test_request_responseContentToFileFromUrlShouldReturnCorrectFile = function (done) {
var result;
- http.request({ url: 'https://raw.githubusercontent.com/NativeScript/NativeScript/master/tests/app/logo.png', method: 'GET' }).then(
+ http.request({ url: 'https://http-echo.nativescript.org/image/png/logo.png', method: 'GET' }).then(
function (response) {
result = response.content.toFile();
try {
@@ -491,9 +491,9 @@ export var test_request_responseContentToFileFromUrlShouldReturnCorrectFile = fu
);
};
export var test_request_responseContentToFileFromUrlShouldReturnCorrectFileAndCreateDirPathIfNecesary = function (done) {
- var result;
+ var result: fs.File;
- http.request({ url: 'https://raw.githubusercontent.com/NativeScript/NativeScript/master/tests/app/logo.png', method: 'GET' }).then(
+ http.request({ url: 'https://http-echo.nativescript.org/image/png/logo.png', method: 'GET' }).then(
function (response) {
const filePath = fs.path.join(fs.knownFolders.temp().path, 'test', 'some', 'path', 'logo.png');
result = response.content.toFile(filePath);
@@ -514,7 +514,7 @@ export var test_request_responseContentToFileFromUrlShouldReturnCorrectFileAndCr
export var test_request_responseContentToFileFromContentShouldReturnCorrectFile = function (done) {
var result;
- http.request({ url: 'https://httpbin.org/image/png?queryString=param&another=anotherParam', method: 'GET' }).then(
+ http.request({ url: 'https://http-echo.nativescript.org/image/png/logo.png?queryString=param&another=anotherParam', method: 'GET' }).then(
function (response) {
result = response.content.toFile();
try {
@@ -535,7 +535,7 @@ export var test_request_headersSentAndReceivedProperly = function (done) {
http
.request({
- url: 'https://httpbin.org/get',
+ url: 'https://http-echo.nativescript.org/get',
method: 'GET',
headers: { 'Content-Type': 'application/json' },
})
@@ -580,7 +580,7 @@ export var test_request_contentSentAndReceivedProperly = function (done) {
http
.request({
- url: 'https://httpbin.org/post',
+ url: 'https://http-echo.nativescript.org/post',
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
content: 'MyVariableOne=ValueOne&MyVariableTwo=ValueTwo',
@@ -610,7 +610,7 @@ export var test_request_FormDataContentSentAndReceivedProperly = function (done)
http
.request({
- url: 'https://httpbin.org/post',
+ url: 'https://http-echo.nativescript.org/post',
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
content: data,
@@ -638,7 +638,7 @@ export var test_request_NonStringHeadersSentAndReceivedProperly = function (done
http
.request({
- url: 'https://httpbin.org/post',
+ url: 'https://http-echo.nativescript.org/post',
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Content-Length': postData.length },
content: postData,
@@ -664,7 +664,7 @@ export var test_request_jsonAsContentSentAndReceivedProperly = function (done) {
http
.request({
- url: 'https://httpbin.org/post',
+ url: 'https://http-echo.nativescript.org/post',
method: 'POST',
headers: { 'Content-Type': 'application/json' },
content: JSON.stringify({ MyVariableOne: 'ValueOne', MyVariableTwo: 'ValueTwo' }),
diff --git a/apps/automated/src/livesync/livesync-tests.ts b/apps/automated/src/livesync/livesync-tests.ts
index 668008ba2..427e30112 100644
--- a/apps/automated/src/livesync/livesync-tests.ts
+++ b/apps/automated/src/livesync/livesync-tests.ts
@@ -249,7 +249,7 @@ function _test_onLiveSync_ModalViewClosed(context: ModuleContext) {
}
function livesync(context: ModuleContext) {
- const ls = (global).__coreModulesLiveSync || global.__onLiveSync;
+ const ls = global.__coreModulesLiveSync || global.__onLiveSync;
ls(context);
}
diff --git a/apps/automated/src/main.ts b/apps/automated/src/main.ts
index 2d2b00198..acb8fc89c 100644
--- a/apps/automated/src/main.ts
+++ b/apps/automated/src/main.ts
@@ -16,7 +16,7 @@ if (Application.ios) {
// Common events for both Android and iOS.
Application.on(Application.displayedEvent, function (args: ApplicationEventData) {
- (global).isDisplayedEventFired = true;
+ global.isDisplayedEventFired = true;
if (args.android) {
// For Android applications, args.android is an Android activity class.
diff --git a/apps/automated/src/test-runner.ts b/apps/automated/src/test-runner.ts
index 2e3d54e8a..32c226958 100644
--- a/apps/automated/src/test-runner.ts
+++ b/apps/automated/src/test-runner.ts
@@ -43,11 +43,13 @@ import * as xhrTests from './xhr/xhr-tests';
import * as fetchTests from './fetch/fetch-tests';
import * as timerTests from './timer/timer-tests';
import * as profilingTests from './profiling/profiling-tests';
+
+allTests['HTTP'] = httpTests;
+allTests['XHR'] = xhrTests;
+allTests['FETCH'] = fetchTests;
+
// don't run these on CI as they are flaky
if (!__CI__) {
- allTests['HTTP'] = httpTests;
- allTests['XHR'] = xhrTests;
- allTests['FETCH'] = fetchTests;
allTests['TIMER'] = timerTests;
allTests['PROFILING'] = profilingTests;
}
@@ -255,8 +257,8 @@ allTests['SEGMENTED-BAR'] = segmentedBarTests;
import * as lifecycle from './ui/lifecycle/lifecycle-tests';
allTests['LIFECYCLE'] = lifecycle;
-// import * as cssAnimationTests from './ui/animation/css-animation-tests';
-// allTests['CSS-ANIMATION'] = cssAnimationTests;
+import * as cssAnimationTests from './ui/animation/css-animation-tests';
+allTests['CSS-ANIMATION'] = cssAnimationTests;
import * as transitionTests from './navigation/transition-tests';
allTests['TRANSITIONS'] = transitionTests;
@@ -276,8 +278,8 @@ allTests['TAB-VIEW-ROOT'] = tabViewRootTests;
import * as resetRootViewTests from './ui/root-view/reset-root-view-tests';
allTests['RESET-ROOT-VIEW'] = resetRootViewTests;
-import * as rootViewTests from './ui/root-view/root-view-tests';
-allTests['ROOT-VIEW'] = rootViewTests;
+// import * as rootViewTests from './ui/root-view/root-view-tests';
+// allTests['ROOT-VIEW'] = rootViewTests;
import * as utilsTests from './utils/utils-tests';
allTests['UTILS'] = utilsTests;
diff --git a/apps/automated/src/ui/animation/css-animation-tests.ts b/apps/automated/src/ui/animation/css-animation-tests.ts
index ae4206ff8..edb41b114 100644
--- a/apps/automated/src/ui/animation/css-animation-tests.ts
+++ b/apps/automated/src/ui/animation/css-animation-tests.ts
@@ -1,5 +1,5 @@
import * as TKUnit from '../../tk-unit';
-import * as styleScope from '@nativescript/core/ui/styling/style-scope';
+import { StyleScope } from '@nativescript/core/ui/styling/style-scope';
import * as keyframeAnimation from '@nativescript/core/ui/animation/keyframe-animation';
import { CoreTypes } from '@nativescript/core';
import * as helper from '../../ui-helper';
@@ -13,28 +13,35 @@ const DELTA = 1;
const SCALE_DELTA = 0.001;
function createAnimationFromCSS(css: string, name: string): keyframeAnimation.KeyframeAnimationInfo {
- let scope = new styleScope.StyleScope();
+ const scope = new StyleScope();
scope.css = css;
- scope.ensureSelectors();
- let selector = findSelectorInScope(scope, name);
- if (selector !== undefined) {
- let animation = scope.getAnimations(selector.ruleset)[0];
+ const selector = findSelectorInScope(scope, name);
+ if (selector) {
+ const animation = scope.getAnimations(selector.ruleset)[0];
return animation;
}
-
- return undefined;
}
-function findSelectorInScope(scope: styleScope.StyleScope, cssClass: string): SelectorCore {
+function findSelectorInScope(scope: StyleScope, cssClass: string): SelectorCore {
let selectors = scope.query({ cssClasses: new Set([cssClass]) });
return selectors[0];
}
export function test_ReadAnimationProperties() {
- let css = '.test { ' + 'animation-name: first; ' + 'animation-duration: 4s; ' + 'animation-timing-function: ease-in; ' + 'animation-delay: 1.5; ' + 'animation-iteration-count: 10; ' + 'animation-direction: reverse; ' + 'animation-fill-mode: forwards; ' + ' }';
- let animation = createAnimationFromCSS(css, 'test');
+ let animation = createAnimationFromCSS(
+ `.test {
+ animation-name: first;
+ animation-duration: 4s;
+ animation-timing-function: ease-in;
+ animation-delay: 1.5;
+ animation-iteration-count: 10;
+ animation-direction: reverse;
+ animation-fill-mode: forwards;
+ }`,
+ 'test'
+ );
TKUnit.assertEqual(animation.name, 'first');
TKUnit.assertEqual(animation.duration, 4000);
TKUnit.assertEqual(animation.curve, CoreTypes.AnimationCurve.easeIn);
@@ -45,7 +52,12 @@ export function test_ReadAnimationProperties() {
}
export function test_ReadTheAnimationProperty() {
- let animation = createAnimationFromCSS('.test { animation: second 0.2s ease-out 1 2 }', 'test');
+ let animation = createAnimationFromCSS(
+ `.test {
+ animation: second 0.2s ease-out 1s 2;
+ }`,
+ 'test'
+ );
TKUnit.assertEqual(animation.name, 'second');
TKUnit.assertEqual(animation.duration, 200);
TKUnit.assertEqual(animation.curve, CoreTypes.AnimationCurve.easeOut);
@@ -54,53 +66,126 @@ export function test_ReadTheAnimationProperty() {
}
export function test_ReadAnimationCurve() {
- let animation = createAnimationFromCSS('.test { animation-timing-function: ease-in; }', 'test');
+ let animation = createAnimationFromCSS(
+ `.test {
+ animation-timing-function: ease-in;
+ }`,
+ 'test'
+ );
TKUnit.assertEqual(animation.curve, CoreTypes.AnimationCurve.easeIn);
- animation = createAnimationFromCSS('.test { animation-timing-function: ease-out; }', 'test');
+ animation = createAnimationFromCSS(
+ `.test {
+ animation-timing-function: ease-out;
+ }`,
+ 'test'
+ );
TKUnit.assertEqual(animation.curve, CoreTypes.AnimationCurve.easeOut);
- animation = createAnimationFromCSS('.test { animation-timing-function: linear; }', 'test');
+ animation = createAnimationFromCSS(
+ `.test {
+ animation-timing-function: linear;
+ }`,
+ 'test'
+ );
TKUnit.assertEqual(animation.curve, CoreTypes.AnimationCurve.linear);
- animation = createAnimationFromCSS('.test { animation-timing-function: ease-in-out; }', 'test');
+ animation = createAnimationFromCSS(
+ `.test {
+ animation-timing-function: ease-in-out;
+ }`,
+ 'test'
+ );
TKUnit.assertEqual(animation.curve, CoreTypes.AnimationCurve.easeInOut);
- animation = createAnimationFromCSS('.test { animation-timing-function: spring; }', 'test');
+ animation = createAnimationFromCSS(
+ `.test {
+ animation-timing-function: spring;
+ }`,
+ 'test'
+ );
TKUnit.assertEqual(animation.curve, CoreTypes.AnimationCurve.spring);
- animation = createAnimationFromCSS('.test { animation-timing-function: cubic-bezier(0.1, 1.0, 0.5, 0.5); }', 'test');
+ animation = createAnimationFromCSS(
+ `.test {
+ animation-timing-function: cubic-bezier(0.1, 1.0, 0.5, 0.5);
+ }`,
+ 'test'
+ );
let curve = animation.curve;
TKUnit.assert(curve.x1 === 0.1 && curve.y1 === 1.0 && curve.x2 === 0.5 && curve.y2 === 0.5);
}
export function test_ReadIterations() {
- let animation = createAnimationFromCSS('.test { animation-iteration-count: 5; }', 'test');
+ let animation = createAnimationFromCSS(
+ `.test {
+ animation-iteration-count: 5;
+ }`,
+ 'test'
+ );
TKUnit.assertEqual(animation.iterations, 5);
- animation = createAnimationFromCSS('.test { animation-iteration-count: infinite; }', 'test');
+ animation = createAnimationFromCSS(
+ `.test {
+ animation-iteration-count: infinite;
+ }`,
+ 'test'
+ );
TKUnit.assertEqual(animation.iterations, Number.POSITIVE_INFINITY);
}
export function test_ReadFillMode() {
- let animation = createAnimationFromCSS('.test { animation-iteration-count: 5; }', 'test');
+ let animation = createAnimationFromCSS(
+ `.test {
+ animation-iteration-count: 5;
+ }`,
+ 'test'
+ );
TKUnit.assertFalse(animation.isForwards);
- animation = createAnimationFromCSS('.test { animation-fill-mode: forwards; }', 'test');
+ animation = createAnimationFromCSS(
+ `.test {
+ animation-fill-mode: forwards;
+ }`,
+ 'test'
+ );
TKUnit.assertTrue(animation.isForwards);
- animation = createAnimationFromCSS('.test { animation-fill-mode: backwards; }', 'test');
+ animation = createAnimationFromCSS(
+ `.test {
+ animation-fill-mode: backwards;
+ }`,
+ 'test'
+ );
TKUnit.assertFalse(animation.isForwards);
}
export function test_ReadDirection() {
- let animation = createAnimationFromCSS('.test { animation-iteration-count: 5; }', 'test');
+ let animation = createAnimationFromCSS(
+ `.test {
+ animation-iteration-count: 5;
+ }`,
+ 'test'
+ );
TKUnit.assertFalse(animation.isReverse);
- animation = createAnimationFromCSS('.test { animation-direction: reverse; }', 'test');
+ animation = createAnimationFromCSS(
+ `.test {
+ animation-direction: reverse;
+ }`,
+ 'test'
+ );
TKUnit.assertTrue(animation.isReverse);
- animation = createAnimationFromCSS('.test { animation-direction: normal; }', 'test');
+ animation = createAnimationFromCSS(
+ `.test {
+ animation-direction: normal;
+ }`,
+ 'test'
+ );
TKUnit.assertFalse(animation.isReverse);
}
export function test_ReadKeyframe() {
- let scope = new styleScope.StyleScope();
- scope.css = '.test { animation-name: test; } @keyframes test { from { background-color: red; } to { background-color: blue; } }';
- scope.ensureSelectors();
- let selector = findSelectorInScope(scope, 'test');
- TKUnit.assert(selector !== undefined, 'CSS selector was not created!');
- let animation = scope.getAnimations(selector.ruleset)[0];
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ from { background-color: red; }
+ to { background-color: blue; }
+ }`,
+ 'test'
+ );
+ TKUnit.assert(animation !== undefined, 'CSS selector was not created!');
TKUnit.assertEqual(animation.name, 'test', 'Wrong animation name!');
TKUnit.assertEqual(animation.keyframes.length, 2, 'Keyframes not parsed correctly!');
TKUnit.assertEqual(animation.keyframes[0].duration, 0, 'First keyframe duration should be 0');
@@ -110,8 +195,13 @@ export function test_ReadKeyframe() {
}
export function test_ReadTransformAllSet() {
- const css = '.test { animation-name: test; } @keyframes test { to { transform: rotate(10) scaleX(5) translate(100, 200); } }';
- const animation = createAnimationFromCSS(css, 'test');
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ to { transform: rotate(10) scaleX(5) translate(100, 200); }
+ }`,
+ 'test'
+ );
const { rotate, scale, translate } = getTransformsValues(animation.keyframes[0].declarations);
TKUnit.assertAreClose(rotate.z, 10, DELTA);
@@ -124,8 +214,13 @@ export function test_ReadTransformAllSet() {
}
export function test_ReadTransformNone() {
- const css = '.test { animation-name: test; } @keyframes test { to { transform: none; } }';
- const animation = createAnimationFromCSS(css, 'test');
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ to { transform: none; }
+ }`,
+ 'test'
+ );
const { rotate, scale, translate } = getTransformsValues(animation.keyframes[0].declarations);
TKUnit.assertEqual(rotate.z, 0);
@@ -138,7 +233,13 @@ export function test_ReadTransformNone() {
}
export function test_ReadScale() {
- const animation = createAnimationFromCSS('.test { animation-name: test; } @keyframes test { to { transform: scale(-5, 12.3pt); } }', 'test');
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ to { transform: scale(-5, 12.3pt); }
+ }`,
+ 'test'
+ );
const { scale } = getTransforms(animation.keyframes[0].declarations);
TKUnit.assertEqual(scale.property, 'scale');
@@ -147,7 +248,13 @@ export function test_ReadScale() {
}
export function test_ReadScaleSingle() {
- const animation = createAnimationFromCSS('.test { animation-name: test; } @keyframes test { to { transform: scale(2); } }', 'test');
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ to { transform: scale(2); }
+ }`,
+ 'test'
+ );
const { scale } = getTransforms(animation.keyframes[0].declarations);
TKUnit.assertEqual(scale.property, 'scale');
@@ -156,8 +263,13 @@ export function test_ReadScaleSingle() {
}
export function test_ReadScaleXY() {
- const css = '.test { animation-name: test; } @keyframes test { to { transform: scaleX(5) scaleY(10); } }';
- const animation = createAnimationFromCSS(css, 'test');
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ to { transform: scaleX(5) scaleY(10); }
+ }`,
+ 'test'
+ );
const { scale } = getTransforms(animation.keyframes[0].declarations);
TKUnit.assertEqual(scale.property, 'scale');
@@ -166,8 +278,13 @@ export function test_ReadScaleXY() {
}
export function test_ReadScaleX() {
- const css = '.test { animation-name: test; } @keyframes test { to { transform: scaleX(12.5); } }';
- const animation = createAnimationFromCSS(css, 'test');
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ to { transform: scaleX(12.5); }
+ }`,
+ 'test'
+ );
const { scale } = getTransforms(animation.keyframes[0].declarations);
TKUnit.assertEqual(scale.property, 'scale');
@@ -177,8 +294,13 @@ export function test_ReadScaleX() {
}
export function test_ReadScaleY() {
- const css = '.test { animation-name: test; } @keyframes test { to { transform: scaleY(10); } }';
- const animation = createAnimationFromCSS(css, 'test');
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ to { transform: scaleY(10); }
+ }`,
+ 'test'
+ );
const { scale } = getTransforms(animation.keyframes[0].declarations);
TKUnit.assertEqual(scale.property, 'scale');
@@ -188,8 +310,13 @@ export function test_ReadScaleY() {
}
export function test_ReadScale3d() {
- const css = '.test { animation-name: test; } @keyframes test { to { transform: scale3d(10, 20, 30); } }';
- const animation = createAnimationFromCSS(css, 'test');
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ to { transform: scale3d(10, 20, 30); }
+ }`,
+ 'test'
+ );
const { scale } = getTransforms(animation.keyframes[0].declarations);
TKUnit.assertEqual(scale.property, 'scale');
@@ -198,7 +325,13 @@ export function test_ReadScale3d() {
}
export function test_ReadTranslate() {
- const animation = createAnimationFromCSS('.test { animation-name: test; } @keyframes test { to { transform: translate(100, 20); } }', 'test');
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ to { transform: translate(100, 20); }
+ }`,
+ 'test'
+ );
const { translate } = getTransforms(animation.keyframes[0].declarations);
TKUnit.assertEqual(translate.property, 'translate');
@@ -207,7 +340,13 @@ export function test_ReadTranslate() {
}
export function test_ReadTranslateSingle() {
- const animation = createAnimationFromCSS('.test { animation-name: test; } @keyframes test { to { transform: translate(30); } }', 'test');
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ to { transform: translate(30); }
+ }`,
+ 'test'
+ );
const { translate } = getTransforms(animation.keyframes[0].declarations);
TKUnit.assertEqual(translate.property, 'translate');
@@ -216,8 +355,13 @@ export function test_ReadTranslateSingle() {
}
export function test_ReadTranslateXY() {
- const css = '.test { animation-name: test; } @keyframes test { to { transform: translateX(5) translateY(10); } }';
- const animation = createAnimationFromCSS(css, 'test');
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ to { transform: translateX(5) translateY(10); }
+ }`,
+ 'test'
+ );
const { translate } = getTransforms(animation.keyframes[0].declarations);
TKUnit.assertEqual(translate.property, 'translate');
@@ -226,8 +370,13 @@ export function test_ReadTranslateXY() {
}
export function test_ReadTranslateX() {
- const css = '.test { animation-name: test; } @keyframes test { to { transform: translateX(12.5); } }';
- const animation = createAnimationFromCSS(css, 'test');
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ to { transform: translateX(12.5); }
+ }`,
+ 'test'
+ );
const { translate } = getTransforms(animation.keyframes[0].declarations);
TKUnit.assertEqual(translate.property, 'translate');
@@ -237,8 +386,13 @@ export function test_ReadTranslateX() {
}
export function test_ReadTranslateY() {
- const css = '.test { animation-name: test; } @keyframes test { to { transform: translateY(10); } }';
- const animation = createAnimationFromCSS(css, 'test');
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ to { transform: translateY(10); }
+ }`,
+ 'test'
+ );
const { translate } = getTransforms(animation.keyframes[0].declarations);
TKUnit.assertEqual(translate.property, 'translate');
@@ -248,8 +402,13 @@ export function test_ReadTranslateY() {
}
export function test_ReadTranslate3d() {
- const css = '.test { animation-name: test; } @keyframes test { to { transform: translate3d(10, 20, 30); } }';
- const animation = createAnimationFromCSS(css, 'test');
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ to { transform: translate3d(10, 20, 30); }
+ }`,
+ 'test'
+ );
const { translate } = getTransforms(animation.keyframes[0].declarations);
TKUnit.assertEqual(translate.property, 'translate');
@@ -258,8 +417,13 @@ export function test_ReadTranslate3d() {
}
export function test_ReadRotate() {
- const css = '.test { animation-name: test; } @keyframes test { to { transform: rotate(5); } }';
- const animation = createAnimationFromCSS(css, 'test');
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ to { transform: rotate(5); }
+ }`,
+ 'test'
+ );
const { rotate } = getTransforms(animation.keyframes[0].declarations);
TKUnit.assertEqual(rotate.property, 'rotate');
@@ -267,8 +431,13 @@ export function test_ReadRotate() {
}
export function test_ReadRotateDeg() {
- const css = '.test { animation-name: test; } @keyframes test { to { transform: rotate(45deg); } }';
- const animation = createAnimationFromCSS(css, 'test');
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ to { transform: rotate(45deg); }
+ }`,
+ 'test'
+ );
const { rotate } = getTransforms(animation.keyframes[0].declarations);
TKUnit.assertEqual(rotate.property, 'rotate');
@@ -276,8 +445,13 @@ export function test_ReadRotateDeg() {
}
export function test_ReadRotateRad() {
- const css = '.test { animation-name: test; } @keyframes test { to { transform: rotate(0.7853981634rad); } }';
- const animation = createAnimationFromCSS(css, 'test');
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ to { transform: rotate(0.7853981634rad); }
+ }`,
+ 'test'
+ );
const { rotate } = getTransforms(animation.keyframes[0].declarations);
TKUnit.assertEqual(rotate.property, 'rotate');
@@ -285,8 +459,16 @@ export function test_ReadRotateRad() {
}
export function test_ReadAnimationWithUnsortedKeyframes() {
- let css = '.test { animation-name: test; } ' + '@keyframes test { ' + 'from { opacity: 0; } ' + '20%, 60% { opacity: 0.5; } ' + '40%, 80% { opacity: 0.3; } ' + 'to { opacity: 1; } ' + '}';
- let animation = createAnimationFromCSS(css, 'test');
+ let animation = createAnimationFromCSS(
+ `.test { animation-name: test; }
+ @keyframes test {
+ from { opacity: 0; }
+ 20%, 60% { opacity: 0.5; }
+ 40%, 80% { opacity: 0.3; }
+ to { opacity: 1; }
+ }`,
+ 'test'
+ );
TKUnit.assertEqual(animation.keyframes.length, 6);
TKUnit.assertEqual(animation.keyframes[0].declarations[0].value, 0);
TKUnit.assertEqual(animation.keyframes[1].declarations[0].value, 0.5);
@@ -303,33 +485,56 @@ export function test_ReadAnimationWithUnsortedKeyframes() {
}
export function test_ReadAnimationsWithCSSImport() {
- let css = "@import 'ui/animation/test-page.css'; .test { animation-name: test; }";
+ let css = "@import 'ui/animation/test-page.css'; .test { animation-name: test-page-keyframes; }";
let animation = createAnimationFromCSS(css, 'test');
TKUnit.assertEqual(animation.keyframes.length, 3);
TKUnit.assertEqual(animation.keyframes[1].declarations[0].property, 'backgroundColor');
}
export function test_LoadTwoAnimationsWithTheSameName() {
- let scope = new styleScope.StyleScope();
- scope.css = '@keyframes a1 { from { opacity: 0; } to { opacity: 1; } } @keyframes a1 { from { opacity: 0; } to { opacity: 0.5; } } .a { animation-name: a1; }';
- scope.ensureSelectors();
- let selector = findSelectorInScope(scope, 'a');
- let animation = scope.getAnimations(selector.ruleset)[0];
+ const animation = createAnimationFromCSS(
+ `.a { animation-name: a1; }
+ @keyframes a1 {
+ from { opacity: 0; }
+ to { opacity: 1; }
+ }
+ @keyframes a1 {
+ from { opacity: 0; }
+ to { opacity: 0.5; } /* this should override the previous one */
+ }`,
+ 'a'
+ );
TKUnit.assertEqual(animation.keyframes.length, 2);
TKUnit.assertEqual(animation.keyframes[1].declarations[0].value, 0.5);
- scope = new styleScope.StyleScope();
- scope.css = '@keyframes k { from { opacity: 0; } to { opacity: 1; } } .a { animation-name: k; animation-duration: 2; } .a { animation-name: k; animation-duration: 3; }';
- scope.ensureSelectors();
- selector = findSelectorInScope(scope, 'a');
- TKUnit.assertEqual(scope.getAnimations(selector.ruleset)[0].keyframes.length, 2);
- TKUnit.assertEqual(scope.getAnimations(selector.ruleset)[0].keyframes.length, 2);
+
+ const animation2 = createAnimationFromCSS(
+ `.a {
+ animation-name: k;
+ animation-duration: 2;
+ }
+ .a {
+ animation-name: k;
+ animation-duration: 3;
+ }
+ @keyframes k {
+ from { opacity: 0; }
+ to { opacity: 1; }
+ }`,
+ 'a'
+ );
+
+ TKUnit.assertEqual(animation2.keyframes.length, 2);
+ TKUnit.assertEqual(animation2.keyframes.length, 2);
}
export function test_LoadAnimationProgrammatically() {
let stack = new stackModule.StackLayout();
helper.buildUIAndRunTest(stack, function (views) {
let page = views[1];
- page.css = '@keyframes a { from { opacity: 1; } to { opacity: 0; } }';
+ page.css = `@keyframes a {
+ from { opacity: 1; }
+ to { opacity: 0; }
+ }`;
let animation = page.getKeyframeAnimationWithName('a');
TKUnit.assertEqual(animation.keyframes.length, 2);
TKUnit.assertEqual(animation.keyframes[1].declarations[0].property, 'opacity');
@@ -345,7 +550,14 @@ export function test_ExecuteCSSAnimation() {
let stackLayout = new stackModule.StackLayout();
stackLayout.addChild(label);
- mainPage.css = '@keyframes k { from { background-color: red; } to { background-color: green; } } .l { animation-name: k; animation-duration: 0.1s; animation-fill-mode: forwards; }';
+ mainPage.css = `@keyframes k {
+ from { background-color: red; }
+ to { background-color: green; } }
+ .l {
+ animation-name: k;
+ animation-duration: 0.1s;
+ animation-fill-mode: forwards;
+ }`;
mainPage.content = stackLayout;
TKUnit.waitUntilReady(() => label.isLoaded);
@@ -384,7 +596,7 @@ export function test_ExecuteCSSAnimation() {
//}
export function test_ReadTwoAnimations() {
- let scope = new styleScope.StyleScope();
+ let scope = new StyleScope();
scope.css = '.test { animation: one 0.2s ease-out 1 2, two 2s ease-in; }';
scope.ensureSelectors();
let selector = findSelectorInScope(scope, 'test');
@@ -396,11 +608,16 @@ export function test_ReadTwoAnimations() {
}
export function test_AnimationCurveInKeyframes() {
- let scope = new styleScope.StyleScope();
- scope.css = '@keyframes an { from { animation-timing-function: linear; background-color: red; } 50% { background-color: green; } to { background-color: black; } } .test { animation-name: an; animation-timing-function: ease-in; }';
- scope.ensureSelectors();
- let selector = findSelectorInScope(scope, 'test');
- let animation = scope.getAnimations(selector.ruleset)[0];
+ const animation = createAnimationFromCSS(
+ `.test { animation-name: an; animation-timing-function: ease-in; }
+ @keyframes an {
+ from { animation-timing-function: linear; background-color: red; }
+ 50% { background-color: green; }
+ to { background-color: black; }
+ }`,
+ 'test'
+ );
+
TKUnit.assertEqual(animation.keyframes[0].curve, CoreTypes.AnimationCurve.linear);
TKUnit.assertEqual(animation.keyframes[1].curve, undefined);
TKUnit.assertEqual(animation.keyframes[1].curve, undefined);
diff --git a/apps/automated/src/ui/animation/test-page.css b/apps/automated/src/ui/animation/test-page.css
index 921e1ab52..2aaa1b034 100644
--- a/apps/automated/src/ui/animation/test-page.css
+++ b/apps/automated/src/ui/animation/test-page.css
@@ -1,4 +1,4 @@
-@keyframes test {
+@keyframes test-page-keyframes {
from {
background-color: red;
}
diff --git a/apps/automated/src/ui/layouts/safe-area-tests.ts b/apps/automated/src/ui/layouts/safe-area-tests.ts
index 9b990e55a..ffed6c663 100644
--- a/apps/automated/src/ui/layouts/safe-area-tests.ts
+++ b/apps/automated/src/ui/layouts/safe-area-tests.ts
@@ -70,10 +70,14 @@ export class SafeAreaTests extends testModule.UITest {
}
private layout_insets_top_action_bar_test(layout: view.View) {
- const app = UIApplication.sharedApplication;
- const statusBarHeight = round(dipToDp(app.statusBarFrame.size.height));
- const actionBarHeight = round(dipToDp(layout.page.actionBar.nativeViewProtected.frame.size.height));
- const topInset = statusBarHeight + actionBarHeight;
+ // const app = UIApplication.sharedApplication;
+ // const statusBarHeight = round(dipToDp(app.statusBarFrame.size.height));
+ // const actionBarHeight = round(dipToDp(layout.page.actionBar.nativeViewProtected.frame.size.height));
+ // const topInset = statusBarHeight + actionBarHeight;
+
+ const view: UIView = layout.page.actionBar.nativeViewProtected;
+ // use the action bar position and size instead of the status bar and action bar heights as those are unreliable on iOS 16+
+ const topInset = round(dipToDp(view.frame.origin.y + view.frame.size.height));
const insets = layout.getSafeAreaInsets();
equal(insets.top, topInset, `${layout}.topInset - actual:${insets.top}; expected: ${topInset}`);
@@ -81,8 +85,9 @@ export class SafeAreaTests extends testModule.UITest {
private layout_insets_top_action_bar_hidden_test(layout: view.View) {
const app = UIApplication.sharedApplication;
- const statusBarHeight = round(dipToDp(app.statusBarFrame.size.height));
- const topInset = statusBarHeight;
+ // const statusBarHeight = round(dipToDp(app.statusBarFrame.size.height));
+ // use window inset instead of status bar frame as that's unreliable on iOS 16+
+ const topInset = round(dipToDp(app.keyWindow.safeAreaInsets.top));
const insets = layout.getSafeAreaInsets();
equal(insets.top, topInset, `${layout}.topInset - actual:${insets.top}; expected: ${topInset}`);
diff --git a/apps/automated/src/ui/styling/style-properties-tests.ios.ts b/apps/automated/src/ui/styling/style-properties-tests.ios.ts
new file mode 100644
index 000000000..76d8aeabf
--- /dev/null
+++ b/apps/automated/src/ui/styling/style-properties-tests.ios.ts
@@ -0,0 +1,17 @@
+import * as TKUnit from '../../tk-unit';
+import * as helper from '../../ui-helper';
+import { Label } from '@nativescript/core';
+
+export function test_native_font_size_with_a11y_font_scale() {
+ const page = helper.getCurrentPage();
+ const testView = new Label();
+ const deviceFontScaleMock = 4.0;
+
+ page.content = testView;
+
+ testView.style._fontScale = deviceFontScaleMock;
+
+ const nativeFontSize = testView.nativeTextViewProtected.font.pointSize;
+ const expectedNativeFontSize = testView.style.fontInternal.fontSize * deviceFontScaleMock;
+ TKUnit.assertEqual(nativeFontSize, expectedNativeFontSize, 'View font size does not respect a11y font scaling');
+}
diff --git a/apps/automated/src/xhr/xhr-tests.ts b/apps/automated/src/xhr/xhr-tests.ts
index 138f02b70..b47a23e7f 100644
--- a/apps/automated/src/xhr/xhr-tests.ts
+++ b/apps/automated/src/xhr/xhr-tests.ts
@@ -76,7 +76,7 @@ export var test_XMLHttpRequest_readyStateShouldChange = function (done) {
//
};
- xhr.open('GET', 'https://httpbin.org/get');
+ xhr.open('GET', 'https://http-echo.nativescript.org/get');
xhr.send();
// ```
//
@@ -87,7 +87,7 @@ export var test_XMLHttpRequest_headersSentAndReceivedProperly = function (done)
// ### Send/receive headers
// ``` JavaScript
let xhr = new XMLHttpRequest();
- xhr.open('GET', 'https://httpbin.org/get');
+ xhr.open('GET', 'https://http-echo.nativescript.org/get');
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onreadystatechange = function () {
if (xhr.readyState > 1) {
@@ -112,7 +112,7 @@ export var test_XMLHttpRequest_contentSentAndReceivedProperly = function (done)
// ### Send/receive JSON
// ``` JavaScript
let xhr = new XMLHttpRequest();
- xhr.open('POST', 'https://httpbin.org/post');
+ xhr.open('POST', 'https://http-echo.nativescript.org/post');
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.responseType = 'json';
xhr.onreadystatechange = function () {
@@ -137,7 +137,7 @@ export var test_XMLHttpRequest_FormDataContentSentAndReceivedProperly = function
// ### Send/receive FormData
// ``` JavaScript
let xhr = new XMLHttpRequest();
- xhr.open('POST', 'https://httpbin.org/post');
+ xhr.open('POST', 'https://http-echo.nativescript.org/post');
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onreadystatechange = function () {
if (xhr.readyState > 3) {
@@ -169,7 +169,7 @@ export var test_XMLHttpRequest_abortShouldCancelonreadystatechange = function (d
// ### Abort request
// ``` JavaScript
let xhr = new XMLHttpRequest();
- xhr.open('POST', 'https://httpbin.org/post');
+ xhr.open('POST', 'https://http-echo.nativescript.org/post');
xhr.setRequestHeader('Content-Type', 'application/json');
//
xhr.onreadystatechange = function () {
@@ -186,7 +186,7 @@ export var test_XMLHttpRequest_abortShouldCancelonreadystatechange = function (d
export var test_XMLHttpRequest_requestShouldBePossibleAfterAbortedOpen = function (done) {
xhr = new XMLHttpRequest();
- xhr.open('POST', 'https://httpbin.org/post');
+ xhr.open('POST', 'https://http-echo.nativescript.org/post');
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.onreadystatechange = function () {
if (xhr.readyState > 3) {
@@ -207,7 +207,7 @@ export var test_XMLHttpRequest_requestShouldBePossibleAfterAbortedOpen = functio
export var test_XMLHttpRequest_requestShouldntBePossibleAfterAbortedSentRequest = function () {
xhr = new XMLHttpRequest();
- xhr.open('POST', 'https://httpbin.org/post');
+ xhr.open('POST', 'https://http-echo.nativescript.org/post');
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send(JSON.stringify({ MyVariableOne: 'ValueOne', MyVariableTwo: 'ValueTwo' }));
xhr.abort();
@@ -217,7 +217,7 @@ export var test_XMLHttpRequest_requestShouldntBePossibleAfterAbortedSentRequest
export function test_ignore_zero_length_request_body() {
let xhr = new XMLHttpRequest();
- xhr.open('GET', 'https://httpbin.org/get');
+ xhr.open('GET', 'https://http-echo.nativescript.org/get');
xhr.send('');
}
@@ -227,7 +227,7 @@ export function test_raises_onload_Event(done) {
xhr.onload = () => {
done(null);
};
- xhr.open('GET', 'https://httpbin.org/get');
+ xhr.open('GET', 'https://http-echo.nativescript.org/get');
xhr.send();
}
@@ -356,7 +356,7 @@ export function test_sets_status_and_statusText(done) {
}
}
};
- xhr.open('GET', 'https://httpbin.org/get');
+ xhr.open('GET', 'https://http-echo.nativescript.org/get');
xhr.send();
}
@@ -365,7 +365,7 @@ export function test_raises_onerror_Event(done) {
xhr.onerror = () => {
done(null);
};
- xhr.open('GET', 'https://no-such-domain-httpbin.org');
+ xhr.open('GET', 'https://no-such-domain.nativescript.org');
xhr.send();
}
@@ -405,15 +405,15 @@ export var test_XMLHttpRequest_contentReceivedArrayBufferProperly = function (do
// ### Receive Blob
// ``` JavaScript
let xhr = new XMLHttpRequest();
- xhr.open('GET', 'https://httpbin.org/image/jpeg');
+ xhr.open('GET', 'https://http-echo.nativescript.org/image/jpeg');
xhr.responseType = 'arraybuffer';
xhr.onreadystatechange = function () {
if (xhr.readyState > 3) {
//
try {
- TKUnit.assertEqual(xhr.getResponseHeader('Content-Length'), '35588');
+ TKUnit.assertEqual(xhr.getResponseHeader('Content-Length'), '7911');
TKUnit.assertEqual(xhr.getResponseHeader('Content-Type'), 'image/jpeg');
- TKUnit.assertEqual((xhr.response as ArrayBuffer).byteLength, 35588);
+ TKUnit.assertEqual((xhr.response as ArrayBuffer).byteLength, 7911);
done(null);
} catch (err) {
done(err);
@@ -431,15 +431,15 @@ export var test_XMLHttpRequest_contentReceivedBlobProperly = function (done) {
// ### Receive Blob
// ``` JavaScript
let xhr = new XMLHttpRequest();
- xhr.open('GET', 'https://httpbin.org/image/jpeg');
+ xhr.open('GET', 'https://http-echo.nativescript.org/image/jpeg');
xhr.responseType = 'blob';
xhr.onreadystatechange = function () {
if (xhr.readyState > 3) {
//
try {
- TKUnit.assertEqual(xhr.getResponseHeader('Content-Length'), '35588');
+ TKUnit.assertEqual(xhr.getResponseHeader('Content-Length'), '7911');
TKUnit.assertEqual(xhr.getResponseHeader('Content-Type'), 'image/jpeg');
- TKUnit.assertEqual((xhr.response as Blob).size, 35588);
+ TKUnit.assertEqual((xhr.response as Blob).size, 7911);
TKUnit.assertEqual((xhr.response as Blob).type, 'image/jpeg');
done(null);
} catch (err) {
diff --git a/apps/automated/src/xml-declaration/xml-declaration-tests.ts b/apps/automated/src/xml-declaration/xml-declaration-tests.ts
index a2a623ea4..e25ba2819 100644
--- a/apps/automated/src/xml-declaration/xml-declaration-tests.ts
+++ b/apps/automated/src/xml-declaration/xml-declaration-tests.ts
@@ -130,7 +130,7 @@ export function test_loadWithAttributes() {
}
export function test_parse_ShouldNotCrashWithoutExports() {
- const xml = (global).loadModule('xml-declaration/mainPage.xml', true);
+ const xml = global.loadModule('xml-declaration/mainPage.xml', true);
var v: View = Builder.parse(xml);
TKUnit.assert(v instanceof View, 'Expected result: View; Actual result: ' + v + ';');
@@ -826,7 +826,7 @@ export function test_NonExistingElementInTemplateError() {
}
export function test_EventInTemplate() {
- var pageCode = (global).loadModule('xml-declaration/template-builder-tests/event-in-template', true);
+ var pageCode = global.loadModule('xml-declaration/template-builder-tests/event-in-template', true);
var notified = false;
pageCode.test = (args) => {
notified = true;
@@ -849,7 +849,7 @@ export function test_EventInTemplate() {
}
export function test_EventInCodelessFragment() {
- var pageCode = (global).loadModule('./xml-declaration/template-builder-tests/event-in-codeless-fragment', true);
+ var pageCode = global.loadModule('./xml-declaration/template-builder-tests/event-in-codeless-fragment', true);
var notified = false;
pageCode.setCallback((args) => {
diff --git a/apps/toolbox/src/main-page.xml b/apps/toolbox/src/main-page.xml
index 5f8c600f1..45d5f51a3 100644
--- a/apps/toolbox/src/main-page.xml
+++ b/apps/toolbox/src/main-page.xml
@@ -10,6 +10,7 @@
+
diff --git a/apps/toolbox/src/main.ts b/apps/toolbox/src/main.ts
index fba0a27ac..a4c5c529a 100644
--- a/apps/toolbox/src/main.ts
+++ b/apps/toolbox/src/main.ts
@@ -1,3 +1,3 @@
-import { Application, Utils } from '@nativescript/core';
+import { Application } from '@nativescript/core';
Application.run({ moduleName: 'app-root' });
diff --git a/apps/toolbox/src/pages/a11y.xml b/apps/toolbox/src/pages/a11y.xml
index d8c62cb36..1e65f3070 100644
--- a/apps/toolbox/src/pages/a11y.xml
+++ b/apps/toolbox/src/pages/a11y.xml
@@ -25,10 +25,10 @@
-
+
-
+
diff --git a/apps/toolbox/src/pages/dialogs.ts b/apps/toolbox/src/pages/dialogs.ts
new file mode 100644
index 000000000..eae02f2bd
--- /dev/null
+++ b/apps/toolbox/src/pages/dialogs.ts
@@ -0,0 +1,37 @@
+import { Page, Observable, EventData, Dialogs } from '@nativescript/core';
+
+let page: Page;
+
+export function navigatingTo(args: EventData) {
+ page = args.object;
+ page.bindingContext = new SampleData();
+}
+
+export class SampleData extends Observable {
+ dialogAlert() {
+ Dialogs.alert('Hello');
+ }
+ dialogAlertWithOptions() {
+ Dialogs.alert({
+ title: 'Hello',
+ message: 'Oh hi!',
+ okButtonText: 'Nice',
+ });
+ }
+ dialogConfirm() {
+ Dialogs.confirm('Is it?').then((ok) => {
+ Dialogs.alert('Ok then!');
+ });
+ }
+
+ dialogLogin() {
+ Dialogs.login('Login').then((result) => {
+ console.log(result);
+ });
+ }
+ dialogAction() {
+ Dialogs.action('Actions', 'Cancel', ['Test', 'Testing']).then((result) => {
+ console.log(result);
+ });
+ }
+}
diff --git a/apps/toolbox/src/pages/dialogs.xml b/apps/toolbox/src/pages/dialogs.xml
new file mode 100644
index 000000000..fb0977658
--- /dev/null
+++ b/apps/toolbox/src/pages/dialogs.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/toolbox/src/pages/labels.xml b/apps/toolbox/src/pages/labels.xml
index a94207cab..36c996636 100644
--- a/apps/toolbox/src/pages/labels.xml
+++ b/apps/toolbox/src/pages/labels.xml
@@ -5,7 +5,16 @@
-
+
+
+
+
+
+
+
+
+
+