diff --git a/.gitignore b/.gitignore
index 279bb0b08..dbbd6a8a3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,6 +48,8 @@ tscommand*.tmp.txt
# Other
*.js
+# https://github.com/NativeScript/nativescript-dev-webpack/issues/932
+!tns-core-modules/xml/xml.js
!tests/hooks/**/*.*
!gruntfile.js
!js-libs/**/*.*
diff --git a/.vscode/launch.json b/.vscode/launch.json
index cec715adc..38041cb91 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -1,4 +1,7 @@
{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
@@ -6,7 +9,12 @@
"request": "launch",
"name": "Unit Tests",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
- "args": [ "--timeout", "999999", "--opts", "unit-tests/mocha.opts" ],
+ "args": [
+ "--timeout",
+ "999999",
+ "--opts",
+ "unit-tests/mocha.opts"
+ ],
"internalConsoleOptions": "openOnSessionStart",
"preLaunchTask": "tsc-unit-tests"
},
@@ -19,6 +27,20 @@
"sourceMaps": true,
"watch": true
},
+ // {
+ // "name": "Test on iOS",
+ // "type": "nativescript",
+ // "request": "launch",
+ // "platform": "ios",
+ // "appRoot": "${workspaceRoot}",
+ // "sourceMaps": true,
+ // "watch": false,
+ // "stopOnEntry": true,
+ // "launchTests": true,
+ // "tnsArgs": [
+ // "--justlaunch"
+ // ]
+ // },
{
"name": "Attach on iOS",
"type": "nativescript",
@@ -37,6 +59,30 @@
"sourceMaps": true,
"watch": true
},
+ {
+ "name": "Debug tests on Android",
+ "type": "nativescript",
+ "request": "launch",
+ "platform": "android",
+ "appRoot": "${workspaceRoot}/tests",
+ "sourceMaps": true,
+ "stopOnEntry": true,
+ "watch": true,
+ },
+ // {
+ // "name": "Test on Android",
+ // "type": "nativescript",
+ // "request": "launch",
+ // "platform": "android",
+ // "appRoot": "${workspaceRoot}",
+ // "sourceMaps": true,
+ // "watch": false,
+ // "stopOnEntry": true,
+ // "launchTests": true,
+ // "tnsArgs": [
+ // "--justlaunch"
+ // ]
+ // },
{
"name": "Attach on Android",
"type": "nativescript",
@@ -47,4 +93,4 @@
"watch": false
}
]
-}
\ No newline at end of file
+}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index aaa838386..922edf6ca 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,12 @@
+## [5.4.3](https://github.com/NativeScript/NativeScript/compare/5.4.2...5.4.3) (2019-06-21)
+
+
+### Bug Fixes
+
+* clear the `resolvedPage` when entry is being cleared, change the passed `View` to be a weak reference ([#7327](https://github.com/NativeScript/NativeScript/issues/7327)) ([dfe7621](https://github.com/NativeScript/NativeScript/commit/dfe7621))
+
+
+
## [5.4.2](https://github.com/NativeScript/NativeScript/compare/5.4.1...5.4.2) (2019-06-06)
diff --git a/DevelopmentWorkflow.md b/DevelopmentWorkflow.md
index 9ae5adf61..b54e0e8da 100644
--- a/DevelopmentWorkflow.md
+++ b/DevelopmentWorkflow.md
@@ -42,12 +42,7 @@ Install devDependencies:
npm install
```
-Run `setup` script. This will [`npm link`](https://docs.npmjs.com/cli/link) the `tns-core-modules` and `tns-core-modules-declarations` dependencies inside the `tests` and `apps` projects.
-
-```bash
-npm run setup
-```
-
+
## Running Unit Tests
-The test app is an ordinary NativeScript app that logs the test results as it go.
-After the [initial setup](#initial-setup) you can run the tests with:
-
-```bash
-# Make sure TypeScript is transpiled
-tsc
-
-# Run the tests app
-tns run ios --path tests
-tns run android --path tests
+```
+cd ./tests
+tns run android| ios
```
## Running the Test App
diff --git a/WritingUnitTests.md b/WritingUnitTests.md
index a6945bc1c..38fa35ca4 100644
--- a/WritingUnitTests.md
+++ b/WritingUnitTests.md
@@ -59,7 +59,7 @@ A test will fail if assert is not satisfied or if an error is thrown during exec
There is a large set of asserting functions available in the [`tests/app/TKUnit.ts`](tests/app/TKUnit.ts) module. We recommend using those in your tests.
```typescript
-import * as TKUnit from "../TKUnit";
+import * as TKUnit from "../tk-unit";
export function testSomethingWorksFast() {
let arr = [1, 2, 3];
diff --git a/apps/app/App_Resources/Android/app.gradle b/apps/app/App_Resources/Android/app.gradle
index 3a25fb4f7..bb4842141 100644
--- a/apps/app/App_Resources/Android/app.gradle
+++ b/apps/app/App_Resources/Android/app.gradle
@@ -2,16 +2,19 @@
// Uncomment to add recyclerview-v7 dependency
//dependencies {
-// compile 'com.android.support:recyclerview-v7:+'
+// implementation 'com.android.support:recyclerview-v7:+'
//}
-android {
- defaultConfig {
+// If you want to add something to be applied before applying plugins' include.gradle files
+// e.g. project.ext.googlePlayServicesVersion = "15.0.1"
+// create a file named before-plugins.gradle in the current directory and place it there
+
+android {
+ defaultConfig {
+ minSdkVersion 17
generatedDensities = []
- applicationId = "org.nativescript.apps"
- }
- aaptOptions {
- additionalParameters "--no-version-vectors"
- }
-}
-project.ext.useAndroidX=true
\ No newline at end of file
+ }
+ aaptOptions {
+ additionalParameters "--no-version-vectors"
+ }
+}
diff --git a/apps/app/App_Resources/Android/drawable-ldpi/icon.png b/apps/app/App_Resources/Android/drawable-ldpi/icon.png
deleted file mode 100644
index ddfc17a71..000000000
Binary files a/apps/app/App_Resources/Android/drawable-ldpi/icon.png and /dev/null differ
diff --git a/apps/app/App_Resources/Android/drawable-mdpi/icon.png b/apps/app/App_Resources/Android/drawable-mdpi/icon.png
deleted file mode 100644
index 486e41091..000000000
Binary files a/apps/app/App_Resources/Android/drawable-mdpi/icon.png and /dev/null differ
diff --git a/apps/app/App_Resources/Android/src/main/AndroidManifest.xml b/apps/app/App_Resources/Android/src/main/AndroidManifest.xml
new file mode 100644
index 000000000..1bd6826c3
--- /dev/null
+++ b/apps/app/App_Resources/Android/src/main/AndroidManifest.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png b/apps/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png
new file mode 100644
index 000000000..eb381c258
Binary files /dev/null and b/apps/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png differ
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png b/apps/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png
new file mode 100644
index 000000000..9cde84cd5
Binary files /dev/null and b/apps/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png differ
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png b/apps/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png
new file mode 100644
index 000000000..5218f4c90
Binary files /dev/null and b/apps/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png differ
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png b/apps/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png
new file mode 100644
index 000000000..748b2adf5
Binary files /dev/null and b/apps/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png differ
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png b/apps/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png
new file mode 100644
index 000000000..4d6a674b3
Binary files /dev/null and b/apps/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png differ
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png b/apps/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png
new file mode 100644
index 000000000..b9e102a76
Binary files /dev/null and b/apps/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png differ
diff --git a/apps/app/App_Resources/Android/drawable-mdpi/add_to_fav.png b/apps/app/App_Resources/Android/src/main/res/drawable-mdpi/add_to_fav.png
similarity index 100%
rename from apps/app/App_Resources/Android/drawable-mdpi/add_to_fav.png
rename to apps/app/App_Resources/Android/src/main/res/drawable-mdpi/add_to_fav.png
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png b/apps/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png
new file mode 100644
index 000000000..efeaf2907
Binary files /dev/null and b/apps/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png differ
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png b/apps/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png
new file mode 100644
index 000000000..92ccc85a6
Binary files /dev/null and b/apps/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png differ
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png b/apps/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png
new file mode 100644
index 000000000..626338766
Binary files /dev/null and b/apps/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png differ
diff --git a/apps/app/App_Resources/Android/drawable-nodpi/i18x32.png b/apps/app/App_Resources/Android/src/main/res/drawable-nodpi/i18x32.png
similarity index 100%
rename from apps/app/App_Resources/Android/drawable-nodpi/i18x32.png
rename to apps/app/App_Resources/Android/src/main/res/drawable-nodpi/i18x32.png
diff --git a/apps/app/App_Resources/Android/drawable-nodpi/i32x18.png b/apps/app/App_Resources/Android/src/main/res/drawable-nodpi/i32x18.png
similarity index 100%
rename from apps/app/App_Resources/Android/drawable-nodpi/i32x18.png
rename to apps/app/App_Resources/Android/src/main/res/drawable-nodpi/i32x18.png
diff --git a/apps/app/App_Resources/Android/drawable-nodpi/i32x32.png b/apps/app/App_Resources/Android/src/main/res/drawable-nodpi/i32x32.png
similarity index 100%
rename from apps/app/App_Resources/Android/drawable-nodpi/i32x32.png
rename to apps/app/App_Resources/Android/src/main/res/drawable-nodpi/i32x32.png
diff --git a/apps/app/App_Resources/Android/drawable-hdpi/icon.png b/apps/app/App_Resources/Android/src/main/res/drawable-nodpi/icon.png
similarity index 100%
rename from apps/app/App_Resources/Android/drawable-hdpi/icon.png
rename to apps/app/App_Resources/Android/src/main/res/drawable-nodpi/icon.png
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml b/apps/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml
new file mode 100644
index 000000000..ada77f92c
--- /dev/null
+++ b/apps/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml
@@ -0,0 +1,8 @@
+
+ -
+
+
+ -
+
+
+
\ No newline at end of file
diff --git a/apps/app/App_Resources/Android/drawable-nodpi/splashscreen.9.png b/apps/app/App_Resources/Android/src/main/res/drawable-nodpi/splashscreen.9.png
similarity index 100%
rename from apps/app/App_Resources/Android/drawable-nodpi/splashscreen.9.png
rename to apps/app/App_Resources/Android/src/main/res/drawable-nodpi/splashscreen.9.png
diff --git a/apps/app/App_Resources/Android/drawable-nodpi/testlogo.jpg b/apps/app/App_Resources/Android/src/main/res/drawable-nodpi/testlogo.jpg
similarity index 100%
rename from apps/app/App_Resources/Android/drawable-nodpi/testlogo.jpg
rename to apps/app/App_Resources/Android/src/main/res/drawable-nodpi/testlogo.jpg
diff --git a/apps/app/App_Resources/Android/drawable-nodpi/tile.png b/apps/app/App_Resources/Android/src/main/res/drawable-nodpi/tile.png
similarity index 100%
rename from apps/app/App_Resources/Android/drawable-nodpi/tile.png
rename to apps/app/App_Resources/Android/src/main/res/drawable-nodpi/tile.png
diff --git a/apps/app/App_Resources/Android/drawable-nodpi/up.png b/apps/app/App_Resources/Android/src/main/res/drawable-nodpi/up.png
similarity index 100%
rename from apps/app/App_Resources/Android/drawable-nodpi/up.png
rename to apps/app/App_Resources/Android/src/main/res/drawable-nodpi/up.png
diff --git a/apps/app/App_Resources/Android/drawable-nodpi/upccw.png b/apps/app/App_Resources/Android/src/main/res/drawable-nodpi/upccw.png
similarity index 100%
rename from apps/app/App_Resources/Android/drawable-nodpi/upccw.png
rename to apps/app/App_Resources/Android/src/main/res/drawable-nodpi/upccw.png
diff --git a/apps/app/App_Resources/Android/drawable-nodpi/upcw.png b/apps/app/App_Resources/Android/src/main/res/drawable-nodpi/upcw.png
similarity index 100%
rename from apps/app/App_Resources/Android/drawable-nodpi/upcw.png
rename to apps/app/App_Resources/Android/src/main/res/drawable-nodpi/upcw.png
diff --git a/apps/app/App_Resources/Android/drawable-nodpi/upflip.png b/apps/app/App_Resources/Android/src/main/res/drawable-nodpi/upflip.png
similarity index 100%
rename from apps/app/App_Resources/Android/drawable-nodpi/upflip.png
rename to apps/app/App_Resources/Android/src/main/res/drawable-nodpi/upflip.png
diff --git a/apps/app/App_Resources/Android/drawable-xhdpi/add_to_fav.png b/apps/app/App_Resources/Android/src/main/res/drawable-xhdpi/add_to_fav.png
similarity index 100%
rename from apps/app/App_Resources/Android/drawable-xhdpi/add_to_fav.png
rename to apps/app/App_Resources/Android/src/main/res/drawable-xhdpi/add_to_fav.png
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png b/apps/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png
new file mode 100644
index 000000000..612bbd072
Binary files /dev/null and b/apps/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png differ
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png b/apps/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png
new file mode 100644
index 000000000..8bcde6277
Binary files /dev/null and b/apps/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png differ
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png b/apps/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png
new file mode 100644
index 000000000..ad8ee2f4b
Binary files /dev/null and b/apps/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png differ
diff --git a/apps/app/App_Resources/Android/drawable-xxhdpi/add_to_fav.png b/apps/app/App_Resources/Android/src/main/res/drawable-xxhdpi/add_to_fav.png
similarity index 100%
rename from apps/app/App_Resources/Android/drawable-xxhdpi/add_to_fav.png
rename to apps/app/App_Resources/Android/src/main/res/drawable-xxhdpi/add_to_fav.png
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png b/apps/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png
new file mode 100644
index 000000000..0fa88e235
Binary files /dev/null and b/apps/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png differ
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png b/apps/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png
new file mode 100644
index 000000000..9d81c85dc
Binary files /dev/null and b/apps/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png differ
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png b/apps/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png
new file mode 100644
index 000000000..668327832
Binary files /dev/null and b/apps/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png differ
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png b/apps/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png
new file mode 100644
index 000000000..c650f6438
Binary files /dev/null and b/apps/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png differ
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png b/apps/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png
new file mode 100644
index 000000000..9a34d0d43
Binary files /dev/null and b/apps/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png differ
diff --git a/apps/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png b/apps/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png
new file mode 100644
index 000000000..fa6331c8d
Binary files /dev/null and b/apps/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png differ
diff --git a/apps/app/App_Resources/Android/src/main/res/values-v21/colors.xml b/apps/app/App_Resources/Android/src/main/res/values-v21/colors.xml
new file mode 100644
index 000000000..a64641a9d
--- /dev/null
+++ b/apps/app/App_Resources/Android/src/main/res/values-v21/colors.xml
@@ -0,0 +1,4 @@
+
+
+ #3d5afe
+
\ No newline at end of file
diff --git a/apps/app/App_Resources/Android/src/main/res/values-v21/styles.xml b/apps/app/App_Resources/Android/src/main/res/values-v21/styles.xml
new file mode 100644
index 000000000..dac8727c8
--- /dev/null
+++ b/apps/app/App_Resources/Android/src/main/res/values-v21/styles.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/apps/app/App_Resources/Android/src/main/res/values/colors.xml b/apps/app/App_Resources/Android/src/main/res/values/colors.xml
new file mode 100644
index 000000000..74ad8829c
--- /dev/null
+++ b/apps/app/App_Resources/Android/src/main/res/values/colors.xml
@@ -0,0 +1,7 @@
+
+
+ #F5F5F5
+ #757575
+ #33B5E5
+ #272734
+
\ No newline at end of file
diff --git a/apps/app/App_Resources/Android/src/main/res/values/styles.xml b/apps/app/App_Resources/Android/src/main/res/values/styles.xml
new file mode 100644
index 000000000..c793e6d4c
--- /dev/null
+++ b/apps/app/App_Resources/Android/src/main/res/values/styles.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json
index 5f5359340..1a8b0e645 100644
--- a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json
+++ b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -1,5 +1,17 @@
{
"images" : [
+ {
+ "size" : "20x20",
+ "idiom" : "iphone",
+ "filename" : "icon-20@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "iphone",
+ "filename" : "icon-20@3x.png",
+ "scale" : "3x"
+ },
{
"size" : "29x29",
"idiom" : "iphone",
@@ -30,18 +42,6 @@
"filename" : "icon-40@3x.png",
"scale" : "3x"
},
- {
- "size" : "57x57",
- "idiom" : "iphone",
- "filename" : "icon-57.png",
- "scale" : "1x"
- },
- {
- "size" : "57x57",
- "idiom" : "iphone",
- "filename" : "icon-57@2x.png",
- "scale" : "2x"
- },
{
"size" : "60x60",
"idiom" : "iphone",
@@ -54,6 +54,18 @@
"filename" : "icon-60@3x.png",
"scale" : "3x"
},
+ {
+ "size" : "20x20",
+ "idiom" : "ipad",
+ "filename" : "icon-20.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "ipad",
+ "filename" : "icon-20@2x.png",
+ "scale" : "2x"
+ },
{
"size" : "29x29",
"idiom" : "ipad",
@@ -78,30 +90,6 @@
"filename" : "icon-40@2x.png",
"scale" : "2x"
},
- {
- "size" : "50x50",
- "idiom" : "ipad",
- "filename" : "icon-50.png",
- "scale" : "1x"
- },
- {
- "size" : "50x50",
- "idiom" : "ipad",
- "filename" : "icon-50@2x.png",
- "scale" : "2x"
- },
- {
- "size" : "72x72",
- "idiom" : "ipad",
- "filename" : "icon-72.png",
- "scale" : "1x"
- },
- {
- "size" : "72x72",
- "idiom" : "ipad",
- "filename" : "icon-72@2x.png",
- "scale" : "2x"
- },
{
"size" : "76x76",
"idiom" : "ipad",
@@ -119,6 +107,12 @@
"idiom" : "ipad",
"filename" : "icon-83.5@2x.png",
"scale" : "2x"
+ },
+ {
+ "size" : "1024x1024",
+ "idiom" : "ios-marketing",
+ "filename" : "icon-1024.png",
+ "scale" : "1x"
}
],
"info" : {
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png
new file mode 100644
index 000000000..a1d7eb479
Binary files /dev/null and b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png
new file mode 100644
index 000000000..5797bdef4
Binary files /dev/null and b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png
new file mode 100644
index 000000000..a0bc5691b
Binary files /dev/null and b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png
new file mode 100644
index 000000000..851ac65fb
Binary files /dev/null and b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png
index 9e15af09d..bb9b9e86d 100644
Binary files a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png and b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png
index 7b9e55537..ec609dcf3 100644
Binary files a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png and b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png
index 76f61ec1f..a97180800 100644
Binary files a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png and b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png
index 15b06db11..214800ee6 100644
Binary files a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png and b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png
index 585065f94..8554b88a8 100644
Binary files a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png and b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png
index a450c421d..a22626bae 100644
Binary files a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png and b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png
deleted file mode 100644
index 4a62478f9..000000000
Binary files a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50.png and /dev/null differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png
deleted file mode 100644
index 01ff7c16c..000000000
Binary files a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-50@2x.png and /dev/null differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png
deleted file mode 100644
index beea81999..000000000
Binary files a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57.png and /dev/null differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png
deleted file mode 100644
index c3dc7b035..000000000
Binary files a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-57@2x.png and /dev/null differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png
index 457b6d94c..a22626bae 100644
Binary files a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png and b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png
index fa5a6ac86..492c9c8e8 100644
Binary files a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png and b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png
deleted file mode 100644
index 556bdd688..000000000
Binary files a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72.png and /dev/null differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png
deleted file mode 100644
index 4f69cb25b..000000000
Binary files a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-72@2x.png and /dev/null differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png
index 94abcf70d..9208113cf 100644
Binary files a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png and b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png
index 2e71dd3a0..24415e5a3 100644
Binary files a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png and b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png
index 4abc9ec50..b3ef1bf0c 100644
Binary files a/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png and b/apps/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json b/apps/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json
index 11bfcf55c..bb3b4a5f6 100644
--- a/apps/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json
+++ b/apps/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json
@@ -1,5 +1,41 @@
{
"images" : [
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "2688h",
+ "filename" : "Default-Portrait-XS-Max.png",
+ "minimum-system-version" : "12.0",
+ "orientation" : "portrait",
+ "scale" : "3x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "2688h",
+ "filename" : "Default-Landscape-XS-Max.png",
+ "minimum-system-version" : "12.0",
+ "orientation" : "landscape",
+ "scale" : "3x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "1792h",
+ "filename" : "Default-Portrait-XR.png",
+ "minimum-system-version" : "12.0",
+ "orientation" : "portrait",
+ "scale" : "2x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "1792h",
+ "filename" : "Default-Landscape-XR.png",
+ "minimum-system-version" : "12.0",
+ "orientation" : "landscape",
+ "scale" : "2x"
+ },
{
"extent" : "full-screen",
"idiom" : "iphone",
@@ -10,12 +46,12 @@
"scale" : "3x"
},
{
- "orientation" : "landscape",
- "idiom" : "iphone",
"extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "2436h",
"filename" : "Default-Landscape-X.png",
"minimum-system-version" : "11.0",
- "subtype" : "2436h",
+ "orientation" : "landscape",
"scale" : "3x"
},
{
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XR.png b/apps/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XR.png
new file mode 100644
index 000000000..686fda12d
Binary files /dev/null and b/apps/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XR.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XS-Max.png b/apps/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XS-Max.png
new file mode 100644
index 000000000..415e9c861
Binary files /dev/null and b/apps/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XS-Max.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XR.png b/apps/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XR.png
new file mode 100644
index 000000000..b66a4f2d5
Binary files /dev/null and b/apps/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XR.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XS-Max.png b/apps/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XS-Max.png
new file mode 100644
index 000000000..e34463dd1
Binary files /dev/null and b/apps/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XS-Max.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json b/apps/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json
index 4f4e9c506..ab5edd0ca 100644
--- a/apps/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json
+++ b/apps/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json
@@ -12,6 +12,7 @@
},
{
"idiom" : "universal",
+ "filename" : "LaunchScreen-AspectFill@3x.png",
"scale" : "3x"
}
],
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@3x.png b/apps/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@3x.png
new file mode 100644
index 000000000..a954cc8f4
Binary files /dev/null and b/apps/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@3x.png differ
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json b/apps/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json
index 23c0ffd7a..444d7152d 100644
--- a/apps/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json
+++ b/apps/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json
@@ -12,6 +12,7 @@
},
{
"idiom" : "universal",
+ "filename" : "LaunchScreen-Center@3x.png",
"scale" : "3x"
}
],
diff --git a/apps/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@3x.png b/apps/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@3x.png
new file mode 100644
index 000000000..b2973b025
Binary files /dev/null and b/apps/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@3x.png differ
diff --git a/apps/app/App_Resources/iOS/Info.plist b/apps/app/App_Resources/iOS/Info.plist
index 383801fef..ea3e3ea23 100644
--- a/apps/app/App_Resources/iOS/Info.plist
+++ b/apps/app/App_Resources/iOS/Info.plist
@@ -43,10 +43,5 @@
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
- NSAppTransportSecurity
-
- NSAllowsArbitraryLoads
-
-
diff --git a/apps/app/App_Resources/iOS/LaunchScreen.storyboard b/apps/app/App_Resources/iOS/LaunchScreen.storyboard
index 2ad9471e1..c4e5a3f39 100644
--- a/apps/app/App_Resources/iOS/LaunchScreen.storyboard
+++ b/apps/app/App_Resources/iOS/LaunchScreen.storyboard
@@ -1,8 +1,12 @@
-
-
+
+
+
+
+
-
+
+
@@ -14,36 +18,36 @@
-
+
-
+
-
+
-
+
-
+
+
-
+
+
-
+
-
-
-
+
-
+
diff --git a/apps/app/App_Resources/iOS/build.xcconfig b/apps/app/App_Resources/iOS/build.xcconfig
index 056205556..9d738435d 100644
--- a/apps/app/App_Resources/iOS/build.xcconfig
+++ b/apps/app/App_Resources/iOS/build.xcconfig
@@ -1,5 +1,7 @@
// You can add custom settings here
// for example you can uncomment the following line to force distribution code signing
// CODE_SIGN_IDENTITY = iPhone Distribution
+// To build for device with XCode 8 you need to specify your development team. More info: https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html
+// DEVELOPMENT_TEAM = YOUR_TEAM_ID;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
diff --git a/apps/app/app.css b/apps/app/app.css
new file mode 100644
index 000000000..1ff4cdc5a
--- /dev/null
+++ b/apps/app/app.css
@@ -0,0 +1 @@
+/* Just here to avoid startup warnings */
diff --git a/apps/app/cuteness.io/app.ts b/apps/app/cuteness.io/app.ts
deleted file mode 100644
index 94deae337..000000000
--- a/apps/app/cuteness.io/app.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import * as application from "tns-core-modules/application";
-
-// Start the application
-application.start({ moduleName: "cuteness.io/main-page" });
\ No newline at end of file
diff --git a/apps/app/perf-app/app-root.xml b/apps/app/perf-app/app-root.xml
new file mode 100644
index 000000000..297f7a921
--- /dev/null
+++ b/apps/app/perf-app/app-root.xml
@@ -0,0 +1 @@
+
diff --git a/apps/app/perf-app/app.ts b/apps/app/perf-app/app.ts
index b3250bf2d..32b7e7fa8 100644
--- a/apps/app/perf-app/app.ts
+++ b/apps/app/perf-app/app.ts
@@ -1,3 +1,3 @@
import * as application from "tns-core-modules/application";
-application.start({ moduleName: "perf-app/main-page" });
+application.run({ moduleName: "perf-app/app-root" });
diff --git a/apps/app/perf-app/main-page.ts b/apps/app/perf-app/main-page.ts
index 02e329997..0c75aeaa8 100644
--- a/apps/app/perf-app/main-page.ts
+++ b/apps/app/perf-app/main-page.ts
@@ -9,7 +9,7 @@ import * as frame from "tns-core-modules/ui/frame";
export function pageLoaded(args: EventData) {
let page = args.object;
- let view = require("ui/core/view");
+ let view = require("tns-core-modules/ui/core/view");
let wrapLayout = view.getViewById(page, "wrapLayoutWithExamples");
diff --git a/apps/app/perf-app/main-page.xml b/apps/app/perf-app/main-page.xml
index 33306f0d0..79cc23991 100644
--- a/apps/app/perf-app/main-page.xml
+++ b/apps/app/perf-app/main-page.xml
@@ -3,4 +3,4 @@
-
\ No newline at end of file
+
diff --git a/apps/app/ui-tests-app/action-bar/background-css.css b/apps/app/ui-tests-app/action-bar/background-css.css
deleted file mode 100644
index adba23489..000000000
--- a/apps/app/ui-tests-app/action-bar/background-css.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.action {
- background-color: red;
-}
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/action-bar/background-css.ts b/apps/app/ui-tests-app/action-bar/background-css.ts
deleted file mode 100644
index 1ce73c5b0..000000000
--- a/apps/app/ui-tests-app/action-bar/background-css.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import * as frame from "tns-core-modules/ui/frame";
-
-export function navigate(args) {
- frame.topmost().navigate("ui-tests-app/action-bar/clean");
-}
diff --git a/apps/app/ui-tests-app/action-bar/background.ts b/apps/app/ui-tests-app/action-bar/background.ts
deleted file mode 100644
index 1ce73c5b0..000000000
--- a/apps/app/ui-tests-app/action-bar/background.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import * as frame from "tns-core-modules/ui/frame";
-
-export function navigate(args) {
- frame.topmost().navigate("ui-tests-app/action-bar/clean");
-}
diff --git a/apps/app/ui-tests-app/action-bar/color.ts b/apps/app/ui-tests-app/action-bar/color.ts
deleted file mode 100644
index 1ce73c5b0..000000000
--- a/apps/app/ui-tests-app/action-bar/color.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import * as frame from "tns-core-modules/ui/frame";
-
-export function navigate(args) {
- frame.topmost().navigate("ui-tests-app/action-bar/clean");
-}
diff --git a/apps/app/ui-tests-app/action-bar/system-icons.ts b/apps/app/ui-tests-app/action-bar/system-icons.ts
deleted file mode 100644
index 1ce73c5b0..000000000
--- a/apps/app/ui-tests-app/action-bar/system-icons.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import * as frame from "tns-core-modules/ui/frame";
-
-export function navigate(args) {
- frame.topmost().navigate("ui-tests-app/action-bar/clean");
-}
diff --git a/apps/app/ui-tests-app/action-bar/transparent-bg-css.ts b/apps/app/ui-tests-app/action-bar/transparent-bg-css.ts
deleted file mode 100644
index c8fb3335c..000000000
--- a/apps/app/ui-tests-app/action-bar/transparent-bg-css.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import frame = require("tns-core-modules/ui/frame");
-
-export function navigate(args) {
- frame.topmost().navigate("ui-tests-app/action-bar/clean");
-}
diff --git a/apps/app/ui-tests-app/app-root.xml b/apps/app/ui-tests-app/app-root.xml
deleted file mode 100644
index 2ac627182..000000000
--- a/apps/app/ui-tests-app/app-root.xml
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/bottom-navigation/bottom-navigation.ts b/apps/app/ui-tests-app/bottom-navigation/bottom-navigation.ts
deleted file mode 100644
index 85a232b6b..000000000
--- a/apps/app/ui-tests-app/bottom-navigation/bottom-navigation.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { EventData } from "tns-core-modules/data/observable";
-import { SubMainPageViewModel } from "../sub-main-page-view-model";
-import { WrapLayout } from "tns-core-modules/ui/layouts/wrap-layout";
-import { Page } from "tns-core-modules/ui/page";
-import { BottomNavigation } from "tns-core-modules/ui/bottom-navigation";
-
-export function goToFirst(args: EventData) {
- const page = (args.object).page;
- const bottomNav = page.getViewById("bottomNav");
-
- bottomNav.selectedIndex = 0;
-}
-
-export function goToSecond(args: EventData) {
- const page = (args.object).page;
- const bottomNav = page.getViewById("bottomNav");
-
- bottomNav.selectedIndex = 1;
-}
diff --git a/apps/app/ui-tests-app/bottom-navigation/color.xml b/apps/app/ui-tests-app/bottom-navigation/color.xml
deleted file mode 100644
index b174dcfba..000000000
--- a/apps/app/ui-tests-app/bottom-navigation/color.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/bottom-navigation/icon-change.ts b/apps/app/ui-tests-app/bottom-navigation/icon-change.ts
deleted file mode 100644
index 5301c28e9..000000000
--- a/apps/app/ui-tests-app/bottom-navigation/icon-change.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { BottomNavigation, SelectedIndexChangedEventData } from "tns-core-modules/ui/bottom-navigation";
-
-export function onSelectedIndexChanged(args: SelectedIndexChangedEventData) {
- const bottomNav = args.object as BottomNavigation;
-
- const newItem = bottomNav.tabStrip.items[args.newIndex];
- if (newItem) {
- newItem.iconSource = "res://icon";
- }
-
- const oldItem = bottomNav.tabStrip.items[args.oldIndex];
- if (oldItem) {
- oldItem.iconSource = "res://testlogo";
- }
-}
diff --git a/apps/app/ui-tests-app/bottom-navigation/icon-title-placement.xml b/apps/app/ui-tests-app/bottom-navigation/icon-title-placement.xml
deleted file mode 100644
index 36b74e3f0..000000000
--- a/apps/app/ui-tests-app/bottom-navigation/icon-title-placement.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/button/background.xml b/apps/app/ui-tests-app/button/background.xml
deleted file mode 100644
index 7783eefeb..000000000
--- a/apps/app/ui-tests-app/button/background.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/css/image-border.xml b/apps/app/ui-tests-app/css/image-border.xml
deleted file mode 100644
index 270a61605..000000000
--- a/apps/app/ui-tests-app/css/image-border.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/css/main-page.ts b/apps/app/ui-tests-app/css/main-page.ts
deleted file mode 100644
index c892c71ea..000000000
--- a/apps/app/ui-tests-app/css/main-page.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import { EventData } from "tns-core-modules/data/observable";
-import { SubMainPageViewModel } from "../sub-main-page-view-model";
-import { WrapLayout } from "tns-core-modules/ui/layouts/wrap-layout";
-import { Page } from "tns-core-modules/ui/page";
-
-export function pageLoaded(args: EventData) {
- const page = args.object;
- const wrapLayout = page.getViewById("wrapLayoutWithExamples");
- page.bindingContext = new SubMainPageViewModel(wrapLayout, loadExamples());
-}
-
-export function loadExamples() {
- const examples = new Map();
- examples.set("formatted", "css/decoration-transform-formattedtext");
- examples.set("radius", "css/radius");
- examples.set("spacing", "css/letter-spacing");
- examples.set("line-height", "css/line-height");
- examples.set("decoration", "css/text-decoration");
- examples.set("transform", "css/text-transform");
- examples.set("whitespace", "css/white-space");
- examples.set("progress-switch", "css/progress-switch");
- examples.set("zindex", "css/zindex");
- examples.set("clipPath", "css/clip-path");
- examples.set("clipPathInset", "css/clip-path-inset");
- examples.set("padding", "css/padding");
- examples.set("pixels", "css/pixels");
- examples.set("label-background-image", "css/label-background-image");
- examples.set("transform-decoration-color", "css/transform-decoration-color");
- examples.set("layout-border", "css/layout-border");
- examples.set("label-border", "css/label-border");
- examples.set("text-view-border", "css/text-view-border");
- examples.set("image-border", "css/image-border");
- examples.set("gradient-border", "css/gradient-border");
- examples.set("layouts-border-overlap", "css/layouts-border-overlap");
- examples.set("measure-tests", "css/measure-tests");
- examples.set("all-uniform-border", "css/all-uniform-border");
- examples.set("all-non-uniform-border", "css/all-non-uniform-border");
- examples.set("margins-paddings-with-percentage", "css/margins-paddings-with-percentage");
- examples.set("padding-and-border", "css/padding-and-border");
- examples.set("combinators", "css/combinators");
- examples.set("elevation", "css/elevation");
- examples.set("styled-formatted-text", "css/styled-formatted-text");
- examples.set("non-uniform-radius", "css/non-uniform-radius");
- examples.set("missing-background-image", "css/missing-background-image");
- examples.set("background-shorthand", "css/background-shorthand");
- examples.set("background-image-linear-gradient", "css/background-image-linear-gradient");
- examples.set("background-image", "css/background-image");
- return examples;
-}
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/css/test.css b/apps/app/ui-tests-app/css/test.css
deleted file mode 100644
index fc4faec03..000000000
--- a/apps/app/ui-tests-app/css/test.css
+++ /dev/null
@@ -1,3 +0,0 @@
-TabView{
- font-size:10;
-}
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/font/fonts-weight/main-page.ts b/apps/app/ui-tests-app/font/fonts-weight/main-page.ts
deleted file mode 100644
index 155fb69bf..000000000
--- a/apps/app/ui-tests-app/font/fonts-weight/main-page.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import { EventData } from "tns-core-modules/data/observable";
-import { SubMainPageViewModel } from "../../sub-main-page-view-model";
-import { WrapLayout } from "tns-core-modules/ui/layouts/wrap-layout";
-import { Page } from "tns-core-modules/ui/page";
-
-export function pageLoaded(args: EventData) {
- const page = args.object;
- const wrapLayout = page.getViewById("wrapLayoutWithExamples");
- page.bindingContext = new SubMainPageViewModel(wrapLayout, loadExamples());
-}
-
-export function loadExamples() {
- const examples = new Map();
- examples.set("system", "font/fonts-weight/system");
- examples.set("sans-serif", "font/fonts-weight/sans-serif");
- examples.set("serif", "font/fonts-weight/serif");
- examples.set("monospace", "font/fonts-weight/monospace");
- examples.set("courier-new", "font/fonts-weight/courier-new");
- examples.set("helvetica", "font/fonts-weight/helvetica");
- examples.set("custom-fontawesome", "font/fonts-weight/custom-fontawesome");
- examples.set("custom-muli", "font/fonts-weight/custom-muli");
- examples.set("custom-sofia", "font/fonts-weight/custom-sofia");
- examples.set("font-fallback", "font/fonts-weight/font-fallback");
-
- return examples;
-}
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/image-view/rounded-images.xml b/apps/app/ui-tests-app/image-view/rounded-images.xml
deleted file mode 100644
index d1cab324a..000000000
--- a/apps/app/ui-tests-app/image-view/rounded-images.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/issues/main-page.ts b/apps/app/ui-tests-app/issues/main-page.ts
deleted file mode 100644
index 587041d48..000000000
--- a/apps/app/ui-tests-app/issues/main-page.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import { EventData } from "tns-core-modules/data/observable";
-import { SubMainPageViewModel } from "../sub-main-page-view-model";
-import { WrapLayout } from "tns-core-modules/ui/layouts/wrap-layout";
-import { Page } from "tns-core-modules/ui/page";
-
-export function pageLoaded(args: EventData) {
- const page = args.object;
- const wrapLayout = page.getViewById("wrapLayoutWithExamples");
- page.bindingContext = new SubMainPageViewModel(wrapLayout, loadExamples());
-}
-
-export function loadExamples() {
- const examples = new Map();
- examples.set("2911", "issues/issue-2911");
- examples.set("2674", "issues/issue-2674");
- examples.set("2942", "issues/issue-2942");
- examples.set("3007", "issues/issue-3007");
- examples.set("2661", "issues/issue-2661");
- examples.set("3113", "issues/issue-3113");
- examples.set("3164", "issues/issue-3164");
- examples.set("3175", "issues/issue-3175");
- examples.set("3211", "issues/issue-3211");
- examples.set("1639", "issues/issue-1639");
- examples.set("3714", "issues/issue-3714");
- examples.set("1657-ios", "issues/issue-1657-ios");
- examples.set("tabview-with-scrollview_4022", "issues/tabview-with-scrollview_4022");
- examples.set("3354-ios", "issues/issue-3354");
- examples.set("4450", "issues/issue-4450");
- examples.set("5125", "issues/issue-5125");
- examples.set("5274", "issues/issue-5274");
- examples.set("ng-repo-1599", "issues/issue-ng-repo-1599");
- examples.set("ng-repo-1626", "issues/issue-ng-repo-1626");
- examples.set("6439", "issues/issue-6439");
- examples.set("open-file-6895", "issues/open-file-6895")
-
- return examples;
-}
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/layouts/main-page.ts b/apps/app/ui-tests-app/layouts/main-page.ts
deleted file mode 100644
index 567d2fa01..000000000
--- a/apps/app/ui-tests-app/layouts/main-page.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { EventData } from "tns-core-modules/data/observable";
-import { SubMainPageViewModel } from "../sub-main-page-view-model";
-import { WrapLayout } from "tns-core-modules/ui/layouts/wrap-layout";
-import { Page } from "tns-core-modules/ui/page";
-
-export function pageLoaded(args: EventData) {
- const page = args.object;
- const wrapLayout = page.getViewById("wrapLayoutWithExamples");
- page.bindingContext = new SubMainPageViewModel(wrapLayout, loadExamples());
-}
-
-export function loadExamples() {
- const examples = new Map();
- examples.set("absolute", "layouts/absolute");
- examples.set("dock", "layouts/dock");
- examples.set("grid", "layouts/grid");
- examples.set("stack", "layouts/stack");
- examples.set("wrap", "layouts/wrap");
- examples.set("pabsolute", "layouts-percent/absolute");
- examples.set("pdock", "layouts-percent/dock");
- examples.set("pgrid", "layouts-percent/grid");
- examples.set("pstack", "layouts-percent/stack");
- examples.set("pwrap", "layouts-percent/wrap");
- examples.set("passThroughParent", "layouts/passThroughParent");
- examples.set("stacklayout-6059", "layouts/stacklayout-6059");
- examples.set("safe-area", "layouts/safe-area");
-
- return examples;
-}
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/page/main-page.ts b/apps/app/ui-tests-app/page/main-page.ts
deleted file mode 100644
index bce3cca7c..000000000
--- a/apps/app/ui-tests-app/page/main-page.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import { EventData } from "tns-core-modules/data/observable";
-import { SubMainPageViewModel } from "../sub-main-page-view-model";
-import { WrapLayout } from "tns-core-modules/ui/layouts/wrap-layout";
-import { Page } from "tns-core-modules/ui/page";
-
-export function pageLoaded(args: EventData) {
- const page = args.object;
- const wrapLayout = page.getViewById("wrapLayoutWithExamples");
- page.bindingContext = new SubMainPageViewModel(wrapLayout, loadExamples());
-}
-
-export function loadExamples() {
- const examples = new Map();
- examples.set("statusBar", "page/page-status-bar-css");
- return examples;
-}
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/perf/memory-leaks/background-image.css b/apps/app/ui-tests-app/perf/memory-leaks/background-image.css
deleted file mode 100644
index 1c468e608..000000000
--- a/apps/app/ui-tests-app/perf/memory-leaks/background-image.css
+++ /dev/null
@@ -1,7 +0,0 @@
-.bg-main-page{
- background-image: url('~/ui-tests-app/resources/images/gravatar.png');
-}
-
-.info {
- font-size: 20;
-}
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/segmented-bar/all.ts b/apps/app/ui-tests-app/segmented-bar/all.ts
deleted file mode 100644
index e54a245dc..000000000
--- a/apps/app/ui-tests-app/segmented-bar/all.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import * as frame from "tns-core-modules/ui/frame";
-
-export function navigate(args) {
- frame.topmost().navigate("ui-tests-app/segmented-bar/clean");
-}
diff --git a/apps/app/ui-tests-app/tabs/background-color.xml b/apps/app/ui-tests-app/tabs/background-color.xml
deleted file mode 100644
index a931de491..000000000
--- a/apps/app/ui-tests-app/tabs/background-color.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/tabs/color.xml b/apps/app/ui-tests-app/tabs/color.xml
deleted file mode 100644
index b174dcfba..000000000
--- a/apps/app/ui-tests-app/tabs/color.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/apps/nsconfig.json b/apps/nsconfig.json
new file mode 100644
index 000000000..a6d75472c
--- /dev/null
+++ b/apps/nsconfig.json
@@ -0,0 +1,3 @@
+{
+ "useLegacyWorkflow": false
+}
\ No newline at end of file
diff --git a/apps/package.json b/apps/package.json
index 0a1b05ca6..605616833 100644
--- a/apps/package.json
+++ b/apps/package.json
@@ -1,8 +1,4 @@
{
- "description": "NativeScript Application",
- "license": "SEE LICENSE IN ",
- "readme": "NativeScript Application",
- "repository": "",
"nativescript": {
"id": "org.nativescript.apps",
"tns-android": {
@@ -12,16 +8,17 @@
"version": "next"
}
},
+ "description": "NativeScript Application",
+ "license": "SEE LICENSE IN ",
+ "repository": "",
"dependencies": {
- "tns-core-modules": "*"
+ "tns-core-modules": "file:../tns-core-modules"
},
"devDependencies": {
- "babel-traverse": "6.10.4",
- "babel-types": "6.11.1",
- "babylon": "6.8.3",
- "lazy": "1.0.11",
- "nativescript-dev-typescript": "next",
- "tns-platform-declarations": "androidx",
- "typescript": "^3.1.6"
- }
+ "nativescript-dev-webpack": "next",
+ "node-sass": "^4.12.0",
+ "typescript": "~3.4.1"
+ },
+ "gitHead": "c06800e52ee1a184ea2dffd12a6702aaa43be4e3",
+ "readme": "NativeScript Application"
}
diff --git a/apps/tsconfig.json b/apps/tsconfig.json
index 4f5d9b3d1..8dee36332 100644
--- a/apps/tsconfig.json
+++ b/apps/tsconfig.json
@@ -1,23 +1,29 @@
{
- "extends": "../tsconfig.shared",
- "exclude": [
- "node_modules",
- "platforms"
- ],
"compilerOptions": {
- "baseUrl": ".",
- "paths": {
- "*": [
- "./node_modules/tns-core-modules/*",
- "./node_modules/*"
- ],
- "~/*": [
- "app/*"
- ]
- },
+ "module": "commonjs",
+ "target": "es5",
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true,
+ "noEmitHelpers": true,
+ "noEmitOnError": false,
"lib": [
"es6",
"dom"
- ]
- }
-}
\ No newline at end of file
+ ],
+ "baseUrl": ".",
+ "paths": {
+ "~/*": [
+ "app/*"
+ ]
+ }
+ },
+ "include": [
+ "../tns-core-modules",
+ "**/*"
+ ],
+ "exclude": [
+ "../tns-core-modules/node_modules",
+ "node_modules",
+ "platforms"
+ ]
+}
diff --git a/apps/tsconfig.tns.json b/apps/tsconfig.tns.json
new file mode 100644
index 000000000..95f2ecee0
--- /dev/null
+++ b/apps/tsconfig.tns.json
@@ -0,0 +1,7 @@
+{
+ "extends": "./tsconfig",
+ "compilerOptions": {
+ "module": "es2015",
+ "moduleResolution": "node"
+ }
+}
diff --git a/apps/tsfmt.json b/apps/tsfmt.json
new file mode 100644
index 000000000..f9e47f797
--- /dev/null
+++ b/apps/tsfmt.json
@@ -0,0 +1,4 @@
+{
+ "indentSize": 4,
+ "tabSize": 4
+}
diff --git a/build/tslint.json b/build/tslint.json
index f8f80120b..4180d428a 100644
--- a/build/tslint.json
+++ b/build/tslint.json
@@ -3,11 +3,12 @@
"arrow-return-shorthand": true,
"class-name": true,
"curly": true,
- "deprecation": false,
+ "deprecation": true,
"forin": false,
"indent": [true, "spaces", 4],
"jsdoc-format": false,
"max-line-length": [false, 120],
+ "newline-before-return": true,
"no-arg": true,
"no-bitwise": false,
"no-consecutive-blank-lines": true,
@@ -16,6 +17,7 @@
"no-duplicate-variable": true,
"no-empty": true,
"no-eval": true,
+ "no-irregular-whitespace": true,
"no-string-literal": false,
"no-trailing-whitespace": false,
"no-unused-expression": true,
@@ -29,7 +31,7 @@
],
"quotemark": [true, "double"],
"radix": false,
- "semicolon": false,
+ "semicolon": true,
"triple-equals": [true, "allow-null-check"],
"typedef": [false,
"callSignature",
diff --git a/e2e/animation/.gitignore b/e2e/animation/.gitignore
index bec5ea570..32172cda8 100644
--- a/e2e/animation/.gitignore
+++ b/e2e/animation/.gitignore
@@ -1,2 +1,35 @@
-.vscode/settings.json
-mochawesome-report
\ No newline at end of file
+mochawesome-report
+
+# NativeScript
+hooks/
+node_modules/
+platforms/
+
+# NativeScript Template
+*.js.map
+*.js
+!webpack.config.js
+
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# General
+.DS_Store
+.AppleDouble
+.LSOverride
+.idea
+.cloud
+.project
+tmp/
+typings/
+
+# Visual Studio Code
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
diff --git a/e2e/animation/app/css-animations/animate-css/page.css b/e2e/animation/app/css-animations/animate-css/page.css
index 8827f3e8a..5a6700a35 100644
--- a/e2e/animation/app/css-animations/animate-css/page.css
+++ b/e2e/animation/app/css-animations/animate-css/page.css
@@ -1,4 +1,4 @@
-@import '~/css-animations/animate-css/animate.css';
+@import './animate.css';
.myRubberBand {
animation-name: rubberBand;
diff --git a/e2e/animation/app/css-animations/page.ts b/e2e/animation/app/css-animations/page.ts
index 20dcfa820..b882e6415 100644
--- a/e2e/animation/app/css-animations/page.ts
+++ b/e2e/animation/app/css-animations/page.ts
@@ -10,6 +10,7 @@ export function pageLoaded(args: EventData) {
export function onButtonTap(args: EventData) {
const clickedButton =
diff --git a/apps/app/ui-tests-app/action-bar/action-view.ts b/e2e/ui-tests-app/app/action-bar/action-view-page.ts
similarity index 59%
rename from apps/app/ui-tests-app/action-bar/action-view.ts
rename to e2e/ui-tests-app/app/action-bar/action-view-page.ts
index 1ce73c5b0..80b8d2436 100644
--- a/apps/app/ui-tests-app/action-bar/action-view.ts
+++ b/e2e/ui-tests-app/app/action-bar/action-view-page.ts
@@ -1,5 +1,5 @@
import * as frame from "tns-core-modules/ui/frame";
export function navigate(args) {
- frame.topmost().navigate("ui-tests-app/action-bar/clean");
+ frame.topmost().navigate("action-bar/clean-page");
}
diff --git a/apps/app/ui-tests-app/action-bar/action-view.xml b/e2e/ui-tests-app/app/action-bar/action-view-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/action-bar/action-view.xml
rename to e2e/ui-tests-app/app/action-bar/action-view-page.xml
diff --git a/e2e/ui-tests-app/app/action-bar/all-page.ts b/e2e/ui-tests-app/app/action-bar/all-page.ts
new file mode 100644
index 000000000..5deb05827
--- /dev/null
+++ b/e2e/ui-tests-app/app/action-bar/all-page.ts
@@ -0,0 +1,5 @@
+import * as frame from "tns-core-modules/ui/frame";
+
+export function navigate() {
+ frame.topmost().navigate("action-bar/clean-page");
+}
diff --git a/apps/app/ui-tests-app/action-bar/all.xml b/e2e/ui-tests-app/app/action-bar/all-page.xml
similarity index 97%
rename from apps/app/ui-tests-app/action-bar/all.xml
rename to e2e/ui-tests-app/app/action-bar/all-page.xml
index 595ab98ea..c85946305 100644
--- a/apps/app/ui-tests-app/action-bar/all.xml
+++ b/e2e/ui-tests-app/app/action-bar/all-page.xml
@@ -10,4 +10,4 @@
-
\ No newline at end of file
+
diff --git a/e2e/ui-tests-app/app/action-bar/background-css-page.css b/e2e/ui-tests-app/app/action-bar/background-css-page.css
new file mode 100644
index 000000000..fe3eceae4
--- /dev/null
+++ b/e2e/ui-tests-app/app/action-bar/background-css-page.css
@@ -0,0 +1,3 @@
+.action {
+ background-color: red;
+}
diff --git a/apps/app/ui-tests-app/action-bar/all.ts b/e2e/ui-tests-app/app/action-bar/background-css-page.ts
similarity index 59%
rename from apps/app/ui-tests-app/action-bar/all.ts
rename to e2e/ui-tests-app/app/action-bar/background-css-page.ts
index 1ce73c5b0..80b8d2436 100644
--- a/apps/app/ui-tests-app/action-bar/all.ts
+++ b/e2e/ui-tests-app/app/action-bar/background-css-page.ts
@@ -1,5 +1,5 @@
import * as frame from "tns-core-modules/ui/frame";
export function navigate(args) {
- frame.topmost().navigate("ui-tests-app/action-bar/clean");
+ frame.topmost().navigate("action-bar/clean-page");
}
diff --git a/apps/app/ui-tests-app/action-bar/background-css.xml b/e2e/ui-tests-app/app/action-bar/background-css-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/action-bar/background-css.xml
rename to e2e/ui-tests-app/app/action-bar/background-css-page.xml
diff --git a/e2e/ui-tests-app/app/action-bar/background-page.ts b/e2e/ui-tests-app/app/action-bar/background-page.ts
new file mode 100644
index 000000000..5deb05827
--- /dev/null
+++ b/e2e/ui-tests-app/app/action-bar/background-page.ts
@@ -0,0 +1,5 @@
+import * as frame from "tns-core-modules/ui/frame";
+
+export function navigate() {
+ frame.topmost().navigate("action-bar/clean-page");
+}
diff --git a/apps/app/ui-tests-app/action-bar/background.xml b/e2e/ui-tests-app/app/action-bar/background-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/action-bar/background.xml
rename to e2e/ui-tests-app/app/action-bar/background-page.xml
diff --git a/apps/app/ui-tests-app/action-bar/clean.ts b/e2e/ui-tests-app/app/action-bar/clean-page.ts
similarity index 100%
rename from apps/app/ui-tests-app/action-bar/clean.ts
rename to e2e/ui-tests-app/app/action-bar/clean-page.ts
diff --git a/apps/app/ui-tests-app/action-bar/clean.xml b/e2e/ui-tests-app/app/action-bar/clean-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/action-bar/clean.xml
rename to e2e/ui-tests-app/app/action-bar/clean-page.xml
diff --git a/e2e/ui-tests-app/app/action-bar/color-page.ts b/e2e/ui-tests-app/app/action-bar/color-page.ts
new file mode 100644
index 000000000..5deb05827
--- /dev/null
+++ b/e2e/ui-tests-app/app/action-bar/color-page.ts
@@ -0,0 +1,5 @@
+import * as frame from "tns-core-modules/ui/frame";
+
+export function navigate() {
+ frame.topmost().navigate("action-bar/clean-page");
+}
diff --git a/apps/app/ui-tests-app/action-bar/color.xml b/e2e/ui-tests-app/app/action-bar/color-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/action-bar/color.xml
rename to e2e/ui-tests-app/app/action-bar/color-page.xml
diff --git a/apps/app/ui-tests-app/action-bar/flat-layout.xml b/e2e/ui-tests-app/app/action-bar/flat-layout-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/action-bar/flat-layout.xml
rename to e2e/ui-tests-app/app/action-bar/flat-layout-page.xml
diff --git a/apps/app/ui-tests-app/action-bar/flat.ts b/e2e/ui-tests-app/app/action-bar/flat-page.ts
similarity index 100%
rename from apps/app/ui-tests-app/action-bar/flat.ts
rename to e2e/ui-tests-app/app/action-bar/flat-page.ts
diff --git a/apps/app/ui-tests-app/action-bar/flat.xml b/e2e/ui-tests-app/app/action-bar/flat-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/action-bar/flat.xml
rename to e2e/ui-tests-app/app/action-bar/flat-page.xml
diff --git a/apps/app/ui-tests-app/action-bar/flat-scrollview.xml b/e2e/ui-tests-app/app/action-bar/flat-scrollview-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/action-bar/flat-scrollview.xml
rename to e2e/ui-tests-app/app/action-bar/flat-scrollview-page.xml
diff --git a/apps/app/ui-tests-app/action-bar/flat-tab-opaque-bar.ts b/e2e/ui-tests-app/app/action-bar/flat-tab-opaque-bar-page.ts
similarity index 86%
rename from apps/app/ui-tests-app/action-bar/flat-tab-opaque-bar.ts
rename to e2e/ui-tests-app/app/action-bar/flat-tab-opaque-bar-page.ts
index a0b131f61..2c5e3504a 100644
--- a/apps/app/ui-tests-app/action-bar/flat-tab-opaque-bar.ts
+++ b/e2e/ui-tests-app/app/action-bar/flat-tab-opaque-bar-page.ts
@@ -2,6 +2,7 @@ import { EventData } from "tns-core-modules/data/observable";
import { TabView } from "tns-core-modules/ui/tab-view";
export function onLoaded(args: EventData) {
+ console.log("TEST", args.object);
const tabView = args.object;
tabView.ios.tabBar.translucent = false;
}
diff --git a/apps/app/ui-tests-app/action-bar/flat-tab-opaque-bar.xml b/e2e/ui-tests-app/app/action-bar/flat-tab-opaque-bar-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/action-bar/flat-tab-opaque-bar.xml
rename to e2e/ui-tests-app/app/action-bar/flat-tab-opaque-bar-page.xml
diff --git a/apps/app/ui-tests-app/action-bar/flat-tab.xml b/e2e/ui-tests-app/app/action-bar/flat-tab-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/action-bar/flat-tab.xml
rename to e2e/ui-tests-app/app/action-bar/flat-tab-page.xml
diff --git a/apps/app/ui-tests-app/action-bar/local-icons.ts b/e2e/ui-tests-app/app/action-bar/icons-page.ts
similarity index 73%
rename from apps/app/ui-tests-app/action-bar/local-icons.ts
rename to e2e/ui-tests-app/app/action-bar/icons-page.ts
index 9f83e7d81..2d20576ac 100644
--- a/apps/app/ui-tests-app/action-bar/local-icons.ts
+++ b/e2e/ui-tests-app/app/action-bar/icons-page.ts
@@ -1,17 +1,17 @@
-import * as frame from "tns-core-modules/ui/frame";
+import * as frame from "tns-core-modules/ui/frame";
import { EventData } from "tns-core-modules/ui/frame";
import { Button } from "tns-core-modules/ui/button";
import { ActionBar } from "tns-core-modules/ui/action-bar";
const iconModes = ["automatic", "alwaysOriginal", "alwaysTemplate", undefined];
-export function navigate(args) {
- frame.topmost().navigate("ui-tests-app/action-bar/clean");
+export function navigate() {
+ frame.topmost().navigate("action-bar/clean-page");
}
export function onChangeRenderingMode(args: EventData) {
const button = args.object;
- const actionBar = button.page.actionBar
+ const actionBar = button.page.actionBar;
actionBar.iosIconRenderingMode = <"automatic" | "alwaysOriginal" | "alwaysTemplate">iconModes[(iconModes.indexOf(actionBar.iosIconRenderingMode) + 1) % iconModes.length];
button.text = "" + actionBar.iosIconRenderingMode;
}
diff --git a/apps/app/ui-tests-app/action-bar/icons.xml b/e2e/ui-tests-app/app/action-bar/icons-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/action-bar/icons.xml
rename to e2e/ui-tests-app/app/action-bar/icons-page.xml
diff --git a/apps/app/ui-tests-app/action-bar/icons.ts b/e2e/ui-tests-app/app/action-bar/local-icons-page.ts
similarity index 73%
rename from apps/app/ui-tests-app/action-bar/icons.ts
rename to e2e/ui-tests-app/app/action-bar/local-icons-page.ts
index 1522a19e2..2d20576ac 100644
--- a/apps/app/ui-tests-app/action-bar/icons.ts
+++ b/e2e/ui-tests-app/app/action-bar/local-icons-page.ts
@@ -1,17 +1,17 @@
-import * as frame from "tns-core-modules/ui/frame";
+import * as frame from "tns-core-modules/ui/frame";
import { EventData } from "tns-core-modules/ui/frame";
import { Button } from "tns-core-modules/ui/button";
import { ActionBar } from "tns-core-modules/ui/action-bar";
const iconModes = ["automatic", "alwaysOriginal", "alwaysTemplate", undefined];
-export function navigate(args) {
- frame.topmost().navigate("ui-tests-app/action-bar/clean");
+export function navigate() {
+ frame.topmost().navigate("action-bar/clean-page");
}
export function onChangeRenderingMode(args: EventData) {
const button = args.object;
- const actionBar = button.page.actionBar
+ const actionBar = button.page.actionBar;
actionBar.iosIconRenderingMode = <"automatic" | "alwaysOriginal" | "alwaysTemplate">iconModes[(iconModes.indexOf(actionBar.iosIconRenderingMode) + 1) % iconModes.length];
button.text = "" + actionBar.iosIconRenderingMode;
-}
\ No newline at end of file
+}
diff --git a/apps/app/ui-tests-app/action-bar/local-icons.xml b/e2e/ui-tests-app/app/action-bar/local-icons-page.xml
similarity index 63%
rename from apps/app/ui-tests-app/action-bar/local-icons.xml
rename to e2e/ui-tests-app/app/action-bar/local-icons-page.xml
index 2ac398480..a0e14c181 100644
--- a/apps/app/ui-tests-app/action-bar/local-icons.xml
+++ b/e2e/ui-tests-app/app/action-bar/local-icons-page.xml
@@ -2,8 +2,8 @@
-
-
+
+
diff --git a/apps/app/ui-tests-app/action-bar/main-page.ts b/e2e/ui-tests-app/app/action-bar/main-page.ts
similarity index 53%
rename from apps/app/ui-tests-app/action-bar/main-page.ts
rename to e2e/ui-tests-app/app/action-bar/main-page.ts
index 0f9a8e77e..583f489be 100644
--- a/apps/app/ui-tests-app/action-bar/main-page.ts
+++ b/e2e/ui-tests-app/app/action-bar/main-page.ts
@@ -11,23 +11,23 @@ export function pageLoaded(args: EventData) {
export function loadExamples() {
const examples = new Map();
- examples.set("actColor", "action-bar/color");
- examples.set("actBG", "action-bar/background");
- examples.set("actStyle", "action-bar/all");
- examples.set("actIcons", "action-bar/system-icons");
- examples.set("actLocalIcons", "action-bar/local-icons");
- examples.set("actResIcons", "action-bar/icons");
- examples.set("actView", "action-bar/action-view");
- examples.set("actionItemPosition", "action-bar/action-item-position");
- examples.set("actBGCss", "action-bar/background-css");
- examples.set("actTransparentBgCss", "action-bar/transparent-bg-css");
- examples.set("modalHiddenActBar", "action-bar/modal-test-hidden-action-bar");
- examples.set("modalShownActBar", "action-bar/modal-test-with-action-bar");
- examples.set("flat", "action-bar/flat");
- examples.set("flat-tab", "action-bar/flat-tab");
- examples.set("flat-tab-opaque-bar", "action-bar/flat-tab-opaque-bar");
- examples.set("flat-layout", "action-bar/flat-layout");
- examples.set("flat-scrollview", "action-bar/flat-scrollview");
+ examples.set("actColor", "action-bar/color-page");
+ examples.set("actBG", "action-bar/background-page");
+ examples.set("actStyle", "action-bar/all-page");
+ examples.set("actIcons", "action-bar/system-icons-page");
+ examples.set("actLocalIcons", "action-bar/local-icons-page");
+ examples.set("actResIcons", "action-bar/icons-page");
+ examples.set("actView", "action-bar/action-view-page");
+ examples.set("actionItemPosition", "action-bar/action-item-position-page");
+ examples.set("actBGCss", "action-bar/background-css-page");
+ examples.set("actTransparentBgCss", "action-bar/transparent-bg-css-page");
+ examples.set("modalHiddenActBar", "action-bar/modal-test-hidden-action-bar-page");
+ examples.set("modalShownActBar", "action-bar/modal-test-with-action-bar-page");
+ examples.set("flat", "action-bar/flat-page");
+ examples.set("flat-tab", "action-bar/flat-tab-page");
+ examples.set("flat-tab-opaque-bar", "action-bar/flat-tab-opaque-bar-page");
+ examples.set("flat-layout", "action-bar/flat-layout-page");
+ examples.set("flat-scrollview", "action-bar/flat-scrollview-page");
return examples;
-}
\ No newline at end of file
+}
diff --git a/apps/app/ui-tests-app/action-bar/main-page.xml b/e2e/ui-tests-app/app/action-bar/main-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/action-bar/main-page.xml
rename to e2e/ui-tests-app/app/action-bar/main-page.xml
diff --git a/apps/app/ui-tests-app/action-bar/modal-page-hidden-action-bar.ts b/e2e/ui-tests-app/app/action-bar/modal-page-hidden-action-bar-page.ts
similarity index 100%
rename from apps/app/ui-tests-app/action-bar/modal-page-hidden-action-bar.ts
rename to e2e/ui-tests-app/app/action-bar/modal-page-hidden-action-bar-page.ts
diff --git a/apps/app/ui-tests-app/action-bar/modal-page-hidden-action-bar.xml b/e2e/ui-tests-app/app/action-bar/modal-page-hidden-action-bar-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/action-bar/modal-page-hidden-action-bar.xml
rename to e2e/ui-tests-app/app/action-bar/modal-page-hidden-action-bar-page.xml
diff --git a/apps/app/ui-tests-app/action-bar/modal-page.ts b/e2e/ui-tests-app/app/action-bar/modal-page.ts
similarity index 89%
rename from apps/app/ui-tests-app/action-bar/modal-page.ts
rename to e2e/ui-tests-app/app/action-bar/modal-page.ts
index 0a82f0cd6..4849f37fb 100644
--- a/apps/app/ui-tests-app/action-bar/modal-page.ts
+++ b/e2e/ui-tests-app/app/action-bar/modal-page.ts
@@ -1,7 +1,7 @@
import { ShownModallyData } from "tns-core-modules/ui/page";
import { Button } from "tns-core-modules/ui/button";
-import { Label } from "tns-core-modules/ui/label"
-import { Page } from "tns-core-modules/ui/page"
+import { Label } from "tns-core-modules/ui/label";
+import { Page } from "tns-core-modules/ui/page";
let closeCallback: Function;
@@ -18,8 +18,8 @@ export function change(args) {
var page: Page = button.parent;
- console.log("---------------------page-------------------------")
- console.log(page)
+ console.log("---------------------page-------------------------");
+ console.log(page);
var label: Label =
-
+
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/nested-frames/full-screen-n-y.xml b/e2e/ui-tests-app/app/nested-frames/full-screen-n-y-flat-page.xml
similarity index 62%
rename from apps/app/ui-tests-app/nested-frames/full-screen-n-y.xml
rename to e2e/ui-tests-app/app/nested-frames/full-screen-n-y-flat-page.xml
index 87b5d0c06..ba367e18a 100644
--- a/apps/app/ui-tests-app/nested-frames/full-screen-n-y.xml
+++ b/e2e/ui-tests-app/app/nested-frames/full-screen-n-y-flat-page.xml
@@ -5,6 +5,6 @@
-
+
-
\ No newline at end of file
+
diff --git a/apps/app/ui-tests-app/nested-frames/full-screen-n-y-flat.xml b/e2e/ui-tests-app/app/nested-frames/full-screen-n-y-page.xml
similarity index 61%
rename from apps/app/ui-tests-app/nested-frames/full-screen-n-y-flat.xml
rename to e2e/ui-tests-app/app/nested-frames/full-screen-n-y-page.xml
index f1d360794..a072c15c0 100644
--- a/apps/app/ui-tests-app/nested-frames/full-screen-n-y-flat.xml
+++ b/e2e/ui-tests-app/app/nested-frames/full-screen-n-y-page.xml
@@ -5,6 +5,6 @@
-
+
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/nested-frames/full-screen-y-n-flat.xml b/e2e/ui-tests-app/app/nested-frames/full-screen-y-n-flat-page.xml
similarity index 62%
rename from apps/app/ui-tests-app/nested-frames/full-screen-y-n-flat.xml
rename to e2e/ui-tests-app/app/nested-frames/full-screen-y-n-flat-page.xml
index ca9bdc197..3a366a226 100644
--- a/apps/app/ui-tests-app/nested-frames/full-screen-y-n-flat.xml
+++ b/e2e/ui-tests-app/app/nested-frames/full-screen-y-n-flat-page.xml
@@ -5,6 +5,6 @@
-
+
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/nested-frames/full-screen-y-n.xml b/e2e/ui-tests-app/app/nested-frames/full-screen-y-n-page.xml
similarity index 59%
rename from apps/app/ui-tests-app/nested-frames/full-screen-y-n.xml
rename to e2e/ui-tests-app/app/nested-frames/full-screen-y-n-page.xml
index 071ac75f0..53b0134a1 100644
--- a/apps/app/ui-tests-app/nested-frames/full-screen-y-n.xml
+++ b/e2e/ui-tests-app/app/nested-frames/full-screen-y-n-page.xml
@@ -5,6 +5,6 @@
-
+
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/nested-frames/full-screen-y-y-flat.xml b/e2e/ui-tests-app/app/nested-frames/full-screen-y-y-flat-page.xml
similarity index 61%
rename from apps/app/ui-tests-app/nested-frames/full-screen-y-y-flat.xml
rename to e2e/ui-tests-app/app/nested-frames/full-screen-y-y-flat-page.xml
index 4a9f50771..caea04677 100644
--- a/apps/app/ui-tests-app/nested-frames/full-screen-y-y-flat.xml
+++ b/e2e/ui-tests-app/app/nested-frames/full-screen-y-y-flat-page.xml
@@ -5,6 +5,6 @@
-
+
-
\ No newline at end of file
+
diff --git a/apps/app/ui-tests-app/nested-frames/full-screen-y-y.xml b/e2e/ui-tests-app/app/nested-frames/full-screen-y-y-page.xml
similarity index 59%
rename from apps/app/ui-tests-app/nested-frames/full-screen-y-y.xml
rename to e2e/ui-tests-app/app/nested-frames/full-screen-y-y-page.xml
index fd53bf93c..5414fe0d8 100644
--- a/apps/app/ui-tests-app/nested-frames/full-screen-y-y.xml
+++ b/e2e/ui-tests-app/app/nested-frames/full-screen-y-y-page.xml
@@ -5,6 +5,6 @@
-
+
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/nested-frames/main-page.ts b/e2e/ui-tests-app/app/nested-frames/main-page.ts
similarity index 67%
rename from apps/app/ui-tests-app/nested-frames/main-page.ts
rename to e2e/ui-tests-app/app/nested-frames/main-page.ts
index efb977d14..c43df0ad8 100644
--- a/apps/app/ui-tests-app/nested-frames/main-page.ts
+++ b/e2e/ui-tests-app/app/nested-frames/main-page.ts
@@ -10,28 +10,28 @@ export function pageLoaded(args: EventData) {
}
export function loadExamples() {
- const examples = new Map();
- examples.set("full-screen-n-n", "nested-frames/full-screen-n-n");
- examples.set("full-screen-n-y", "nested-frames/full-screen-n-y");
- examples.set("full-screen-n-y-flat", "nested-frames/full-screen-n-y-flat");
- examples.set("full-screen-y-n", "nested-frames/full-screen-y-n");
- examples.set("full-screen-y-n-flat", "nested-frames/full-screen-y-n-flat");
- examples.set("full-screen-y-y", "nested-frames/full-screen-y-y");
- examples.set("full-screen-y-y-flat", "nested-frames/full-screen-y-y-flat");
- examples.set("mid-screen-n-n", "nested-frames/mid-screen-n-n");
- examples.set("mid-screen-n-y", "nested-frames/mid-screen-n-y");
- examples.set("mid-screen-n-y-flat", "nested-frames/mid-screen-n-y-flat");
- examples.set("mid-screen-y-n", "nested-frames/mid-screen-y-n");
- examples.set("mid-screen-y-n-flat", "nested-frames/mid-screen-y-n-flat");
- examples.set("mid-screen-y-y", "nested-frames/mid-screen-y-y");
- examples.set("mid-screen-y-y-flat", "nested-frames/mid-screen-y-y-flat");
- examples.set("tab-y-y", "nested-frames/tab-y-y");
- examples.set("tab-y-y-flat", "nested-frames/tab-y-y-flat");
- examples.set("tab-n-y", "nested-frames/tab-n-y");
- examples.set("tab-n-y-flat", "nested-frames/tab-n-y-flat");
- examples.set("tab-y-n", "nested-frames/tab-y-n");
- examples.set("tab-y-n-flat", "nested-frames/tab-y-n-flat");
- examples.set("tab-n-n", "nested-frames/tab-n-n");
+ const examples = new Map();
+ examples.set("full-screen-n-n", "nested-frames/full-screen-n-n-page");
+ examples.set("full-screen-n-y", "nested-frames/full-screen-n-y-page");
+ examples.set("full-screen-n-y-flat", "nested-frames/full-screen-n-y-flat-page");
+ examples.set("full-screen-y-n", "nested-frames/full-screen-y-n-page");
+ examples.set("full-screen-y-n-flat", "nested-frames/full-screen-y-n-flat-page");
+ examples.set("full-screen-y-y", "nested-frames/full-screen-y-y-page");
+ examples.set("full-screen-y-y-flat", "nested-frames/full-screen-y-y-flat-page");
+ examples.set("mid-screen-n-n", "nested-frames/mid-screen-n-n-page");
+ examples.set("mid-screen-n-y", "nested-frames/mid-screen-n-y-page");
+ examples.set("mid-screen-n-y-flat", "nested-frames/mid-screen-n-y-flat-page");
+ examples.set("mid-screen-y-n", "nested-frames/mid-screen-y-n-page");
+ examples.set("mid-screen-y-n-flat", "nested-frames/mid-screen-y-n-flat-page");
+ examples.set("mid-screen-y-y", "nested-frames/mid-screen-y-y-page");
+ examples.set("mid-screen-y-y-flat", "nested-frames/mid-screen-y-y-flat-page");
+ examples.set("tab-y-y", "nested-frames/tab-y-y-page");
+ examples.set("tab-y-y-flat", "nested-frames/tab-y-y-flat-page");
+ examples.set("tab-n-y", "nested-frames/tab-n-y-page");
+ examples.set("tab-n-y-flat", "nested-frames/tab-n-y-flat-page");
+ examples.set("tab-y-n", "nested-frames/tab-y-n-page");
+ examples.set("tab-y-n-flat", "nested-frames/tab-y-n-flat-page");
+ examples.set("tab-n-n", "nested-frames/tab-n-n-page");
return examples;
-}
\ No newline at end of file
+}
diff --git a/apps/app/ui-tests-app/list-view/main-page.xml b/e2e/ui-tests-app/app/nested-frames/main-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/list-view/main-page.xml
rename to e2e/ui-tests-app/app/nested-frames/main-page.xml
diff --git a/apps/app/ui-tests-app/nested-frames/mid-screen-n-n.xml b/e2e/ui-tests-app/app/nested-frames/mid-screen-n-n-page.xml
similarity index 67%
rename from apps/app/ui-tests-app/nested-frames/mid-screen-n-n.xml
rename to e2e/ui-tests-app/app/nested-frames/mid-screen-n-n-page.xml
index 4f9548a0f..036f62703 100644
--- a/apps/app/ui-tests-app/nested-frames/mid-screen-n-n.xml
+++ b/e2e/ui-tests-app/app/nested-frames/mid-screen-n-n-page.xml
@@ -6,7 +6,7 @@
-
+
>
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/nested-frames/mid-screen-n-y.xml b/e2e/ui-tests-app/app/nested-frames/mid-screen-n-y-flat-page.xml
similarity index 67%
rename from apps/app/ui-tests-app/nested-frames/mid-screen-n-y.xml
rename to e2e/ui-tests-app/app/nested-frames/mid-screen-n-y-flat-page.xml
index 83d94d5e2..ddaa7461d 100644
--- a/apps/app/ui-tests-app/nested-frames/mid-screen-n-y.xml
+++ b/e2e/ui-tests-app/app/nested-frames/mid-screen-n-y-flat-page.xml
@@ -6,7 +6,7 @@
-
+
>
-
\ No newline at end of file
+
diff --git a/apps/app/ui-tests-app/nested-frames/mid-screen-n-y-flat.xml b/e2e/ui-tests-app/app/nested-frames/mid-screen-n-y-page.xml
similarity index 66%
rename from apps/app/ui-tests-app/nested-frames/mid-screen-n-y-flat.xml
rename to e2e/ui-tests-app/app/nested-frames/mid-screen-n-y-page.xml
index d43c17f31..fabac8610 100644
--- a/apps/app/ui-tests-app/nested-frames/mid-screen-n-y-flat.xml
+++ b/e2e/ui-tests-app/app/nested-frames/mid-screen-n-y-page.xml
@@ -6,7 +6,7 @@
-
+
>
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/nested-frames/mid-screen-y-n-flat.xml b/e2e/ui-tests-app/app/nested-frames/mid-screen-y-n-flat-page.xml
similarity index 68%
rename from apps/app/ui-tests-app/nested-frames/mid-screen-y-n-flat.xml
rename to e2e/ui-tests-app/app/nested-frames/mid-screen-y-n-flat-page.xml
index 893eb7919..e7504beb7 100644
--- a/apps/app/ui-tests-app/nested-frames/mid-screen-y-n-flat.xml
+++ b/e2e/ui-tests-app/app/nested-frames/mid-screen-y-n-flat-page.xml
@@ -6,7 +6,7 @@
-
+
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/nested-frames/mid-screen-y-n.xml b/e2e/ui-tests-app/app/nested-frames/mid-screen-y-n-page.xml
similarity index 65%
rename from apps/app/ui-tests-app/nested-frames/mid-screen-y-n.xml
rename to e2e/ui-tests-app/app/nested-frames/mid-screen-y-n-page.xml
index 09a123533..7a3184f1b 100644
--- a/apps/app/ui-tests-app/nested-frames/mid-screen-y-n.xml
+++ b/e2e/ui-tests-app/app/nested-frames/mid-screen-y-n-page.xml
@@ -6,7 +6,7 @@
-
+
>
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/nested-frames/mid-screen-y-y-flat.xml b/e2e/ui-tests-app/app/nested-frames/mid-screen-y-y-flat-page.xml
similarity index 67%
rename from apps/app/ui-tests-app/nested-frames/mid-screen-y-y-flat.xml
rename to e2e/ui-tests-app/app/nested-frames/mid-screen-y-y-flat-page.xml
index 557a74c22..092e7cb7a 100644
--- a/apps/app/ui-tests-app/nested-frames/mid-screen-y-y-flat.xml
+++ b/e2e/ui-tests-app/app/nested-frames/mid-screen-y-y-flat-page.xml
@@ -6,7 +6,7 @@
-
+
>
-
\ No newline at end of file
+
diff --git a/apps/app/ui-tests-app/nested-frames/mid-screen-y-y.xml b/e2e/ui-tests-app/app/nested-frames/mid-screen-y-y-page.xml
similarity index 65%
rename from apps/app/ui-tests-app/nested-frames/mid-screen-y-y.xml
rename to e2e/ui-tests-app/app/nested-frames/mid-screen-y-y-page.xml
index 80d59b599..4f168e757 100644
--- a/apps/app/ui-tests-app/nested-frames/mid-screen-y-y.xml
+++ b/e2e/ui-tests-app/app/nested-frames/mid-screen-y-y-page.xml
@@ -6,7 +6,7 @@
-
+
>
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/nested-frames/nested-page-flat.xml b/e2e/ui-tests-app/app/nested-frames/nested-flat-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/nested-frames/nested-page-flat.xml
rename to e2e/ui-tests-app/app/nested-frames/nested-flat-page.xml
diff --git a/apps/app/ui-tests-app/nested-frames/nested-page.xml b/e2e/ui-tests-app/app/nested-frames/nested-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/nested-frames/nested-page.xml
rename to e2e/ui-tests-app/app/nested-frames/nested-page.xml
diff --git a/apps/app/ui-tests-app/nested-frames/tab-n-n.xml b/e2e/ui-tests-app/app/nested-frames/tab-n-n-page.xml
similarity index 70%
rename from apps/app/ui-tests-app/nested-frames/tab-n-n.xml
rename to e2e/ui-tests-app/app/nested-frames/tab-n-n-page.xml
index 4c90b270f..4ebfc5562 100644
--- a/apps/app/ui-tests-app/nested-frames/tab-n-n.xml
+++ b/e2e/ui-tests-app/app/nested-frames/tab-n-n-page.xml
@@ -7,7 +7,7 @@
-
+
diff --git a/apps/app/ui-tests-app/nested-frames/tab-n-y.xml b/e2e/ui-tests-app/app/nested-frames/tab-n-y-flat-page.xml
similarity index 70%
rename from apps/app/ui-tests-app/nested-frames/tab-n-y.xml
rename to e2e/ui-tests-app/app/nested-frames/tab-n-y-flat-page.xml
index 0f3b8096a..bd761d440 100644
--- a/apps/app/ui-tests-app/nested-frames/tab-n-y.xml
+++ b/e2e/ui-tests-app/app/nested-frames/tab-n-y-flat-page.xml
@@ -7,8 +7,8 @@
-
+
-
\ No newline at end of file
+
diff --git a/apps/app/ui-tests-app/nested-frames/tab-n-y-flat.xml b/e2e/ui-tests-app/app/nested-frames/tab-n-y-page.xml
similarity index 69%
rename from apps/app/ui-tests-app/nested-frames/tab-n-y-flat.xml
rename to e2e/ui-tests-app/app/nested-frames/tab-n-y-page.xml
index 99ff4f575..cfafa2fef 100644
--- a/apps/app/ui-tests-app/nested-frames/tab-n-y-flat.xml
+++ b/e2e/ui-tests-app/app/nested-frames/tab-n-y-page.xml
@@ -7,7 +7,7 @@
-
+
diff --git a/apps/app/ui-tests-app/nested-frames/tab-y-n-flat.xml b/e2e/ui-tests-app/app/nested-frames/tab-y-n-flat-page.xml
similarity index 70%
rename from apps/app/ui-tests-app/nested-frames/tab-y-n-flat.xml
rename to e2e/ui-tests-app/app/nested-frames/tab-y-n-flat-page.xml
index d2d93dde9..ab9bbd45b 100644
--- a/apps/app/ui-tests-app/nested-frames/tab-y-n-flat.xml
+++ b/e2e/ui-tests-app/app/nested-frames/tab-y-n-flat-page.xml
@@ -7,7 +7,7 @@
-
+
diff --git a/apps/app/ui-tests-app/nested-frames/tab-y-n.xml b/e2e/ui-tests-app/app/nested-frames/tab-y-n-page.xml
similarity index 68%
rename from apps/app/ui-tests-app/nested-frames/tab-y-n.xml
rename to e2e/ui-tests-app/app/nested-frames/tab-y-n-page.xml
index f9733fb12..056e33087 100644
--- a/apps/app/ui-tests-app/nested-frames/tab-y-n.xml
+++ b/e2e/ui-tests-app/app/nested-frames/tab-y-n-page.xml
@@ -7,7 +7,7 @@
-
+
diff --git a/apps/app/ui-tests-app/nested-frames/tab-y-y-flat.xml b/e2e/ui-tests-app/app/nested-frames/tab-y-y-flat-page.xml
similarity index 69%
rename from apps/app/ui-tests-app/nested-frames/tab-y-y-flat.xml
rename to e2e/ui-tests-app/app/nested-frames/tab-y-y-flat-page.xml
index adf155707..d4cca5080 100644
--- a/apps/app/ui-tests-app/nested-frames/tab-y-y-flat.xml
+++ b/e2e/ui-tests-app/app/nested-frames/tab-y-y-flat-page.xml
@@ -7,8 +7,8 @@
-
+
-
\ No newline at end of file
+
diff --git a/apps/app/ui-tests-app/nested-frames/tab-y-y.xml b/e2e/ui-tests-app/app/nested-frames/tab-y-y-page.xml
similarity index 68%
rename from apps/app/ui-tests-app/nested-frames/tab-y-y.xml
rename to e2e/ui-tests-app/app/nested-frames/tab-y-y-page.xml
index 2d06aab71..832face3c 100644
--- a/apps/app/ui-tests-app/nested-frames/tab-y-y.xml
+++ b/e2e/ui-tests-app/app/nested-frames/tab-y-y-page.xml
@@ -7,7 +7,7 @@
-
+
diff --git a/e2e/ui-tests-app/app/package.json b/e2e/ui-tests-app/app/package.json
new file mode 100644
index 000000000..24cb7bc4c
--- /dev/null
+++ b/e2e/ui-tests-app/app/package.json
@@ -0,0 +1,6 @@
+{
+ "main": "app.js",
+ "android": {
+ "v8Flags": "--expose_gc"
+ }
+}
diff --git a/apps/app/ui-tests-app/bindings/main-page.ts b/e2e/ui-tests-app/app/page/main-page.ts
similarity index 85%
rename from apps/app/ui-tests-app/bindings/main-page.ts
rename to e2e/ui-tests-app/app/page/main-page.ts
index 7ba0cf66c..62f0bf00a 100644
--- a/apps/app/ui-tests-app/bindings/main-page.ts
+++ b/e2e/ui-tests-app/app/page/main-page.ts
@@ -11,8 +11,7 @@ export function pageLoaded(args: EventData) {
export function loadExamples() {
const examples = new Map();
- examples.set("basics", "bindings/basics");
- examples.set("xmlbasics", "bindings/xmlbasics");
+ examples.set("statusBar", "page/status-bar-css-page");
return examples;
-}
\ No newline at end of file
+}
diff --git a/apps/app/ui-tests-app/page/main-page.xml b/e2e/ui-tests-app/app/page/main-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/page/main-page.xml
rename to e2e/ui-tests-app/app/page/main-page.xml
diff --git a/apps/app/ui-tests-app/page/page-status-bar-css.ts b/e2e/ui-tests-app/app/page/status-bar-css-page.ts
similarity index 99%
rename from apps/app/ui-tests-app/page/page-status-bar-css.ts
rename to e2e/ui-tests-app/app/page/status-bar-css-page.ts
index 14d342c93..010d0258c 100644
--- a/apps/app/ui-tests-app/page/page-status-bar-css.ts
+++ b/e2e/ui-tests-app/app/page/status-bar-css-page.ts
@@ -64,4 +64,4 @@ function reset(page: Page) {
page.actionBarHidden = false;
page.backgroundSpanUnderStatusBar = false;
page.actionBar.backgroundColor = unsetValue;
-}
+}
diff --git a/apps/app/ui-tests-app/page/page-status-bar-css.xml b/e2e/ui-tests-app/app/page/status-bar-css-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/page/page-status-bar-css.xml
rename to e2e/ui-tests-app/app/page/status-bar-css-page.xml
diff --git a/apps/app/ui-tests-app/perf/main-page.ts b/e2e/ui-tests-app/app/perf/main-page.ts
similarity index 92%
rename from apps/app/ui-tests-app/perf/main-page.ts
rename to e2e/ui-tests-app/app/perf/main-page.ts
index 2bc6f5df9..60fb2df5a 100644
--- a/apps/app/ui-tests-app/perf/main-page.ts
+++ b/e2e/ui-tests-app/app/perf/main-page.ts
@@ -10,8 +10,9 @@ export function pageLoaded(args: EventData) {
}
export function loadExamples() {
- const examples = new Map();
+ const examples = new Map();
examples.set("properties", "perf/properties/main-page");
examples.set("memory-leaks", "perf/memory-leaks/main-page");
+
return examples;
}
diff --git a/apps/app/ui-tests-app/nested-frames/main-page.xml b/e2e/ui-tests-app/app/perf/main-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/nested-frames/main-page.xml
rename to e2e/ui-tests-app/app/perf/main-page.xml
diff --git a/e2e/ui-tests-app/app/perf/memory-leaks/background-image-page.css b/e2e/ui-tests-app/app/perf/memory-leaks/background-image-page.css
new file mode 100644
index 000000000..5a99ceb3a
--- /dev/null
+++ b/e2e/ui-tests-app/app/perf/memory-leaks/background-image-page.css
@@ -0,0 +1,7 @@
+.bg-main-page{
+ background-image: url('~/resources/images/gravatar.png');
+}
+
+.info {
+ font-size: 20;
+}
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/perf/memory-leaks/background-image.ts b/e2e/ui-tests-app/app/perf/memory-leaks/background-image-page.ts
similarity index 89%
rename from apps/app/ui-tests-app/perf/memory-leaks/background-image.ts
rename to e2e/ui-tests-app/app/perf/memory-leaks/background-image-page.ts
index 95256ac7e..3b50d8199 100644
--- a/apps/app/ui-tests-app/perf/memory-leaks/background-image.ts
+++ b/e2e/ui-tests-app/app/perf/memory-leaks/background-image-page.ts
@@ -11,14 +11,14 @@ var images = ["gravatar", "gravatar2", "red"];
export function onLoad(args: EventData) {
let index = indexCounter++ % 3;
let page = args.object;
- page.backgroundImage = "~/ui-tests-app/resources/images/" + images[index] + ".png";
+ page.backgroundImage = "~/resources/images/" + images[index] + ".png";
setLabelText(page, navCounter, "countInfo");
getMemoryUsage(args);
}
export function navigate(args: EventData) {
navCounter++;
- frame.topmost().navigate("ui-tests-app/perf/memory-leaks/background-image");
+ frame.topmost().navigate("perf/memory-leaks/background-image");
}
export function navigateBack(args: EventData) {
diff --git a/apps/app/ui-tests-app/perf/memory-leaks/background-image.xml b/e2e/ui-tests-app/app/perf/memory-leaks/background-image-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/perf/memory-leaks/background-image.xml
rename to e2e/ui-tests-app/app/perf/memory-leaks/background-image-page.xml
diff --git a/apps/app/ui-tests-app/perf/memory-leaks/main-page.ts b/e2e/ui-tests-app/app/perf/memory-leaks/main-page.ts
similarity index 92%
rename from apps/app/ui-tests-app/perf/memory-leaks/main-page.ts
rename to e2e/ui-tests-app/app/perf/memory-leaks/main-page.ts
index 8891a02db..c0a33e4da 100644
--- a/apps/app/ui-tests-app/perf/memory-leaks/main-page.ts
+++ b/e2e/ui-tests-app/app/perf/memory-leaks/main-page.ts
@@ -6,13 +6,13 @@ import { isAndroid } from "tns-core-modules/platform";
export function pageLoaded(args: EventData) {
let page = args.object;
- let view = require("ui/core/view");
+ let view = require("tns-core-modules/ui/core/view");
let wrapLayout = view.getViewById(page, "wrapLayoutWithExamples");
let examples: Map = new Map();
if (isAndroid) {
- examples.set("background-image", "perf/memory-leaks/background-image");
+ examples.set("background-image", "perf/memory-leaks/background-image-page");
}
let viewModel = new SubMainPageViewModel(wrapLayout, examples);
page.bindingContext = viewModel;
diff --git a/apps/app/ui-tests-app/perf/memory-leaks/main-page.xml b/e2e/ui-tests-app/app/perf/memory-leaks/main-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/perf/memory-leaks/main-page.xml
rename to e2e/ui-tests-app/app/perf/memory-leaks/main-page.xml
diff --git a/apps/app/ui-tests-app/perf/properties/main-page.ts b/e2e/ui-tests-app/app/perf/properties/main-page.ts
similarity index 99%
rename from apps/app/ui-tests-app/perf/properties/main-page.ts
rename to e2e/ui-tests-app/app/perf/properties/main-page.ts
index e3ba5c1bf..e56c1c14f 100644
--- a/apps/app/ui-tests-app/perf/properties/main-page.ts
+++ b/e2e/ui-tests-app/app/perf/properties/main-page.ts
@@ -10,6 +10,7 @@ function getStack(stack: StackLayout): StackLayout {
let p = new StackLayout();
stack.removeChildren();
stack.addChild(p);
+
return p;
}
diff --git a/apps/app/ui-tests-app/perf/properties/main-page.xml b/e2e/ui-tests-app/app/perf/properties/main-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/perf/properties/main-page.xml
rename to e2e/ui-tests-app/app/perf/properties/main-page.xml
diff --git a/apps/app/ui-tests-app/perf/properties/tests.ts b/e2e/ui-tests-app/app/perf/properties/tests.ts
similarity index 99%
rename from apps/app/ui-tests-app/perf/properties/tests.ts
rename to e2e/ui-tests-app/app/perf/properties/tests.ts
index 260fd7b3d..7154effcb 100644
--- a/apps/app/ui-tests-app/perf/properties/tests.ts
+++ b/e2e/ui-tests-app/app/perf/properties/tests.ts
@@ -11,6 +11,7 @@ export function addRemove(counts: Array, parent: LayoutBase): string {
counts.forEach((count) => {
if (count > 10000) {
result += setResultTime(noValue);
+
return;
}
@@ -48,6 +49,7 @@ export function setBackgroundColor(counts: Array, parent?: LayoutBase):
counts.forEach((count) => {
if (parent && count > 10000) {
result += setResultTime(noValue);
+
return;
}
@@ -70,7 +72,8 @@ export function setBorderWidths(counts: Array, parent?: LayoutBase): str
counts.forEach((count) => {
if (count > 10000 && parent) {
result += setResultTime(noValue);
- return;
+
+ return;
}
const lbl = setup(parent);
@@ -111,6 +114,7 @@ export function setColorWithParents(counts: Array, parent: LayoutBase):
counts.forEach((count) => {
if (count > 10000) {
result += setResultTime(noValue);
+
return;
}
@@ -149,6 +153,7 @@ export function setFontSizeWithParents(counts: Array, parent: LayoutBase
counts.forEach((count) => {
if (count > 1000) {
result += setResultTime(noValue);
+
return;
}
@@ -186,13 +191,14 @@ export function setFontWeightWithParents(counts: Array, parent: LayoutBa
counts.forEach((count) => {
if (count > 1000) {
result += setResultTime(noValue);
+
return;
}
setupParents(parent);
const time = executeTest(() => {
for (let i = 0; i < count; i++) {
- style.fontWeight = i % 2 === 0 ? "bold" : "normal"
+ style.fontWeight = i % 2 === 0 ? "bold" : "normal";
}
});
result += setResultTime(time);
@@ -221,6 +227,7 @@ export function setBindingContextWithParents(counts: Array, parent: Layo
counts.forEach((count) => {
if (count > 10000) {
result += setResultTime(noValue);
+
return;
}
setupParents(parent);
@@ -240,6 +247,7 @@ export function setBindingContextWithParentsBound(counts: Array, parent:
counts.forEach((count) => {
if (count > 1000) {
result += setResultTime(noValue);
+
return;
}
@@ -258,7 +266,7 @@ export function setBindingContextWithParentsBound(counts: Array, parent:
function setupParents(parent: LayoutBase, bindToContext: boolean = false): void {
for (let i = 0; i < 3; i++) {
let stack = new StackLayout();
- parent.addChild(stack)
+ parent.addChild(stack);
for (let j = 0; j < 3; j++) {
let innerStack = new StackLayout();
stack.addChild(innerStack);
@@ -305,6 +313,7 @@ function executeTest(func: Function): string {
const avg = total / average;
const res = `${avg.toFixed(2)}`;
+
return res;
}
diff --git a/apps/app/ui-tests-app/progress-bar/activity-indicator.xml b/e2e/ui-tests-app/app/progress-bar/activity-indicator-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/progress-bar/activity-indicator.xml
rename to e2e/ui-tests-app/app/progress-bar/activity-indicator-page.xml
diff --git a/apps/app/ui-tests-app/progress-bar/main-page.ts b/e2e/ui-tests-app/app/progress-bar/main-page.ts
similarity index 85%
rename from apps/app/ui-tests-app/progress-bar/main-page.ts
rename to e2e/ui-tests-app/app/progress-bar/main-page.ts
index 242f84235..4721ab32e 100644
--- a/apps/app/ui-tests-app/progress-bar/main-page.ts
+++ b/e2e/ui-tests-app/app/progress-bar/main-page.ts
@@ -11,7 +11,8 @@ export function pageLoaded(args: EventData) {
export function loadExamples() {
const examples = new Map();
- examples.set("activity-indicator", "progress-bar/activity-indicator");
- examples.set("progress-bar", "progress-bar/progress");
- return examples;
+ examples.set("activity-indicator", "progress-bar/activity-indicator-page");
+ examples.set("progress-bar", "progress-bar/progress-page");
+
+ return examples;
}
diff --git a/apps/app/ui-tests-app/perf/main-page.xml b/e2e/ui-tests-app/app/progress-bar/main-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/perf/main-page.xml
rename to e2e/ui-tests-app/app/progress-bar/main-page.xml
diff --git a/apps/app/ui-tests-app/progress-bar/progress.xml b/e2e/ui-tests-app/app/progress-bar/progress-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/progress-bar/progress.xml
rename to e2e/ui-tests-app/app/progress-bar/progress-page.xml
diff --git a/e2e/ui-tests-app/app/resources/images/add_to_fav.png b/e2e/ui-tests-app/app/resources/images/add_to_fav.png
new file mode 100644
index 000000000..fafe86a90
Binary files /dev/null and b/e2e/ui-tests-app/app/resources/images/add_to_fav.png differ
diff --git a/e2e/ui-tests-app/app/resources/images/add_to_fav@2x.png b/e2e/ui-tests-app/app/resources/images/add_to_fav@2x.png
new file mode 100644
index 000000000..ef05e3ea1
Binary files /dev/null and b/e2e/ui-tests-app/app/resources/images/add_to_fav@2x.png differ
diff --git a/e2e/ui-tests-app/app/resources/images/add_to_fav@3x.png b/e2e/ui-tests-app/app/resources/images/add_to_fav@3x.png
new file mode 100644
index 000000000..67ccc7dc3
Binary files /dev/null and b/e2e/ui-tests-app/app/resources/images/add_to_fav@3x.png differ
diff --git a/apps/app/ui-tests-app/resources/images/first-image.png b/e2e/ui-tests-app/app/resources/images/first-image.png
similarity index 100%
rename from apps/app/ui-tests-app/resources/images/first-image.png
rename to e2e/ui-tests-app/app/resources/images/first-image.png
diff --git a/apps/app/ui-tests-app/resources/images/gravatar.png b/e2e/ui-tests-app/app/resources/images/gravatar.png
similarity index 100%
rename from apps/app/ui-tests-app/resources/images/gravatar.png
rename to e2e/ui-tests-app/app/resources/images/gravatar.png
diff --git a/apps/app/ui-tests-app/resources/images/gravatar2.png b/e2e/ui-tests-app/app/resources/images/gravatar2.png
similarity index 100%
rename from apps/app/ui-tests-app/resources/images/gravatar2.png
rename to e2e/ui-tests-app/app/resources/images/gravatar2.png
diff --git a/e2e/ui-tests-app/app/resources/images/icon.png b/e2e/ui-tests-app/app/resources/images/icon.png
new file mode 100644
index 000000000..76f61ec1f
Binary files /dev/null and b/e2e/ui-tests-app/app/resources/images/icon.png differ
diff --git a/apps/app/ui-tests-app/resources/images/inset-test.png b/e2e/ui-tests-app/app/resources/images/inset-test.png
similarity index 100%
rename from apps/app/ui-tests-app/resources/images/inset-test.png
rename to e2e/ui-tests-app/app/resources/images/inset-test.png
diff --git a/tests/app/logo.png b/e2e/ui-tests-app/app/resources/images/logo.png
similarity index 100%
rename from tests/app/logo.png
rename to e2e/ui-tests-app/app/resources/images/logo.png
diff --git a/apps/app/ui-tests-app/resources/images/no-image.png b/e2e/ui-tests-app/app/resources/images/no-image.png
similarity index 100%
rename from apps/app/ui-tests-app/resources/images/no-image.png
rename to e2e/ui-tests-app/app/resources/images/no-image.png
diff --git a/apps/app/ui-tests-app/resources/images/red.png b/e2e/ui-tests-app/app/resources/images/red.png
similarity index 100%
rename from apps/app/ui-tests-app/resources/images/red.png
rename to e2e/ui-tests-app/app/resources/images/red.png
diff --git a/e2e/ui-tests-app/app/resources/images/splashscreen.png b/e2e/ui-tests-app/app/resources/images/splashscreen.png
new file mode 100644
index 000000000..61fbb7ed0
Binary files /dev/null and b/e2e/ui-tests-app/app/resources/images/splashscreen.png differ
diff --git a/apps/app/ui-tests-app/resources/images/test2.png b/e2e/ui-tests-app/app/resources/images/test2.png
similarity index 100%
rename from apps/app/ui-tests-app/resources/images/test2.png
rename to e2e/ui-tests-app/app/resources/images/test2.png
diff --git a/e2e/ui-tests-app/app/resources/images/testlogo.jpg b/e2e/ui-tests-app/app/resources/images/testlogo.jpg
new file mode 100644
index 000000000..102a9b134
Binary files /dev/null and b/e2e/ui-tests-app/app/resources/images/testlogo.jpg differ
diff --git a/apps/app/ui-tests-app/resources/images/woods.jpg b/e2e/ui-tests-app/app/resources/images/woods.jpg
similarity index 100%
rename from apps/app/ui-tests-app/resources/images/woods.jpg
rename to e2e/ui-tests-app/app/resources/images/woods.jpg
diff --git a/apps/app/ui-tests-app/scroll-view/layout-outside-scroll.ts b/e2e/ui-tests-app/app/scroll-view/layout-outside-scroll-page.ts
similarity index 100%
rename from apps/app/ui-tests-app/scroll-view/layout-outside-scroll.ts
rename to e2e/ui-tests-app/app/scroll-view/layout-outside-scroll-page.ts
diff --git a/apps/app/ui-tests-app/scroll-view/layout-outside-scroll.xml b/e2e/ui-tests-app/app/scroll-view/layout-outside-scroll-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/scroll-view/layout-outside-scroll.xml
rename to e2e/ui-tests-app/app/scroll-view/layout-outside-scroll-page.xml
diff --git a/apps/app/ui-tests-app/scroll-view/layout-outside-scroll-view-model.ts b/e2e/ui-tests-app/app/scroll-view/layout-outside-scroll-view-model.ts
similarity index 100%
rename from apps/app/ui-tests-app/scroll-view/layout-outside-scroll-view-model.ts
rename to e2e/ui-tests-app/app/scroll-view/layout-outside-scroll-view-model.ts
diff --git a/apps/app/ui-tests-app/scroll-view/main-page.ts b/e2e/ui-tests-app/app/scroll-view/main-page.ts
similarity index 88%
rename from apps/app/ui-tests-app/scroll-view/main-page.ts
rename to e2e/ui-tests-app/app/scroll-view/main-page.ts
index a2b6a5dd8..6f84bec33 100644
--- a/apps/app/ui-tests-app/scroll-view/main-page.ts
+++ b/e2e/ui-tests-app/app/scroll-view/main-page.ts
@@ -11,11 +11,12 @@ export function pageLoaded(args: EventData) {
export function loadExamples() {
const examples = new Map();
- examples.set("scrolling-and-sizing", "scroll-view/scrolling-and-sizing");
- examples.set("safe-area-root-element", "scroll-view/safe-area-root-element");
- examples.set("safe-area-sub-element", "scroll-view/safe-area-sub-element");
- examples.set("safe-area-images", "scroll-view/safe-area-images");
- examples.set("safe-area-images-overflow", "scroll-view/safe-area-images-overflow");
- examples.set("layout-outside-scroll", "scroll-view/layout-outside-scroll");
+ examples.set("scrolling-and-sizing", "scroll-view/scrolling-and-sizing-page");
+ examples.set("safe-area-root-element", "scroll-view/safe-area-root-element-page");
+ examples.set("safe-area-sub-element", "scroll-view/safe-area-sub-element-page");
+ examples.set("safe-area-images", "scroll-view/safe-area-images-page");
+ examples.set("safe-area-images-overflow", "scroll-view/safe-area-images-overflow-page");
+ examples.set("layout-outside-scroll", "scroll-view/layout-outside-scroll-page");
+
return examples;
-}
\ No newline at end of file
+}
diff --git a/apps/app/ui-tests-app/progress-bar/main-page.xml b/e2e/ui-tests-app/app/scroll-view/main-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/progress-bar/main-page.xml
rename to e2e/ui-tests-app/app/scroll-view/main-page.xml
diff --git a/apps/app/ui-tests-app/scroll-view/safe-area-images-overflow.xml b/e2e/ui-tests-app/app/scroll-view/safe-area-images-overflow-page.xml
similarity index 88%
rename from apps/app/ui-tests-app/scroll-view/safe-area-images-overflow.xml
rename to e2e/ui-tests-app/app/scroll-view/safe-area-images-overflow-page.xml
index 8d1bc6a09..d775a88cf 100644
--- a/apps/app/ui-tests-app/scroll-view/safe-area-images-overflow.xml
+++ b/e2e/ui-tests-app/app/scroll-view/safe-area-images-overflow-page.xml
@@ -3,15 +3,15 @@
-
+
-
+
-
+
diff --git a/apps/app/ui-tests-app/scroll-view/safe-area-images.xml b/e2e/ui-tests-app/app/scroll-view/safe-area-images-page.xml
similarity index 92%
rename from apps/app/ui-tests-app/scroll-view/safe-area-images.xml
rename to e2e/ui-tests-app/app/scroll-view/safe-area-images-page.xml
index 2e0864e42..4c8000fcd 100644
--- a/apps/app/ui-tests-app/scroll-view/safe-area-images.xml
+++ b/e2e/ui-tests-app/app/scroll-view/safe-area-images-page.xml
@@ -3,15 +3,15 @@
-
+
-
+
-
+
diff --git a/apps/app/ui-tests-app/scroll-view/safe-area-root-element.xml b/e2e/ui-tests-app/app/scroll-view/safe-area-root-element-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/scroll-view/safe-area-root-element.xml
rename to e2e/ui-tests-app/app/scroll-view/safe-area-root-element-page.xml
diff --git a/apps/app/ui-tests-app/scroll-view/safe-area-sub-element.xml b/e2e/ui-tests-app/app/scroll-view/safe-area-sub-element-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/scroll-view/safe-area-sub-element.xml
rename to e2e/ui-tests-app/app/scroll-view/safe-area-sub-element-page.xml
diff --git a/apps/app/ui-tests-app/scroll-view/scrolling-and-sizing.css b/e2e/ui-tests-app/app/scroll-view/scrolling-and-sizing-page.css
similarity index 100%
rename from apps/app/ui-tests-app/scroll-view/scrolling-and-sizing.css
rename to e2e/ui-tests-app/app/scroll-view/scrolling-and-sizing-page.css
diff --git a/apps/app/ui-tests-app/scroll-view/scrolling-and-sizing.xml b/e2e/ui-tests-app/app/scroll-view/scrolling-and-sizing-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/scroll-view/scrolling-and-sizing.xml
rename to e2e/ui-tests-app/app/scroll-view/scrolling-and-sizing-page.xml
diff --git a/apps/app/ui-tests-app/search-bar/issue-4147.css b/e2e/ui-tests-app/app/search-bar/issue-4147-page.css
similarity index 100%
rename from apps/app/ui-tests-app/search-bar/issue-4147.css
rename to e2e/ui-tests-app/app/search-bar/issue-4147-page.css
diff --git a/apps/app/ui-tests-app/search-bar/issue-4147.ts b/e2e/ui-tests-app/app/search-bar/issue-4147-page.ts
similarity index 100%
rename from apps/app/ui-tests-app/search-bar/issue-4147.ts
rename to e2e/ui-tests-app/app/search-bar/issue-4147-page.ts
diff --git a/apps/app/ui-tests-app/search-bar/issue-4147.xml b/e2e/ui-tests-app/app/search-bar/issue-4147-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/search-bar/issue-4147.xml
rename to e2e/ui-tests-app/app/search-bar/issue-4147-page.xml
diff --git a/apps/app/ui-tests-app/search-bar/issue-5039.ts b/e2e/ui-tests-app/app/search-bar/issue-5039-page.ts
similarity index 65%
rename from apps/app/ui-tests-app/search-bar/issue-5039.ts
rename to e2e/ui-tests-app/app/search-bar/issue-5039-page.ts
index 10942d892..ef3e6e8de 100644
--- a/apps/app/ui-tests-app/search-bar/issue-5039.ts
+++ b/e2e/ui-tests-app/app/search-bar/issue-5039-page.ts
@@ -1,9 +1,9 @@
-import { Issue5039ViewModel } from "./issue-5039-view-model"
+import { Issue5039ViewModel } from "./issue-5039-view-model";
import { SearchBar } from "tns-core-modules/ui/search-bar";
import { Page } from "tns-core-modules/ui/page";
export function navigatingTo(args) {
const page = args.object;
- const searchBar = page.getViewById("searchBar")
+ const searchBar = page.getViewById("searchBar");
page.bindingContext = new Issue5039ViewModel(searchBar);
}
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/search-bar/issue-5039.xml b/e2e/ui-tests-app/app/search-bar/issue-5039-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/search-bar/issue-5039.xml
rename to e2e/ui-tests-app/app/search-bar/issue-5039-page.xml
diff --git a/apps/app/ui-tests-app/search-bar/issue-5039-view-model.ts b/e2e/ui-tests-app/app/search-bar/issue-5039-view-model.ts
similarity index 63%
rename from apps/app/ui-tests-app/search-bar/issue-5039-view-model.ts
rename to e2e/ui-tests-app/app/search-bar/issue-5039-view-model.ts
index 0fb8a68bf..836f462fd 100644
--- a/apps/app/ui-tests-app/search-bar/issue-5039-view-model.ts
+++ b/e2e/ui-tests-app/app/search-bar/issue-5039-view-model.ts
@@ -1,15 +1,15 @@
-import { Observable } from "tns-core-modules/data/observable"
-import { ObservableArray } from "tns-core-modules/data/observable-array"
+import { Observable } from "tns-core-modules/data/observable";
+import { ObservableArray } from "tns-core-modules/data/observable-array";
import { SearchBar } from "tns-core-modules/ui/search-bar";
export class Issue5039ViewModel extends Observable {
- private _items = ["apple", "apple cider", "apple pie", "orange", "orange juice", "strawberry", "blueberry"]
- public items = new ObservableArray()
+ private _items = ["apple", "apple cider", "apple pie", "orange", "orange juice", "strawberry", "blueberry"];
+ public items = new ObservableArray();
constructor(private _searchBar: SearchBar) {
- super()
- this.items.push(this._items)
+ super();
+ this.items.push(this._items);
}
onSubmit() {
@@ -21,7 +21,7 @@ export class Issue5039ViewModel extends Observable {
}
filter(value: string = "") {
- this.items.splice(0, this.items.length) // remove all items
- this.items.push(this._items.filter(i => -1 !== i.indexOf(value)))
+ this.items.splice(0, this.items.length); // remove all items
+ this.items.push(this._items.filter(i => -1 !== i.indexOf(value)));
}
}
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/search-bar/issue-5655.xml b/e2e/ui-tests-app/app/search-bar/issue-5655-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/search-bar/issue-5655.xml
rename to e2e/ui-tests-app/app/search-bar/issue-5655-page.xml
diff --git a/apps/app/ui-tests-app/search-bar/main-page.ts b/e2e/ui-tests-app/app/search-bar/main-page.ts
similarity index 70%
rename from apps/app/ui-tests-app/search-bar/main-page.ts
rename to e2e/ui-tests-app/app/search-bar/main-page.ts
index 63577e10d..74063b0cc 100644
--- a/apps/app/ui-tests-app/search-bar/main-page.ts
+++ b/e2e/ui-tests-app/app/search-bar/main-page.ts
@@ -11,10 +11,10 @@ export function pageLoaded(args: EventData) {
export function loadExamples() {
const examples = new Map();
- examples.set("issue-4147", "search-bar/issue-4147");
- examples.set("search-bar", "search-bar/search-bar");
- examples.set("issue-5039", "search-bar/issue-5039");
- examples.set("issue-5655", "search-bar/issue-5655");
-
+ examples.set("issue-4147", "search-bar/issue-4147-page");
+ examples.set("search-bar", "search-bar/search-bar-page");
+ examples.set("issue-5039", "search-bar/issue-5039-page");
+ examples.set("issue-5655", "search-bar/issue-5655-page");
+
return examples;
}
diff --git a/apps/app/ui-tests-app/scroll-view/main-page.xml b/e2e/ui-tests-app/app/search-bar/main-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/scroll-view/main-page.xml
rename to e2e/ui-tests-app/app/search-bar/main-page.xml
diff --git a/apps/app/ui-tests-app/search-bar/search-bar.xml b/e2e/ui-tests-app/app/search-bar/search-bar-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/search-bar/search-bar.xml
rename to e2e/ui-tests-app/app/search-bar/search-bar-page.xml
diff --git a/e2e/ui-tests-app/app/segmented-bar/all-page.ts b/e2e/ui-tests-app/app/segmented-bar/all-page.ts
new file mode 100644
index 000000000..4d0a670a1
--- /dev/null
+++ b/e2e/ui-tests-app/app/segmented-bar/all-page.ts
@@ -0,0 +1,5 @@
+import * as frame from "tns-core-modules/ui/frame";
+
+export function navigate() {
+ frame.topmost().navigate("segmented-bar/clean-page");
+}
diff --git a/apps/app/ui-tests-app/segmented-bar/all.xml b/e2e/ui-tests-app/app/segmented-bar/all-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/segmented-bar/all.xml
rename to e2e/ui-tests-app/app/segmented-bar/all-page.xml
diff --git a/apps/app/ui-tests-app/segmented-bar/clean.ts b/e2e/ui-tests-app/app/segmented-bar/clean-page.ts
similarity index 72%
rename from apps/app/ui-tests-app/segmented-bar/clean.ts
rename to e2e/ui-tests-app/app/segmented-bar/clean-page.ts
index ebd7473b1..4d8281a74 100644
--- a/apps/app/ui-tests-app/segmented-bar/clean.ts
+++ b/e2e/ui-tests-app/app/segmented-bar/clean-page.ts
@@ -1,5 +1,5 @@
import * as frame from "tns-core-modules/ui/frame";
-export function navigate(args) {
+export function navigate() {
frame.topmost().goBack();
}
diff --git a/apps/app/ui-tests-app/segmented-bar/clean.xml b/e2e/ui-tests-app/app/segmented-bar/clean-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/segmented-bar/clean.xml
rename to e2e/ui-tests-app/app/segmented-bar/clean-page.xml
diff --git a/apps/app/ui-tests-app/sub-main-page-view-model.ts b/e2e/ui-tests-app/app/sub-main-page-view-model.ts
similarity index 100%
rename from apps/app/ui-tests-app/sub-main-page-view-model.ts
rename to e2e/ui-tests-app/app/sub-main-page-view-model.ts
diff --git a/apps/app/ui-tests-app/tab-view/all.xml b/e2e/ui-tests-app/app/tab-view/all-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/tab-view/all.xml
rename to e2e/ui-tests-app/app/tab-view/all-page.xml
diff --git a/apps/app/ui-tests-app/tab-view/background.xml b/e2e/ui-tests-app/app/tab-view/background-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/tab-view/background.xml
rename to e2e/ui-tests-app/app/tab-view/background-page.xml
diff --git a/apps/app/ui-tests-app/tab-view/color.xml b/e2e/ui-tests-app/app/tab-view/color-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/tab-view/color.xml
rename to e2e/ui-tests-app/app/tab-view/color-page.xml
diff --git a/apps/app/ui-tests-app/tab-view/icon-title-placement.xml b/e2e/ui-tests-app/app/tab-view/icon-title-placement-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/tab-view/icon-title-placement.xml
rename to e2e/ui-tests-app/app/tab-view/icon-title-placement-page.xml
diff --git a/apps/app/ui-tests-app/tab-view/issue-5470.xml b/e2e/ui-tests-app/app/tab-view/issue-5470-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/tab-view/issue-5470.xml
rename to e2e/ui-tests-app/app/tab-view/issue-5470-page.xml
diff --git a/apps/app/ui-tests-app/tab-view/main-page.ts b/e2e/ui-tests-app/app/tab-view/main-page.ts
similarity index 52%
rename from apps/app/ui-tests-app/tab-view/main-page.ts
rename to e2e/ui-tests-app/app/tab-view/main-page.ts
index 50f8dca5d..e4d15adcf 100644
--- a/apps/app/ui-tests-app/tab-view/main-page.ts
+++ b/e2e/ui-tests-app/app/tab-view/main-page.ts
@@ -10,23 +10,24 @@ export function pageLoaded(args: EventData) {
}
export function loadExamples() {
- const examples = new Map();
- examples.set("tabColor", "tab-view/color");
- examples.set("tabBG", "tab-view/background");
- examples.set("tabTabsBG", "tab-view/tabsBackground");
- examples.set("tabSelected", "tab-view/selected");
- examples.set("tabStyle", "tab-view/all");
- examples.set("tabmore", "tab-view/tab-view-more");
- examples.set("tabViewCss", "tab-view/tab-view-css");
- examples.set("tab-view-icons", "tab-view/tab-view-icon");
- examples.set("tab-view-icons-local", "tab-view/tab-view-icon-local");
- examples.set("tab-view-icon-change", "tab-view/tab-view-icon-change");
- examples.set("text-transform", "tab-view/text-transform");
- examples.set("tab-view-bottom-position", "tab-view/tab-view-bottom-position");
- examples.set("issue-5470", "tab-view/issue-5470");
- examples.set("tab-view-tab-text-font-size", "tab-view/tab-view-tab-text-font-size");
- examples.set("tab-view-android-swipe", "tab-view/tab-view-android-swipe");
- examples.set("tab-view-icon-title-placement", "tab-view/icon-title-placement");
- examples.set("tab-text-color", "tab-view/tab-text-color");
+ const examples = new Map();
+ examples.set("tabColor", "tab-view/color-page");
+ examples.set("tabBG", "tab-view/background-page");
+ examples.set("tabTabsBG", "tab-view/tabsBackground-page");
+ examples.set("tabSelected", "tab-view/selected-page");
+ examples.set("tabStyle", "tab-view/all-page");
+ examples.set("tabmore", "tab-view/tab-view-more-page");
+ examples.set("tabViewCss", "tab-view/tab-view-css-page");
+ examples.set("tab-view-icons", "tab-view/tab-view-icon-page");
+ examples.set("tab-view-icons-local", "tab-view/tab-view-icon-local-page");
+ examples.set("tab-view-icon-change", "tab-view/tab-view-icon-change-page");
+ examples.set("text-transform", "tab-view/text-transform-page");
+ examples.set("tab-view-bottom-position", "tab-view/tab-view-bottom-position-page");
+ examples.set("issue-5470", "tab-view/issue-5470-page");
+ examples.set("tab-view-tab-text-font-size", "tab-view/tab-view-tab-text-font-size-page");
+ examples.set("tab-view-android-swipe", "tab-view/tab-view-android-swipe-page");
+ examples.set("tab-view-icon-title-placement", "tab-view/icon-title-placement-page");
+ examples.set("tab-text-color", "tab-view/tab-text-color-page");
+
return examples;
}
diff --git a/apps/app/ui-tests-app/search-bar/main-page.xml b/e2e/ui-tests-app/app/tab-view/main-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/search-bar/main-page.xml
rename to e2e/ui-tests-app/app/tab-view/main-page.xml
diff --git a/apps/app/ui-tests-app/tab-view/nowrap.xml b/e2e/ui-tests-app/app/tab-view/nowrap-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/tab-view/nowrap.xml
rename to e2e/ui-tests-app/app/tab-view/nowrap-page.xml
diff --git a/apps/app/ui-tests-app/tab-view/selected.xml b/e2e/ui-tests-app/app/tab-view/selected-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/tab-view/selected.xml
rename to e2e/ui-tests-app/app/tab-view/selected-page.xml
diff --git a/apps/app/ui-tests-app/tab-view/tab-text-color.xml b/e2e/ui-tests-app/app/tab-view/tab-text-color-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/tab-view/tab-text-color.xml
rename to e2e/ui-tests-app/app/tab-view/tab-text-color-page.xml
diff --git a/apps/app/ui-tests-app/tab-view/tab-view-android-swipe.xml b/e2e/ui-tests-app/app/tab-view/tab-view-android-swipe-page.xml
similarity index 88%
rename from apps/app/ui-tests-app/tab-view/tab-view-android-swipe.xml
rename to e2e/ui-tests-app/app/tab-view/tab-view-android-swipe-page.xml
index 389c43127..b59aa523e 100644
--- a/apps/app/ui-tests-app/tab-view/tab-view-android-swipe.xml
+++ b/e2e/ui-tests-app/app/tab-view/tab-view-android-swipe-page.xml
@@ -1,4 +1,4 @@
-
+
diff --git a/apps/app/ui-tests-app/tab-view/tab-view-bottom-position.xml b/e2e/ui-tests-app/app/tab-view/tab-view-bottom-position-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/tab-view/tab-view-bottom-position.xml
rename to e2e/ui-tests-app/app/tab-view/tab-view-bottom-position-page.xml
diff --git a/apps/app/ui-tests-app/tab-view/tab-view-css.ts b/e2e/ui-tests-app/app/tab-view/tab-view-css-page.ts
similarity index 67%
rename from apps/app/ui-tests-app/tab-view/tab-view-css.ts
rename to e2e/ui-tests-app/app/tab-view/tab-view-css-page.ts
index 63b2739b6..d5239ff93 100644
--- a/apps/app/ui-tests-app/tab-view/tab-view-css.ts
+++ b/e2e/ui-tests-app/app/tab-view/tab-view-css-page.ts
@@ -1,6 +1,12 @@
import * as view from "tns-core-modules/ui/core/view";
import * as pages from "tns-core-modules/ui/page";
+export function loaded(args) {
+ var page = (args.object).page;
+ const view = page.getViewById("test-element");
+ (view).textTransform = "capitalize";
+}
+
export function applyTap(args) {
var page = (args.object).page;
var css = "#test-element { " + args.object.tag + " }";
diff --git a/apps/app/ui-tests-app/tab-view/tab-view-css.xml b/e2e/ui-tests-app/app/tab-view/tab-view-css-page.xml
similarity index 96%
rename from apps/app/ui-tests-app/tab-view/tab-view-css.xml
rename to e2e/ui-tests-app/app/tab-view/tab-view-css-page.xml
index 21f5fe7df..0e3510718 100644
--- a/apps/app/ui-tests-app/tab-view/tab-view-css.xml
+++ b/e2e/ui-tests-app/app/tab-view/tab-view-css-page.xml
@@ -1,5 +1,6 @@
+ xmlns="http://schemas.nativescript.org/tns.xsd"
+ loaded="loaded">
diff --git a/apps/app/ui-tests-app/tab-view/tab-view-icon-change.ts b/e2e/ui-tests-app/app/tab-view/tab-view-icon-change-page.ts
similarity index 79%
rename from apps/app/ui-tests-app/tab-view/tab-view-icon-change.ts
rename to e2e/ui-tests-app/app/tab-view/tab-view-icon-change-page.ts
index 6ebd0d4fb..b72993f93 100644
--- a/apps/app/ui-tests-app/tab-view/tab-view-icon-change.ts
+++ b/e2e/ui-tests-app/app/tab-view/tab-view-icon-change-page.ts
@@ -1,5 +1,3 @@
-import { EventData } from "tns-core-modules/data/observable";
-import { Button } from "tns-core-modules/ui/button";
import { TabView, SelectedIndexChangedEventData } from "tns-core-modules/ui/tab-view";
export function onSelectedIndexChanged(args: SelectedIndexChangedEventData) {
diff --git a/apps/app/ui-tests-app/tab-view/tab-view-icon-change.xml b/e2e/ui-tests-app/app/tab-view/tab-view-icon-change-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/tab-view/tab-view-icon-change.xml
rename to e2e/ui-tests-app/app/tab-view/tab-view-icon-change-page.xml
diff --git a/apps/app/ui-tests-app/tab-view/tab-view-icon-local.ts b/e2e/ui-tests-app/app/tab-view/tab-view-icon-local-page.ts
similarity index 100%
rename from apps/app/ui-tests-app/tab-view/tab-view-icon-local.ts
rename to e2e/ui-tests-app/app/tab-view/tab-view-icon-local-page.ts
diff --git a/apps/app/ui-tests-app/tab-view/tab-view-icon-local.xml b/e2e/ui-tests-app/app/tab-view/tab-view-icon-local-page.xml
similarity index 71%
rename from apps/app/ui-tests-app/tab-view/tab-view-icon-local.xml
rename to e2e/ui-tests-app/app/tab-view/tab-view-icon-local-page.xml
index 2db5fbf01..29b51ad2f 100644
--- a/apps/app/ui-tests-app/tab-view/tab-view-icon-local.xml
+++ b/e2e/ui-tests-app/app/tab-view/tab-view-icon-local-page.xml
@@ -1,22 +1,22 @@
-
+
-
+
-
+
-
+
diff --git a/apps/app/ui-tests-app/tab-view/tab-view-icon.ts b/e2e/ui-tests-app/app/tab-view/tab-view-icon-page.ts
similarity index 100%
rename from apps/app/ui-tests-app/tab-view/tab-view-icon.ts
rename to e2e/ui-tests-app/app/tab-view/tab-view-icon-page.ts
diff --git a/apps/app/ui-tests-app/tab-view/tab-view-icon.xml b/e2e/ui-tests-app/app/tab-view/tab-view-icon-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/tab-view/tab-view-icon.xml
rename to e2e/ui-tests-app/app/tab-view/tab-view-icon-page.xml
diff --git a/e2e/ui-tests-app/app/tab-view/tab-view-more-page.css b/e2e/ui-tests-app/app/tab-view/tab-view-more-page.css
new file mode 100644
index 000000000..134ca43e2
--- /dev/null
+++ b/e2e/ui-tests-app/app/tab-view/tab-view-more-page.css
@@ -0,0 +1,3 @@
+TabView {
+ font-size: 10;
+}
diff --git a/apps/app/ui-tests-app/tab-view/tab-view-more.xml b/e2e/ui-tests-app/app/tab-view/tab-view-more-page.xml
similarity index 95%
rename from apps/app/ui-tests-app/tab-view/tab-view-more.xml
rename to e2e/ui-tests-app/app/tab-view/tab-view-more-page.xml
index 748356f72..6ffd2eb52 100644
--- a/apps/app/ui-tests-app/tab-view/tab-view-more.xml
+++ b/e2e/ui-tests-app/app/tab-view/tab-view-more-page.xml
@@ -1,4 +1,4 @@
-
+
diff --git a/apps/app/ui-tests-app/tab-view/tab-view-tab-text-font-size.xml b/e2e/ui-tests-app/app/tab-view/tab-view-tab-text-font-size-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/tab-view/tab-view-tab-text-font-size.xml
rename to e2e/ui-tests-app/app/tab-view/tab-view-tab-text-font-size-page.xml
diff --git a/apps/app/ui-tests-app/tab-view/tabsBackground.xml b/e2e/ui-tests-app/app/tab-view/tabsBackground-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/tab-view/tabsBackground.xml
rename to e2e/ui-tests-app/app/tab-view/tabsBackground-page.xml
diff --git a/apps/app/ui-tests-app/tab-view/text-transform.ts b/e2e/ui-tests-app/app/tab-view/text-transform-page.ts
similarity index 99%
rename from apps/app/ui-tests-app/tab-view/text-transform.ts
rename to e2e/ui-tests-app/app/tab-view/text-transform-page.ts
index f83b87ba8..b6f73adb2 100644
--- a/apps/app/ui-tests-app/tab-view/text-transform.ts
+++ b/e2e/ui-tests-app/app/tab-view/text-transform-page.ts
@@ -5,7 +5,7 @@ const CSS = `
#tab2 { text-transform: lowercase; }
#tab3 { text-transform: uppercase; }
#tab4 { text-transform: capitalize; }
-`
+`;
export function applyTap(args) {
var page = args.object.page;
diff --git a/apps/app/ui-tests-app/tab-view/text-transform.xml b/e2e/ui-tests-app/app/tab-view/text-transform-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/tab-view/text-transform.xml
rename to e2e/ui-tests-app/app/tab-view/text-transform-page.xml
diff --git a/e2e/ui-tests-app/app/tabs/background-color-page.css b/e2e/ui-tests-app/app/tabs/background-color-page.css
new file mode 100644
index 000000000..6c53c0e65
--- /dev/null
+++ b/e2e/ui-tests-app/app/tabs/background-color-page.css
@@ -0,0 +1,7 @@
+Tabs {
+ background-color: gold;
+}
+
+TabStrip {
+ background-color: skyblue;
+}
\ No newline at end of file
diff --git a/e2e/ui-tests-app/app/tabs/background-color-page.xml b/e2e/ui-tests-app/app/tabs/background-color-page.xml
new file mode 100644
index 000000000..12860bc43
--- /dev/null
+++ b/e2e/ui-tests-app/app/tabs/background-color-page.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/e2e/ui-tests-app/app/tabs/color-page.xml b/e2e/ui-tests-app/app/tabs/color-page.xml
new file mode 100644
index 000000000..a0dfb57aa
--- /dev/null
+++ b/e2e/ui-tests-app/app/tabs/color-page.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/e2e/ui-tests-app/app/tabs/default-page.ts b/e2e/ui-tests-app/app/tabs/default-page.ts
new file mode 100644
index 000000000..50e5c8233
--- /dev/null
+++ b/e2e/ui-tests-app/app/tabs/default-page.ts
@@ -0,0 +1,17 @@
+import { EventData } from "tns-core-modules/data/observable";
+import { Page } from "tns-core-modules/ui/page";
+import { Tabs } from "tns-core-modules/ui/tabs";
+
+export function goToFirst(args: EventData) {
+ const page = (args.object).page;
+ const tabsNav = page.getViewById("tabsNav");
+
+ tabsNav.selectedIndex = 0;
+}
+
+export function goToSecond(args: EventData) {
+ const page = (args.object).page;
+ const tabsNav = page.getViewById("tabsNav");
+
+ tabsNav.selectedIndex = 1;
+}
diff --git a/apps/app/ui-tests-app/tabs/default.xml b/e2e/ui-tests-app/app/tabs/default-page.xml
similarity index 96%
rename from apps/app/ui-tests-app/tabs/default.xml
rename to e2e/ui-tests-app/app/tabs/default-page.xml
index 260450593..396478113 100644
--- a/apps/app/ui-tests-app/tabs/default.xml
+++ b/e2e/ui-tests-app/app/tabs/default-page.xml
@@ -1,6 +1,6 @@
-
+
@@ -18,7 +18,7 @@
-->
-
+
diff --git a/e2e/ui-tests-app/app/tabs/icon-change-page.ts b/e2e/ui-tests-app/app/tabs/icon-change-page.ts
new file mode 100644
index 000000000..1a466d6a6
--- /dev/null
+++ b/e2e/ui-tests-app/app/tabs/icon-change-page.ts
@@ -0,0 +1,15 @@
+import { Tabs, SelectedIndexChangedEventData } from "tns-core-modules/ui/tabs";
+
+export function onSelectedIndexChanged(args: SelectedIndexChangedEventData) {
+ const tabsNav = args.object;
+
+ const newItem = tabsNav.tabStrip.items[args.newIndex];
+ if (newItem) {
+ newItem.iconSource = "res://icon";
+ }
+
+ const oldItem = tabsNav.tabStrip.items[args.oldIndex];
+ if (oldItem) {
+ oldItem.iconSource = "res://testlogo";
+ }
+}
diff --git a/apps/app/ui-tests-app/bottom-navigation/icon-change.xml b/e2e/ui-tests-app/app/tabs/icon-change-page.xml
similarity index 62%
rename from apps/app/ui-tests-app/bottom-navigation/icon-change.xml
rename to e2e/ui-tests-app/app/tabs/icon-change-page.xml
index 4b77e353a..e6ddb809f 100644
--- a/apps/app/ui-tests-app/bottom-navigation/icon-change.xml
+++ b/e2e/ui-tests-app/app/tabs/icon-change-page.xml
@@ -1,8 +1,8 @@
-
-
+
+
-
+
@@ -19,5 +19,5 @@
-
+
\ No newline at end of file
diff --git a/e2e/ui-tests-app/app/tabs/icon-title-placement-page.xml b/e2e/ui-tests-app/app/tabs/icon-title-placement-page.xml
new file mode 100644
index 000000000..4caed0e7e
--- /dev/null
+++ b/e2e/ui-tests-app/app/tabs/icon-title-placement-page.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/bottom-navigation/issue-5470.xml b/e2e/ui-tests-app/app/tabs/issue-5470-page.xml
similarity index 85%
rename from apps/app/ui-tests-app/bottom-navigation/issue-5470.xml
rename to e2e/ui-tests-app/app/tabs/issue-5470-page.xml
index c1f8d3785..a47f48d18 100644
--- a/apps/app/ui-tests-app/bottom-navigation/issue-5470.xml
+++ b/e2e/ui-tests-app/app/tabs/issue-5470-page.xml
@@ -1,9 +1,9 @@
-
+
-
+
@@ -22,6 +22,6 @@
-
-
+
+
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/tabs/main-page.ts b/e2e/ui-tests-app/app/tabs/main-page.ts
similarity index 64%
rename from apps/app/ui-tests-app/tabs/main-page.ts
rename to e2e/ui-tests-app/app/tabs/main-page.ts
index 815c083ab..b7d492781 100644
--- a/apps/app/ui-tests-app/tabs/main-page.ts
+++ b/e2e/ui-tests-app/app/tabs/main-page.ts
@@ -11,12 +11,12 @@ export function pageLoaded(args: EventData) {
export function loadExamples() {
const examples = new Map();
- examples.set("bottom-navigation", "tabs/default");
- examples.set("issue-5470", "bottom-navigation/issue-5470");
- examples.set("background-color", "bottom-navigation/background-color");
- examples.set("color", "bottom-navigation/color");
- examples.set("icon-title-placement", "bottom-navigation/icon-title-placement");
- examples.set("icon-change", "bottom-navigation/icon-change");
+ examples.set("tabs", "tabs/tabs-page");
+ examples.set("issue-5470", "tabs/issue-5470");
+ examples.set("background-color", "tabs/background-color-page");
+ examples.set("color", "tabs/color");
+ examples.set("icon-title-placement", "tabs/icon-title-placement");
+ examples.set("icon-change", "tabs/icon-change");
examples.set("swipe-enabled", "tabs/swipe-enabled");
examples.set("tabs-position", "tabs/tabs-position");
diff --git a/apps/app/ui-tests-app/tab-view/main-page.xml b/e2e/ui-tests-app/app/tabs/main-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/tab-view/main-page.xml
rename to e2e/ui-tests-app/app/tabs/main-page.xml
diff --git a/apps/app/ui-tests-app/tabs/swipe-enabled.xml b/e2e/ui-tests-app/app/tabs/swipe-enabled-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/tabs/swipe-enabled.xml
rename to e2e/ui-tests-app/app/tabs/swipe-enabled-page.xml
diff --git a/e2e/ui-tests-app/app/tabs/tabs-page.ts b/e2e/ui-tests-app/app/tabs/tabs-page.ts
new file mode 100644
index 000000000..50e5c8233
--- /dev/null
+++ b/e2e/ui-tests-app/app/tabs/tabs-page.ts
@@ -0,0 +1,17 @@
+import { EventData } from "tns-core-modules/data/observable";
+import { Page } from "tns-core-modules/ui/page";
+import { Tabs } from "tns-core-modules/ui/tabs";
+
+export function goToFirst(args: EventData) {
+ const page = (args.object).page;
+ const tabsNav = page.getViewById("tabsNav");
+
+ tabsNav.selectedIndex = 0;
+}
+
+export function goToSecond(args: EventData) {
+ const page = (args.object).page;
+ const tabsNav = page.getViewById("tabsNav");
+
+ tabsNav.selectedIndex = 1;
+}
diff --git a/e2e/ui-tests-app/app/tabs/tabs-page.xml b/e2e/ui-tests-app/app/tabs/tabs-page.xml
new file mode 100644
index 000000000..396478113
--- /dev/null
+++ b/e2e/ui-tests-app/app/tabs/tabs-page.xml
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/apps/app/ui-tests-app/tabs/tabs-position.xml b/e2e/ui-tests-app/app/tabs/tabs-position-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/tabs/tabs-position.xml
rename to e2e/ui-tests-app/app/tabs/tabs-position-page.xml
diff --git a/apps/app/ui-tests-app/test-example-model.ts b/e2e/ui-tests-app/app/test-example-model.ts
similarity index 100%
rename from apps/app/ui-tests-app/test-example-model.ts
rename to e2e/ui-tests-app/app/test-example-model.ts
diff --git a/apps/app/ui-tests-app/test-page-main-view-model.ts b/e2e/ui-tests-app/app/test-page-main-view-model.ts
similarity index 77%
rename from apps/app/ui-tests-app/test-page-main-view-model.ts
rename to e2e/ui-tests-app/app/test-page-main-view-model.ts
index 84ce260cc..79f00b5fd 100644
--- a/apps/app/ui-tests-app/test-page-main-view-model.ts
+++ b/e2e/ui-tests-app/app/test-page-main-view-model.ts
@@ -9,23 +9,20 @@ import * as platform from "tns-core-modules/platform";
export class TestPageMainViewModel extends Observable {
private _colors = ["#0000cc", "#33cc33", "#0000cc"];
- public static APP_NAME: string = "ui-tests-app";
public basePath: string = "";
- public examples: Map = new Map();
- constructor(protected buttonsPanel: WrapLayout, private _examples: Map) {
+ constructor(protected buttonsPanel: WrapLayout, protected _examples: Map) {
super();
- this.examples = _examples;
if (this.shouldLoadBtns()) {
- this.sortMap(this.examples);
+ this.sortMap(this._examples);
this.loadButtons();
}
}
protected selectExample(selectedExample: any) {
console.log(" EXAMPLE: " + selectedExample);
- if (this.examples.has(selectedExample)) {
- this.navigateToExample(this.examples.get(selectedExample));
+ if (this._examples.has(selectedExample)) {
+ this.navigateToExample(this._examples.get(selectedExample));
} else if (selectedExample.indexOf("/") > 0) {
this.navigateToExample(selectedExample);
}
@@ -33,10 +30,11 @@ export class TestPageMainViewModel extends Observable {
protected navigateToExample(exampleFullPath: string) {
try {
- frame.topmost().navigate(TestPageMainViewModel.APP_NAME + "/" + exampleFullPath);
+ frame.topmost().navigate(exampleFullPath);
} catch (error) {
console.log("EXAMPLE LOAD FAILED:" + error);
alert("Cannot find example: " + exampleFullPath);
+
}
}
@@ -52,7 +50,7 @@ export class TestPageMainViewModel extends Observable {
private loadButtons() {
var count = 0;
- this.examples.forEach((element, key) => {
+ this._examples.forEach((element, key) => {
var btn = new Button();
if (platform.isAndroid) {
btn.style.height = 25;
@@ -73,7 +71,8 @@ export class TestPageMainViewModel extends Observable {
}, this);
btn.text = key;
- this.buttonsPanel.addChild(btn)
+ btn.automationText = key;
+ this.buttonsPanel.addChild(btn);
});
}
@@ -81,7 +80,7 @@ export class TestPageMainViewModel extends Observable {
let arrayOfKeys = new Array();
map.forEach((value, key, map) => {
arrayOfKeys.push(key);
- })
+ });
arrayOfKeys.sort((a, b) => {
if (a < b) {
@@ -90,15 +89,16 @@ export class TestPageMainViewModel extends Observable {
if (a > b) {
return 1;
}
+
return a.localeCompare(b);
- })
+ });
let sortedExamples = new Map();
arrayOfKeys.forEach((k) => {
- sortedExamples.set(k, this.examples.get(k));
- })
+ sortedExamples.set(k, this._examples.get(k));
+ });
- this.examples.clear();
- this.examples = sortedExamples;
+ this._examples.clear();
+ this._examples = sortedExamples;
}
}
diff --git a/apps/app/ui-tests-app/text-field/focus-blur-events.ts b/e2e/ui-tests-app/app/text-field/focus-blur-events-page.ts
similarity index 100%
rename from apps/app/ui-tests-app/text-field/focus-blur-events.ts
rename to e2e/ui-tests-app/app/text-field/focus-blur-events-page.ts
diff --git a/apps/app/ui-tests-app/text-field/focus-blur-events.xml b/e2e/ui-tests-app/app/text-field/focus-blur-events-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/text-field/focus-blur-events.xml
rename to e2e/ui-tests-app/app/text-field/focus-blur-events-page.xml
diff --git a/apps/app/ui-tests-app/text-field/main-page.ts b/e2e/ui-tests-app/app/text-field/main-page.ts
similarity index 88%
rename from apps/app/ui-tests-app/text-field/main-page.ts
rename to e2e/ui-tests-app/app/text-field/main-page.ts
index 96188dff4..c07d35c01 100644
--- a/apps/app/ui-tests-app/text-field/main-page.ts
+++ b/e2e/ui-tests-app/app/text-field/main-page.ts
@@ -11,10 +11,10 @@ export function pageLoaded(args: EventData) {
export function loadExamples() {
const examples = new Map();
- examples.set("secured-text-field", "text-field/secured-text-field-4135");
- examples.set("max-length", "text-field/max-length");
- examples.set("text-field-border", "text-field/text-field-border");
- examples.set("focus-blur-events", "text-field/focus-blur-events");
+ examples.set("secured-text-field", "text-field/secured-text-field-4135-page");
+ examples.set("max-length", "text-field/max-length-page");
+ examples.set("text-field-border", "text-field/text-field-border-page");
+ examples.set("focus-blur-events", "text-field/focus-blur-events-page");
return examples;
}
diff --git a/apps/app/ui-tests-app/tabs/main-page.xml b/e2e/ui-tests-app/app/text-field/main-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/tabs/main-page.xml
rename to e2e/ui-tests-app/app/text-field/main-page.xml
diff --git a/apps/app/ui-tests-app/text-field/max-length.ts b/e2e/ui-tests-app/app/text-field/max-length-page.ts
similarity index 100%
rename from apps/app/ui-tests-app/text-field/max-length.ts
rename to e2e/ui-tests-app/app/text-field/max-length-page.ts
diff --git a/apps/app/ui-tests-app/text-field/max-length.xml b/e2e/ui-tests-app/app/text-field/max-length-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/text-field/max-length.xml
rename to e2e/ui-tests-app/app/text-field/max-length-page.xml
diff --git a/apps/app/ui-tests-app/text-field/secured-text-field-4135.ts b/e2e/ui-tests-app/app/text-field/secured-text-field-4135-page.ts
similarity index 100%
rename from apps/app/ui-tests-app/text-field/secured-text-field-4135.ts
rename to e2e/ui-tests-app/app/text-field/secured-text-field-4135-page.ts
diff --git a/apps/app/ui-tests-app/text-field/secured-text-field-4135.xml b/e2e/ui-tests-app/app/text-field/secured-text-field-4135-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/text-field/secured-text-field-4135.xml
rename to e2e/ui-tests-app/app/text-field/secured-text-field-4135-page.xml
diff --git a/apps/app/ui-tests-app/text-field/text-field-border.css b/e2e/ui-tests-app/app/text-field/text-field-border-page.css
similarity index 94%
rename from apps/app/ui-tests-app/text-field/text-field-border.css
rename to e2e/ui-tests-app/app/text-field/text-field-border-page.css
index aa14a46db..76cabbf0d 100644
--- a/apps/app/ui-tests-app/text-field/text-field-border.css
+++ b/e2e/ui-tests-app/app/text-field/text-field-border-page.css
@@ -65,7 +65,7 @@ TextField {
}
#s15 {
- border-width: 5 10 15 20; border-color: red green blue yellow; background-image: url('~/ui-tests-app/resources/images/test2.png');
+ border-width: 5 10 15 20; border-color: red green blue yellow; background-image: url('~/resources/images/test2.png');
}
#s16 {
diff --git a/apps/app/ui-tests-app/text-field/text-field-border.xml b/e2e/ui-tests-app/app/text-field/text-field-border-page.xml
similarity index 96%
rename from apps/app/ui-tests-app/text-field/text-field-border.xml
rename to e2e/ui-tests-app/app/text-field/text-field-border-page.xml
index 7302a4dde..61e08511c 100644
--- a/apps/app/ui-tests-app/text-field/text-field-border.xml
+++ b/e2e/ui-tests-app/app/text-field/text-field-border-page.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/apps/app/ui-tests-app/text-view/hint-text-color.ts b/e2e/ui-tests-app/app/text-view/hint-text-color-page.ts
similarity index 94%
rename from apps/app/ui-tests-app/text-view/hint-text-color.ts
rename to e2e/ui-tests-app/app/text-view/hint-text-color-page.ts
index 1c8d525ec..701548e1e 100644
--- a/apps/app/ui-tests-app/text-view/hint-text-color.ts
+++ b/e2e/ui-tests-app/app/text-view/hint-text-color-page.ts
@@ -3,30 +3,31 @@ import { unsetValue } from "tns-core-modules/ui/core/view";
import { TextView } from "tns-core-modules/ui/text-view";
import { TextField } from "tns-core-modules/ui/text-field";
-function exectuteOnAll(page: Page, callback: (txt: TextView | TextField) => void) {
+function exectuteOnAll(page: Page, callback: (txt: TextView | TextField) => void) {
page.getViewById("container").eachChild((child) => {
if (child instanceof TextView || child instanceof TextField) {
callback(child);
}
+
return true;
- })
+ });
}
export function setText(args) {
exectuteOnAll(args.object.page, (txt) => {
txt.text = "set text";
- })
+ });
}
export function resetStyles(args) {
exectuteOnAll(args.object.page, (txt) => {
txt.style.color = unsetValue;
txt.style.placeholderColor = unsetValue;
- })
+ });
}
export function resetText(args) {
exectuteOnAll(args.object.page, (txt) => {
txt.text = "";
- })
+ });
}
diff --git a/apps/app/ui-tests-app/text-view/hint-text-color.xml b/e2e/ui-tests-app/app/text-view/hint-text-color-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/text-view/hint-text-color.xml
rename to e2e/ui-tests-app/app/text-view/hint-text-color-page.xml
diff --git a/apps/app/ui-tests-app/text-view/main-page.ts b/e2e/ui-tests-app/app/text-view/main-page.ts
similarity index 87%
rename from apps/app/ui-tests-app/text-view/main-page.ts
rename to e2e/ui-tests-app/app/text-view/main-page.ts
index 3581cc0ba..48ce1ef21 100644
--- a/apps/app/ui-tests-app/text-view/main-page.ts
+++ b/e2e/ui-tests-app/app/text-view/main-page.ts
@@ -11,9 +11,10 @@ export function pageLoaded(args: EventData) {
export function loadExamples() {
const examples = new Map();
- examples.set("text-view-border", "text-view/text-view-border");
- examples.set("text-view-hint-color", "text-view/text-view-hint-color");
- examples.set("hint-text-color", "text-view/hint-text-color");
- examples.set("scrolling-and-sizing", "text-view/scrolling-and-sizing");
+ examples.set("text-view-border", "text-view/text-view-border-page");
+ examples.set("text-view-hint-color", "text-view/text-view-hint-color-page");
+ examples.set("hint-text-color", "text-view/hint-text-color-page");
+ examples.set("scrolling-and-sizing", "text-view/scrolling-and-sizing-page");
+
return examples;
-}
\ No newline at end of file
+}
diff --git a/apps/app/ui-tests-app/text-field/main-page.xml b/e2e/ui-tests-app/app/text-view/main-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/text-field/main-page.xml
rename to e2e/ui-tests-app/app/text-view/main-page.xml
diff --git a/apps/app/ui-tests-app/text-view/scrolling-and-sizing.css b/e2e/ui-tests-app/app/text-view/scrolling-and-sizing-page.css
similarity index 100%
rename from apps/app/ui-tests-app/text-view/scrolling-and-sizing.css
rename to e2e/ui-tests-app/app/text-view/scrolling-and-sizing-page.css
diff --git a/apps/app/ui-tests-app/text-view/scrolling-and-sizing.xml b/e2e/ui-tests-app/app/text-view/scrolling-and-sizing-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/text-view/scrolling-and-sizing.xml
rename to e2e/ui-tests-app/app/text-view/scrolling-and-sizing-page.xml
diff --git a/apps/app/ui-tests-app/text-view/text-view-border.css b/e2e/ui-tests-app/app/text-view/text-view-border-page.css
similarity index 94%
rename from apps/app/ui-tests-app/text-view/text-view-border.css
rename to e2e/ui-tests-app/app/text-view/text-view-border-page.css
index a2b4c3a93..d12f4c9fb 100644
--- a/apps/app/ui-tests-app/text-view/text-view-border.css
+++ b/e2e/ui-tests-app/app/text-view/text-view-border-page.css
@@ -65,7 +65,7 @@ TextView {
}
#s15 {
- border-width: 5 10 15 20; border-color: red green blue yellow; background-image: url('~/ui-tests-app/resources/images/test2.png');
+ border-width: 5 10 15 20; border-color: red green blue yellow; background-image: url('~/resources/images/test2.png');
}
#s16 {
diff --git a/apps/app/ui-tests-app/text-view/text-view-border.xml b/e2e/ui-tests-app/app/text-view/text-view-border-page.xml
similarity index 96%
rename from apps/app/ui-tests-app/text-view/text-view-border.xml
rename to e2e/ui-tests-app/app/text-view/text-view-border-page.xml
index 8b3ab0e9f..83f8cdc26 100644
--- a/apps/app/ui-tests-app/text-view/text-view-border.xml
+++ b/e2e/ui-tests-app/app/text-view/text-view-border-page.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/apps/app/ui-tests-app/text-view/text-view-hint-color.ts b/e2e/ui-tests-app/app/text-view/text-view-hint-color-page.ts
similarity index 100%
rename from apps/app/ui-tests-app/text-view/text-view-hint-color.ts
rename to e2e/ui-tests-app/app/text-view/text-view-hint-color-page.ts
diff --git a/apps/app/ui-tests-app/text-view/text-view-hint-color.xml b/e2e/ui-tests-app/app/text-view/text-view-hint-color-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/text-view/text-view-hint-color.xml
rename to e2e/ui-tests-app/app/text-view/text-view-hint-color-page.xml
diff --git a/apps/app/ui-tests-app/time-picker/time-picker.xml b/e2e/ui-tests-app/app/time-picker/time-picker-page.xml
similarity index 92%
rename from apps/app/ui-tests-app/time-picker/time-picker.xml
rename to e2e/ui-tests-app/app/time-picker/time-picker-page.xml
index e17ad108e..179900eb4 100644
--- a/apps/app/ui-tests-app/time-picker/time-picker.xml
+++ b/e2e/ui-tests-app/app/time-picker/time-picker-page.xml
@@ -1,3 +1,3 @@
-
\ No newline at end of file
+
diff --git a/e2e/ui-tests-app/app/web-view/main-page.ts b/e2e/ui-tests-app/app/web-view/main-page.ts
new file mode 100644
index 000000000..8cdb4cf54
--- /dev/null
+++ b/e2e/ui-tests-app/app/web-view/main-page.ts
@@ -0,0 +1,19 @@
+import { EventData } from "tns-core-modules/data/observable";
+import { SubMainPageViewModel } from "../sub-main-page-view-model";
+import { WrapLayout } from "tns-core-modules/ui/layouts/wrap-layout";
+import { Page } from "tns-core-modules/ui/page";
+
+export function pageLoaded(args: EventData) {
+ const page = args.object;
+ const wrapLayout = page.getViewById("wrapLayoutWithExamples");
+ page.bindingContext = new SubMainPageViewModel(wrapLayout, loadExamples());
+}
+
+export function loadExamples() {
+ const examples = new Map();
+ examples.set("webview", "web-view/web-view-page");
+ examples.set("webtest", "web-view/web-view-test-page");
+ examples.set("query", "web-view/query-params-page");
+
+ return examples;
+}
diff --git a/apps/app/ui-tests-app/text-view/main-page.xml b/e2e/ui-tests-app/app/web-view/main-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/text-view/main-page.xml
rename to e2e/ui-tests-app/app/web-view/main-page.xml
diff --git a/apps/app/ui-tests-app/web-view/query-params.ts b/e2e/ui-tests-app/app/web-view/query-params-page.ts
similarity index 60%
rename from apps/app/ui-tests-app/web-view/query-params.ts
rename to e2e/ui-tests-app/app/web-view/query-params-page.ts
index 4034634c9..58cd94969 100644
--- a/apps/app/ui-tests-app/web-view/query-params.ts
+++ b/e2e/ui-tests-app/app/web-view/query-params-page.ts
@@ -6,9 +6,9 @@ export function webViewLoaded(args) {
webView = args.object;
}
-const relUrl = "~/ui-tests-app/web-view/query.html" + "?foo=bar&urlType=relative";
-const absoluteUrl = `${fs.knownFolders.currentApp().path}/ui-tests-app/web-view/query.html` + "?foo=bar&urlType=absolute";
-const fileUrl = `file:///${fs.knownFolders.currentApp().path}/ui-tests-app/web-view/query.html` + "?foo=bar&urlType=filePrefix";
+const relUrl = "~/web-view/query.html" + "?foo=bar&urlType=relative";
+const absoluteUrl = `${fs.knownFolders.currentApp().path}/web-view/query.html` + "?foo=bar&urlType=absolute";
+const fileUrl = `file:///${fs.knownFolders.currentApp().path}/web-view/query.html` + "?foo=bar&urlType=filePrefix";
const htmlString = `
Test Page
@@ -20,19 +20,19 @@ const htmlString = `
`;
export function loadRelative() {
- setSrc(relUrl)
+ setSrc(relUrl);
}
export function loadAbsolute() {
- setSrc(absoluteUrl)
+ setSrc(absoluteUrl);
}
export function loadFile() {
- setSrc(fileUrl)
+ setSrc(fileUrl);
}
export function loadString() {
- setSrc(htmlString)
+ setSrc(htmlString);
}
function setSrc(src) {
console.log("Setting src to: " + src);
webView.src = src;
-}
\ No newline at end of file
+}
diff --git a/apps/app/ui-tests-app/web-view/query-params.xml b/e2e/ui-tests-app/app/web-view/query-params-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/web-view/query-params.xml
rename to e2e/ui-tests-app/app/web-view/query-params-page.xml
diff --git a/apps/app/ui-tests-app/web-view/query.html b/e2e/ui-tests-app/app/web-view/query.html
similarity index 100%
rename from apps/app/ui-tests-app/web-view/query.html
rename to e2e/ui-tests-app/app/web-view/query.html
diff --git a/apps/app/ui-tests-app/web-view/test.css b/e2e/ui-tests-app/app/web-view/test.css
similarity index 100%
rename from apps/app/ui-tests-app/web-view/test.css
rename to e2e/ui-tests-app/app/web-view/test.css
diff --git a/apps/app/ui-tests-app/web-view/test.html b/e2e/ui-tests-app/app/web-view/test.html
similarity index 77%
rename from apps/app/ui-tests-app/web-view/test.html
rename to e2e/ui-tests-app/app/web-view/test.html
index f3daf0bd7..6c6d05fe0 100644
--- a/apps/app/ui-tests-app/web-view/test.html
+++ b/e2e/ui-tests-app/app/web-view/test.html
@@ -3,7 +3,7 @@
MyTitle
-
+
Test
diff --git a/apps/app/ui-tests-app/web-view/web-view-error.ts b/e2e/ui-tests-app/app/web-view/web-view-error-page.ts
similarity index 100%
rename from apps/app/ui-tests-app/web-view/web-view-error.ts
rename to e2e/ui-tests-app/app/web-view/web-view-error-page.ts
diff --git a/apps/app/ui-tests-app/web-view/web-view-error.xml b/e2e/ui-tests-app/app/web-view/web-view-error-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/web-view/web-view-error.xml
rename to e2e/ui-tests-app/app/web-view/web-view-error-page.xml
diff --git a/apps/app/ui-tests-app/web-view/web-view.ts b/e2e/ui-tests-app/app/web-view/web-view-page.ts
similarity index 100%
rename from apps/app/ui-tests-app/web-view/web-view.ts
rename to e2e/ui-tests-app/app/web-view/web-view-page.ts
diff --git a/apps/app/ui-tests-app/web-view/web-view.xml b/e2e/ui-tests-app/app/web-view/web-view-page.xml
similarity index 100%
rename from apps/app/ui-tests-app/web-view/web-view.xml
rename to e2e/ui-tests-app/app/web-view/web-view-page.xml
diff --git a/apps/app/ui-tests-app/web-view/web-view-test.xml b/e2e/ui-tests-app/app/web-view/web-view-test-page.xml
similarity index 54%
rename from apps/app/ui-tests-app/web-view/web-view-test.xml
rename to e2e/ui-tests-app/app/web-view/web-view-test-page.xml
index 13e0e1586..919474df4 100644
--- a/apps/app/ui-tests-app/web-view/web-view-test.xml
+++ b/e2e/ui-tests-app/app/web-view/web-view-test-page.xml
@@ -1,15 +1,15 @@
-
+
-
-
-
+
+
+
-
+
diff --git a/e2e/ui-tests-app/e2e/helpers/image-helper.ts b/e2e/ui-tests-app/e2e/helpers/image-helper.ts
new file mode 100644
index 000000000..aeee5e43e
--- /dev/null
+++ b/e2e/ui-tests-app/e2e/helpers/image-helper.ts
@@ -0,0 +1,6 @@
+
+export const setImageName = (suite: string, spec: string, testsName: string) => {
+ const testName = `${suite}-${spec}-${testsName.replace(suite, "").replace(spec, "")}`.replace(/(\-+)/ig, "-").replace(/(\_+)/ig, "_");
+
+ return testName;
+};
\ No newline at end of file
diff --git a/e2e/ui-tests-app/e2e/helpers/navigation-helper.ts b/e2e/ui-tests-app/e2e/helpers/navigation-helper.ts
new file mode 100644
index 000000000..5125d8cc6
--- /dev/null
+++ b/e2e/ui-tests-app/e2e/helpers/navigation-helper.ts
@@ -0,0 +1,120 @@
+import { AppiumDriver, IRectangle, logInfo } from "nativescript-dev-appium";
+
+export enum ElementCacheStrategy {
+ allAtOnce,
+ onload,
+ none,
+}
+
+export interface ICachedElement {
+ name: string;
+ children: Map;
+ parent?: ICachedElement;
+ rect?: IRectangle;
+}
+
+export class NavigationHelper {
+
+ private _cachedElements: ICachedElement;
+ private _currentSuite: ICachedElement;
+
+ constructor(protected _driver: AppiumDriver, protected _suitMainPageNavigationLinks: Array, private _elemtsCacheStrategy: ElementCacheStrategy = ElementCacheStrategy.onload) {
+ }
+
+ async initSuite() {
+ if (this._elemtsCacheStrategy === ElementCacheStrategy.allAtOnce
+ || this._elemtsCacheStrategy === ElementCacheStrategy.onload) {
+ if (this._currentSuite) {
+ while (this._currentSuite.parent) {
+ this._currentSuite = this._currentSuite.parent;
+ }
+ } else {
+ if (!this._cachedElements || this._cachedElements.children.size === 0) {
+ this._cachedElements = { name: "initSuite", children: new Map() };
+ if (this._elemtsCacheStrategy === ElementCacheStrategy.allAtOnce) {
+ await this.cacheAllElements(this._cachedElements);
+ }
+ }
+
+ this._currentSuite = this._cachedElements;
+ }
+ }
+
+ await this.navigateToSuitMainPage();
+ }
+
+ async endSuite() {
+ logInfo("End of suit 'button' tests!");
+ await this._driver.takeScreenshot("end_button_suit");
+ }
+
+ async navigateToSuitMainPage() {
+ for (let index = 0; index < this._suitMainPageNavigationLinks.length; index++) {
+ const mainPage = this._suitMainPageNavigationLinks[index];
+ await this.navigateToSample(mainPage);
+ }
+ }
+
+ async navigateToSample(sample: string) {
+ logInfo(`Navigate to ${sample}`);
+ sample = sample.toLowerCase();
+ if (this._elemtsCacheStrategy === ElementCacheStrategy.allAtOnce) {
+ if (!this._currentSuite.children.has(sample)) {
+ await this.cacheAllElements(this._currentSuite);
+ }
+ if (!this._currentSuite.children.has(sample)) {
+ throw new Error(`Could not find ${sample}`);
+ }
+ const sampleElement = this._currentSuite.children.get(sample).rect;
+ await this._driver.clickPoint(sampleElement.x + (sampleElement.width / 2), sampleElement.y + (sampleElement.height / 2));
+ this._currentSuite = this._currentSuite.children.get(sample);
+ } else if (this._elemtsCacheStrategy === ElementCacheStrategy.onload) {
+ if (this._currentSuite.children.has(sample)) {
+ const sampleElement = this._currentSuite.children.get(sample).rect;
+ await this._driver.clickPoint(sampleElement.x + (sampleElement.width / 2), sampleElement.y + (sampleElement.height / 2));
+ this._currentSuite = this._currentSuite.children.get(sample);
+ } else {
+ const sampleElement = await this._driver.waitForElement(sample);
+ if (!sampleElement) {
+ throw new Error(`Could not find ${sample}`);
+ }
+ const rect = await sampleElement.getRectangle();
+ const text = (await sampleElement.text()).toLowerCase();
+ const newSuite: ICachedElement = { name: text, rect: rect, children: new Map(), parent: this._currentSuite };
+ this._currentSuite.children.set(sample, newSuite);
+ this._currentSuite = newSuite;
+ await this._driver.clickPoint(rect.x + (rect.width / 2), rect.y + (rect.height / 2));
+ }
+ } else {
+ const sampleElement = await this._driver.waitForElement(sample);
+ await sampleElement.click();
+ }
+ }
+
+ async navigateBackToSuitMainPage() {
+ logInfo(`Navigate to back`);
+ if (this._elemtsCacheStrategy === ElementCacheStrategy.allAtOnce
+ || this._elemtsCacheStrategy === ElementCacheStrategy.onload) {
+ this._currentSuite = this._currentSuite && this._currentSuite.parent;
+ }
+ await this._driver.navBack();
+ }
+
+ async swipeBackToSuitMainPage() {
+ logInfo(`Swipe to back`);
+ throw new Error("Not implemented!");
+ }
+
+ private async cacheAllElements(cachedElements: ICachedElement) {
+ const allSamples = await this._driver.findElementsByClassName(this._driver.locators.button);
+ for (let index = 0; index < allSamples.length; index++) {
+ const element = allSamples[index];
+ const rect = await element.getRectangle();
+ const text = (await element.text()).toLowerCase();
+ if (!cachedElements.children.has(text)) {
+ console.log(text);
+ cachedElements.children.set(text, { parent: cachedElements, name: text, rect: rect, children: new Map() });
+ }
+ }
+ }
+}
diff --git a/e2e/ui-tests-app/e2e/page-object-base-model.ts b/e2e/ui-tests-app/e2e/page-object-base-model.ts
new file mode 100644
index 000000000..ecddbde85
--- /dev/null
+++ b/e2e/ui-tests-app/e2e/page-object-base-model.ts
@@ -0,0 +1,36 @@
+import { AppiumDriver, logInfo } from "nativescript-dev-appium";
+import { NavigationHelper, ElementCacheStrategy } from "./helpers/navigation-helper";
+
+export abstract class PageObjectBaseModel {
+
+ public navigationHelper: NavigationHelper;
+
+ constructor(protected _driver: AppiumDriver, protected _naviagtionLinks: Array, elementCacheStrategy: ElementCacheStrategy = ElementCacheStrategy.none) {
+ this.navigationHelper = new NavigationHelper(this._driver, this._naviagtionLinks, elementCacheStrategy);
+ }
+
+ async initSuite() {
+ await this.navigationHelper.initSuite();
+ }
+
+ async endSuite() {
+ const suiteName = this._naviagtionLinks.join("-");
+ logInfo(`End of suit ${suiteName} tests!`);
+ }
+
+ async navigateToSuitMainPage() {
+ await this.navigationHelper.navigateBackToSuitMainPage();
+ }
+
+ async navigateToSample(sample: string) {
+ await this.navigationHelper.navigateToSample(sample);
+ }
+
+ async navigateBackToSuitMainPage() {
+ await this.navigationHelper.navigateBackToSuitMainPage();
+ }
+
+ async swipeBackToSuitMainPage() {
+ await this.navigationHelper.swipeBackToSuitMainPage();
+ }
+}
\ No newline at end of file
diff --git a/e2e/ui-tests-app/e2e/resources/images/uitestsapp b/e2e/ui-tests-app/e2e/resources/images/uitestsapp
new file mode 120000
index 000000000..2ae4132a5
--- /dev/null
+++ b/e2e/ui-tests-app/e2e/resources/images/uitestsapp
@@ -0,0 +1 @@
+/Users/tsenov/git/nativescript/e2e/ui-tests-app/../../../functional-tests-images/uitestsapp
\ No newline at end of file
diff --git a/e2e/ui-tests-app/e2e/scripts/sparse-checkout.sh b/e2e/ui-tests-app/e2e/scripts/sparse-checkout.sh
new file mode 100755
index 000000000..49afe395b
--- /dev/null
+++ b/e2e/ui-tests-app/e2e/scripts/sparse-checkout.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+app_name="$1" r_url="$2" local_dir="$3" && shift 3
+
+echo $app_name
+cwd=${PWD}
+echo "r_url: ${r_url}"
+echo "local_dir: ${local_dir}"
+rm -rf ${PWD}/e2e/resources/*
+mkdir -p ${PWD}/e2e/resources/images
+
+(
+ if [ -d "$local_dir" ]; then
+ echo "Extend repository"
+ cd "$local_dir"
+ else
+ mkdir -p "$local_dir"
+ cd "$local_dir"
+ git init
+ git remote add origin "$r_url"
+ fi
+
+ echo ${PWD}
+
+ git config core.sparseCheckout true
+
+ # Loops over remaining args
+ rm -rf .git/info/sparse-checkout || true
+ for i; do
+ echo "$app_name/$i" >> .git/info/sparse-checkout
+ done
+ echo "scripts" >> .git/info/sparse-checkout
+ cat .git/info/sparse-checkout
+ git read-tree -mu HEAD
+ git pull --depth=1 origin master -f
+)
+
+cd "${cwd}"
+ln -s "$local_dir/$app_name" "${cwd}/e2e/resources/images/" || true
diff --git a/e2e/ui-tests-app/e2e/setup.ts b/e2e/ui-tests-app/e2e/setup.ts
new file mode 100644
index 000000000..d53599331
--- /dev/null
+++ b/e2e/ui-tests-app/e2e/setup.ts
@@ -0,0 +1,19 @@
+import { startServer, stopServer, ITestReporter, nsCapabilities, LogImageType } from "nativescript-dev-appium";
+const addContext = require("mochawesome/addContext");
+
+const testReporterContext = {};
+testReporterContext.name = "mochawesome";
+testReporterContext.reportDir = "mochawesome-report";
+testReporterContext.log = addContext;
+testReporterContext.logImageTypes = [LogImageType.screenshots];
+nsCapabilities.testReporter = testReporterContext;
+
+before("start server", async function () {
+ nsCapabilities.testReporter.context = this;
+ await startServer();
+});
+
+after("stop server", async function () {
+ nsCapabilities.testReporter.context = this;
+ await stopServer();
+});
diff --git a/e2e/ui-tests-app/e2e/suites/button/background/button-background-page.ts b/e2e/ui-tests-app/e2e/suites/button/background/button-background-page.ts
new file mode 100644
index 000000000..c972c0e29
--- /dev/null
+++ b/e2e/ui-tests-app/e2e/suites/button/background/button-background-page.ts
@@ -0,0 +1,52 @@
+import { AppiumDriver, logInfo, logError } from "nativescript-dev-appium";
+import { Platform } from "mobile-devices-controller";
+import { PageObjectBaseModel } from "../../../page-object-base-model";
+import { ElementCacheStrategy } from "../../../helpers/navigation-helper";
+import { assert } from "chai";
+export class ButtonBackgroundPage extends PageObjectBaseModel {
+
+ constructor(_driver: AppiumDriver) {
+ super(_driver, ["button", "background"], ElementCacheStrategy.none);
+ }
+
+ public viewGroupLocator() {
+ if (this._driver.nsCapabilities.device.platform === Platform.ANDROID) {
+ return this._driver.nsCapabilities.device.releaseVersion > 5.1 ? "android.view.ViewGroup" : "android.view.View";
+ } else {
+ throw new Error("Not implemented locator");
+ }
+ }
+
+ async testElement() {
+ return this._driver.waitForElement("test-element");
+ }
+
+ async btnReset() {
+ return this._driver.waitForElement("r");
+ }
+
+ async tapResetBtn() {
+ await (await this.btnReset()).click();
+ logInfo("Tap on 'Reset' button.");
+ }
+
+ async tapBtn(button: string) {
+ await (await this._driver.waitForElement(button)).click();
+ logInfo(`Tap on "${button}" button.`);
+ }
+
+ async loaded() {
+ if (await this.btnReset() != null) {
+ logInfo("Background page loaded.");
+ } else {
+ logError("Background page NOT loaded.");
+ }
+ }
+
+ async executeScenario(imageName: string, button: string) {
+ const presenter = await this.testElement();
+ await this.tapBtn(button);
+ await this._driver.imageHelper.compareElement(presenter, { imageName: imageName, tolerance: 0.1, timeOutSeconds: 5 });
+ assert.isTrue(this._driver.imageHelper.hasImageComparisonPassed());
+ }
+}
\ No newline at end of file
diff --git a/e2e/ui-tests-app/e2e/suites/button/background/button-background.e2e-spec.ts b/e2e/ui-tests-app/e2e/suites/button/background/button-background.e2e-spec.ts
new file mode 100644
index 000000000..d9604e151
--- /dev/null
+++ b/e2e/ui-tests-app/e2e/suites/button/background/button-background.e2e-spec.ts
@@ -0,0 +1,159 @@
+import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium";
+import { ButtonBackgroundPage } from "./button-background-page";
+import { assert } from "chai";
+
+const suite = "button";
+const spec = "background";
+
+describe(`${suite}-${spec}-suite`, () => {
+ let driver: AppiumDriver;
+ let backgroundPage: ButtonBackgroundPage;
+
+ before(async function () {
+ nsCapabilities.testReporter.context = this;
+ driver = await createDriver();
+ await driver.resetApp();
+ backgroundPage = new ButtonBackgroundPage(driver);
+ await backgroundPage.initSuite();
+ });
+
+ after(async function () {
+ await backgroundPage.endSuite();
+ });
+
+ beforeEach(function () {
+ driver.imageHelper.testName = this.currentTest.title;
+ });
+
+ afterEach(async function () {
+ if (this.currentTest.state === "failed") {
+ await driver.logTestArtifacts(this.currentTest.title);
+ await driver.resetApp();
+ await backgroundPage.initSuite();
+ }
+ });
+
+ it("background_11", async function () {
+ const presenter = await backgroundPage.testElement();
+ await driver.imageHelper.compareElement(presenter, { imageName: "background_11_clean", tolerance: 0.1 });
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+ });
+
+ it("background_12", async function () {
+ await await backgroundPage.executeScenario("background_12", "1");
+ });
+
+ it("background_13", async function () {
+ await backgroundPage.tapResetBtn();
+ const presenter = await backgroundPage.testElement();
+ await driver.imageHelper.compareElement(presenter, { imageName: "background_11_clean", tolerance: 0.1 });
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+ });
+
+ // Border
+ it("background_21_border", async function () {
+ // await backgroundPage.navigateBackToSuitMainPage();
+ await backgroundPage.executeScenario("background_21_border", "21");
+ });
+
+ it("background_22_border", async function () {
+ await backgroundPage.executeScenario("background_22_border", "22");
+ });
+
+ it("background_23_border", async function () {
+ await backgroundPage.executeScenario("background_23_border", "23");
+ });
+
+ // Repeat
+ it("background_31_repeat", async function () {
+ await backgroundPage.executeScenario("background_31_repeat", "31");
+ });
+
+ it("background_32_repeat", async function () {
+ await backgroundPage.executeScenario("background_32_repeat", "32");
+ });
+
+ it("background_33_repeat", async function () {
+ await backgroundPage.executeScenario("background_33_repeat", "33");
+ });
+
+ // Position
+ it("background_41_position", async function () {
+ await backgroundPage.executeScenario("background_41_position", "41");
+ });
+
+ it("background_42_position", async function () {
+ await backgroundPage.executeScenario("background_42_position", "42");
+ });
+
+ it("background_43_position", async function () {
+ await backgroundPage.executeScenario("background_43_position", "43");
+ });
+
+ it("background_44_position", async function () {
+ await backgroundPage.executeScenario("background_44_position", "44");
+ });
+
+ it("background_45_position", async function () {
+ await backgroundPage.executeScenario("background_45_position", "45");
+ });
+
+ it("background_46_position", async function () {
+ await backgroundPage.executeScenario("background_46_position", "46");
+ });
+
+ it("background_47_position", async function () {
+ await backgroundPage.executeScenario("background_47_position", "47");
+ });
+
+ it("background_48_position", async function () {
+ await backgroundPage.executeScenario("background_48_position", "48");
+ });
+
+ it("background_49_position", async function () {
+ await backgroundPage.executeScenario("background_49_position", "49");
+ });
+
+ it("background_50_position", async function () {
+ await backgroundPage.executeScenario("background_50_position", "50");
+ });
+
+ it("background_51_position", async function () {
+ await backgroundPage.executeScenario("background_51_position", "51");
+ });
+
+ it("background_52_position", async function () {
+ await backgroundPage.executeScenario("background_52_position", "52");
+ });
+
+ // Size
+ it("background_61_size", async function () {
+ await backgroundPage.executeScenario("background_61_size", "61");
+ });
+
+ it("background_62_size", async function () {
+ await backgroundPage.executeScenario("background_62_size", "62");
+ });
+
+ it("background_63_size", async function () {
+ await backgroundPage.executeScenario("background_63_size", "63");
+ });
+
+ it("background_64_size", async function () {
+ await backgroundPage.executeScenario("background_64_size", "64");
+ });
+
+ // All
+ it("background_71_all", async function () {
+ await backgroundPage.executeScenario("background_71_all", "71");
+ });
+
+ it("background_72_all", async function () {
+ await backgroundPage.executeScenario("background_72_all", "72");
+ });
+
+ // Antialiasing
+ it("background_78_antialiasing", async function () {
+ await backgroundPage.executeScenario("background_78_antialiasing", "78");
+ });
+});
\ No newline at end of file
diff --git a/e2e/ui-tests-app/e2e/suites/tab-navigation/bottom-navigation/bottom-navigation-base-page.ts b/e2e/ui-tests-app/e2e/suites/tab-navigation/bottom-navigation/bottom-navigation-base-page.ts
new file mode 100644
index 000000000..652625693
--- /dev/null
+++ b/e2e/ui-tests-app/e2e/suites/tab-navigation/bottom-navigation/bottom-navigation-base-page.ts
@@ -0,0 +1,15 @@
+import { AppiumDriver } from "nativescript-dev-appium";
+import { PageObjectBaseModel } from "../../../page-object-base-model";
+import { ElementCacheStrategy } from "../../../helpers/navigation-helper";
+
+export class BottomNavigationBasePage extends PageObjectBaseModel {
+
+ constructor(_driver: AppiumDriver, elementCacheStrategy?: ElementCacheStrategy) {
+ super(_driver, ["bottom-navigation"], elementCacheStrategy);
+ }
+
+ async init(subSuiteName: string) {
+ this._naviagtionLinks.push(subSuiteName);
+ await super.initSuite();
+ }
+}
\ No newline at end of file
diff --git a/e2e/ui-tests-app/e2e/suites/tab-navigation/bottom-navigation/bottom-navigation.e2e-spec.ts b/e2e/ui-tests-app/e2e/suites/tab-navigation/bottom-navigation/bottom-navigation.e2e-spec.ts
new file mode 100644
index 000000000..aee6eb055
--- /dev/null
+++ b/e2e/ui-tests-app/e2e/suites/tab-navigation/bottom-navigation/bottom-navigation.e2e-spec.ts
@@ -0,0 +1,111 @@
+import { nsCapabilities, createDriver, AppiumDriver } from "nativescript-dev-appium";
+import { BottomNavigationBasePage } from "./bottom-navigation-base-page";
+import { Platform } from "mobile-devices-controller";
+import { assert } from "chai";
+import { setImageName } from "../../../helpers/image-helper";
+
+const suite = "tab-navigation";
+const spec = "bottom-navigation";
+
+describe(`${suite}-${spec}-suite`, async function () {
+ let driver: AppiumDriver;
+ let bottomNavigationBasePage: BottomNavigationBasePage;
+
+ before(async function () {
+ nsCapabilities.testReporter.context = this;
+ driver = await createDriver();
+ await driver.resetApp();
+ bottomNavigationBasePage = new BottomNavigationBasePage(driver);
+ await bottomNavigationBasePage.initSuite();
+ });
+
+ after(async function () {
+ await bottomNavigationBasePage.endSuite();
+ });
+
+ beforeEach(async function () {
+ driver.imageHelper.testName = setImageName(suite, spec, this.currentTest.title);
+ driver.imageHelper.options = {
+ tolerance: 0.01,
+ timeOutSeconds: 5,
+ preserveImageName: true
+ };
+ });
+
+ afterEach(async function () {
+ if (this.currentTest.state === "failed") {
+ await driver.logTestArtifacts(this.currentTest.title);
+ await driver.resetApp();
+ await bottomNavigationBasePage.initSuite();
+ }
+ });
+
+ it(`${spec}-background-color`, async function () {
+ await bottomNavigationBasePage.navigateToSample("background-color");
+
+ await driver.imageHelper.compareScreen();
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+
+ await bottomNavigationBasePage.navigateBackToSuitMainPage();
+ });
+
+ it(`${spec}-bottom-navigation`, async function () {
+ await bottomNavigationBasePage.navigateToSample("bottom-navigation");
+ await driver.imageHelper.compareScreen();
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+ await bottomNavigationBasePage.navigateBackToSuitMainPage();
+ });
+
+ it(`${spec}-color`, async function () {
+ await bottomNavigationBasePage.navigateToSample("color");
+ await driver.imageHelper.compareScreen();
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+ await bottomNavigationBasePage.navigateBackToSuitMainPage();
+ });
+
+ it(`${spec}-icon-change`, async function () {
+ await bottomNavigationBasePage.navigateToSample("tab-view-icon-change");
+ const index = driver.nsCapabilities.device.platform === Platform.IOS
+ ? (driver.nsCapabilities.device.apiLevel >= 11 ? 2 : 3) : 1;
+
+ let btns = await driver.findElementsByClassName(driver.locators.button, 5000);
+ await btns[index].tap();
+ await driver.imageHelper.compareScreen();
+
+ btns = await driver.findElementsByClassName(driver.locators.button, 5000);
+ await btns[index - 1].tap();
+ await driver.imageHelper.compareScreen();
+
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+
+ await bottomNavigationBasePage.navigateBackToSuitMainPage();
+ });
+
+ it(`${spec}-icon-title-placment`, async function () {
+ await bottomNavigationBasePage.navigateToSample("icon-title-placement");
+ await driver.imageHelper.compareScreen();
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+ await bottomNavigationBasePage.navigateBackToSuitMainPage();
+ });
+
+ it(`${spec}-issue-5470`, async function () {
+ await bottomNavigationBasePage.navigateToSample("issue-5470");
+ await driver.imageHelper.compareScreen();
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+ await bottomNavigationBasePage.navigateBackToSuitMainPage();
+ });
+
+ it(`${spec}-swipe-enabled`, async function () {
+ await bottomNavigationBasePage.navigateToSample("swipe-enabled");
+ await driver.imageHelper.compareScreen();
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+ await bottomNavigationBasePage.navigateBackToSuitMainPage();
+ });
+
+ it(`${spec}-tabs-position`, async function () {
+ await bottomNavigationBasePage.navigateToSample("tabs-position");
+ await driver.imageHelper.compareScreen();
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+ await bottomNavigationBasePage.navigateBackToSuitMainPage();
+ });
+});
\ No newline at end of file
diff --git a/e2e/ui-tests-app/e2e/suites/tab-navigation/tab-view/issues-from-git.ts b/e2e/ui-tests-app/e2e/suites/tab-navigation/tab-view/issues-from-git.ts
new file mode 100644
index 000000000..e69de29bb
diff --git a/e2e/ui-tests-app/e2e/suites/tab-navigation/tab-view/tab-view-base-page.ts b/e2e/ui-tests-app/e2e/suites/tab-navigation/tab-view/tab-view-base-page.ts
new file mode 100644
index 000000000..a04e249c7
--- /dev/null
+++ b/e2e/ui-tests-app/e2e/suites/tab-navigation/tab-view/tab-view-base-page.ts
@@ -0,0 +1,15 @@
+import { AppiumDriver } from "nativescript-dev-appium";
+import { PageObjectBaseModel } from "../../../page-object-base-model";
+import { ElementCacheStrategy } from "./../../../helpers/navigation-helper";
+
+export class TabViewBasePage extends PageObjectBaseModel {
+
+ constructor(_driver: AppiumDriver, elementCacheStrategy?: ElementCacheStrategy) {
+ super(_driver, ["tab-view"], elementCacheStrategy);
+ }
+
+ async init(subSuiteName: string) {
+ this._naviagtionLinks.push(subSuiteName);
+ await super.initSuite();
+ }
+}
\ No newline at end of file
diff --git a/e2e/ui-tests-app/e2e/suites/tab-navigation/tab-view/tab-view-common-tests.e2e-spec.ts b/e2e/ui-tests-app/e2e/suites/tab-navigation/tab-view/tab-view-common-tests.e2e-spec.ts
new file mode 100644
index 000000000..3cc4166c7
--- /dev/null
+++ b/e2e/ui-tests-app/e2e/suites/tab-navigation/tab-view/tab-view-common-tests.e2e-spec.ts
@@ -0,0 +1,111 @@
+import { nsCapabilities, createDriver, AppiumDriver } from "nativescript-dev-appium";
+import { TabViewBasePage } from "./tab-view-base-page";
+import { Platform } from "mobile-devices-controller";
+import { setImageName } from "../../../helpers/image-helper";
+import { assert } from "chai";
+
+const suite = "tab-navigation";
+const spec = "tab-view-common";
+
+describe(`${suite}-${spec}-suite`, async function () {
+ let driver: AppiumDriver;
+ let tabViewBasePage: TabViewBasePage;
+
+ before(async function () {
+ nsCapabilities.testReporter.context = this;
+ driver = await createDriver();
+ await driver.resetApp();
+ tabViewBasePage = new TabViewBasePage(driver);
+ await tabViewBasePage.initSuite();
+ });
+
+ after(async function () {
+ await tabViewBasePage.endSuite();
+ });
+
+ beforeEach(async function () {
+ driver.imageHelper.testName = setImageName(suite, spec, this.currentTest.title);
+ driver.imageHelper.options = {
+ tolerance: 0.01,
+ timeOutSeconds: 5
+ };
+ });
+
+ afterEach(async function () {
+ if (this.currentTest.state === "failed") {
+ await driver.logTestArtifacts(this.currentTest.title);
+ await driver.resetApp();
+ await tabViewBasePage.initSuite();
+ }
+ });
+
+ it(`${spec}-style`, async function () {
+ await tabViewBasePage.navigateToSample("tabStyle");
+
+ await driver.imageHelper.compareScreen({ timeOutSeconds: 5, tolerance: 0.01 });
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+
+ await tabViewBasePage.navigateBackToSuitMainPage();
+ });
+
+ it(`${spec}-more-items`, async function () {
+ await tabViewBasePage.navigateToSample("tabmore");
+
+ await driver.imageHelper.compareScreen();
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+
+ await tabViewBasePage.navigateBackToSuitMainPage();
+ });
+
+ it(`${spec}-icons`, async function () {
+ await tabViewBasePage.navigateToSample("tab-view-icons");
+ await driver.imageHelper.compareScreen();
+
+ const rect = await (await driver.waitForElement("automatic")).getActualRectangle();
+
+ await driver.clickPoint(rect.x + 10, rect.y + 10);
+ await driver.imageHelper.compareScreen();
+
+ await driver.clickPoint(rect.x + 10, rect.y + 10);
+ await driver.imageHelper.compareScreen();
+
+ await driver.clickPoint(rect.x + 10, rect.y + 10);
+ await driver.imageHelper.compareScreen();
+
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+
+ await tabViewBasePage.navigateBackToSuitMainPage();
+ });
+
+ it(`${spec}-fonts`, async function () {
+ await tabViewBasePage.navigateToSample("text-transform");
+ await driver.imageHelper.compareScreen();
+
+ await (await driver.waitForElement("apply")).tap();
+ await driver.imageHelper.compareScreen();
+
+ await (await driver.waitForElement("reset")).tap();
+ await driver.imageHelper.compareScreen();
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+
+ await tabViewBasePage.navigateBackToSuitMainPage();
+ });
+
+ it(`${spec}-icon-change`, async function () {
+ await tabViewBasePage.navigateToSample("tab-view-icon-change");
+ const index = driver.nsCapabilities.device.platform === Platform.IOS
+ ? (driver.nsCapabilities.device.apiLevel >= 11 ? 2 : 3) : 1;
+
+ let btns = await driver.findElementsByClassName(driver.locators.button, 5000);
+ await btns[index].tap();
+ await driver.imageHelper.compareScreen();
+
+ btns = await driver.findElementsByClassName(driver.locators.button, 5000);
+ await btns[index - 1].tap();
+ await driver.imageHelper.compareScreen();
+
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+
+ await tabViewBasePage.navigateBackToSuitMainPage();
+ });
+});
\ No newline at end of file
diff --git a/e2e/ui-tests-app/e2e/suites/tab-navigation/tab-view/tab-view-css-properties.e2e-spec.ts b/e2e/ui-tests-app/e2e/suites/tab-navigation/tab-view/tab-view-css-properties.e2e-spec.ts
new file mode 100644
index 000000000..9268377e4
--- /dev/null
+++ b/e2e/ui-tests-app/e2e/suites/tab-navigation/tab-view/tab-view-css-properties.e2e-spec.ts
@@ -0,0 +1,72 @@
+import { nsCapabilities, createDriver, AppiumDriver, Direction } from "nativescript-dev-appium";
+import { TabViewBasePage } from "./tab-view-base-page";
+import { ImageOptions } from "nativescript-dev-appium/lib/image-options";
+import { Platform } from "mobile-devices-controller";
+import { ElementCacheStrategy } from "../../../helpers/navigation-helper";
+import { setImageName } from "../../../helpers/image-helper";
+import { assert } from "chai";
+
+const suite = "tab-navigation";
+const spec = "tab-view-css";
+
+describe(`${suite}-${spec}-suite`, async function () {
+ let driver: AppiumDriver;
+ let tabViewBasePage: TabViewBasePage;
+
+ const samples = [
+ "tab-text-color: green;",
+ "tab-background-color: yellow;",
+ "selected-tab-text-color: red;",
+ "android-selected-tab-highlight-color: orange;",
+ "text-transform: uppercase;",
+ "text-transform: lowercase;",
+ "text-transform: none;",
+ "all",
+ "reset"];
+
+ before(async function () {
+ nsCapabilities.testReporter.context = this;
+ driver = await createDriver();
+ await driver.resetApp();
+ tabViewBasePage = new TabViewBasePage(driver, ElementCacheStrategy.onload);
+ await tabViewBasePage.init("tabViewCss");
+ });
+
+ after(async function () {
+ await tabViewBasePage.endSuite();
+ });
+
+ beforeEach(function () {
+ driver.imageHelper.testName = setImageName(suite, spec, this.currentTest.title);
+ });
+
+ afterEach(async function () {
+ if (this.currentTest.state === "failed") {
+ await driver.logTestArtifacts(this.currentTest.title);
+ await driver.resetApp();
+ await tabViewBasePage.initSuite();
+ }
+ });
+
+ for (let index = 0; index < samples.length; index++) {
+ const sample = samples[index];
+ const imageName = `${spec}-${sample.replace(/[^a-z]/ig, "-").replace(/(-+)/ig, "-").replace(/(_+)/ig, "_").replace(/-$/, "")}`;
+ it(imageName, async function () {
+ if (driver.platformName === Platform.ANDROID
+ && (sample === "All" || sample === "reset")) {
+ await driver.scroll(Direction.down, 400, 200, 300, 200);
+ }
+ const scenarioBtn = await driver.waitForElement(sample);
+ await scenarioBtn.click();
+ await driver.wait(2000);
+ await driver.imageHelper.compareScreen({ imageName: imageName, timeOutSeconds: 5, tolerance: 0, toleranceType: ImageOptions.pixel });
+ if (sample === "All") {
+ const tabTwo = await driver.waitForElement("twO");
+ await driver.wait(2000);
+
+ await driver.imageHelper.compareElement(tabTwo, { timeOutSeconds: 5, tolerance: 0, toleranceType: ImageOptions.pixel });
+ }
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+ });
+ }
+});
\ No newline at end of file
diff --git a/e2e/ui-tests-app/e2e/suites/tab-navigation/tabs/tab-tests.e2e-spec.ts b/e2e/ui-tests-app/e2e/suites/tab-navigation/tabs/tab-tests.e2e-spec.ts
new file mode 100644
index 000000000..7051c6984
--- /dev/null
+++ b/e2e/ui-tests-app/e2e/suites/tab-navigation/tabs/tab-tests.e2e-spec.ts
@@ -0,0 +1,111 @@
+import { nsCapabilities, createDriver, AppiumDriver } from "nativescript-dev-appium";
+import { TabsViewBasePage } from "./tabs-view-base-page";
+import { Platform } from "mobile-devices-controller";
+import { assert } from "chai";
+import { setImageName } from "../../../helpers/image-helper";
+
+const suite = "tab-navigation";
+const spec = "tabs";
+
+describe(`${suite}-${spec}-suite`, async function () {
+ let driver: AppiumDriver;
+ let tabsViewBasePage: TabsViewBasePage;
+
+ before(async function () {
+ nsCapabilities.testReporter.context = this;
+ driver = await createDriver();
+ await driver.resetApp();
+ tabsViewBasePage = new TabsViewBasePage(driver);
+ await tabsViewBasePage.initSuite();
+ });
+
+ after(async function () {
+ await tabsViewBasePage.endSuite();
+ });
+
+ beforeEach(async function () {
+ driver.imageHelper.testName = setImageName(suite, spec, this.currentTest.title);
+ driver.imageHelper.options = {
+ tolerance: 0.01,
+ timeOutSeconds: 5,
+ preserveImageName: true
+ };
+ });
+
+ afterEach(async function () {
+ if (this.currentTest.state === "failed") {
+ await driver.logTestArtifacts(this.currentTest.title);
+ await driver.resetApp();
+ await tabsViewBasePage.initSuite();
+ }
+ });
+
+ it(`${spec}-background-color`, async function () {
+ await tabsViewBasePage.navigateToSample("background-color");
+
+ await driver.imageHelper.compareScreen();
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+
+ await tabsViewBasePage.navigateBackToSuitMainPage();
+ });
+
+ it(`${spec}-bottom-navigation`, async function () {
+ await tabsViewBasePage.navigateToSample("bottom-navigation");
+ await driver.imageHelper.compareScreen();
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+ await tabsViewBasePage.navigateBackToSuitMainPage();
+ });
+
+ it(`${spec}-color`, async function () {
+ await tabsViewBasePage.navigateToSample("color");
+ await driver.imageHelper.compareScreen();
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+ await tabsViewBasePage.navigateBackToSuitMainPage();
+ });
+
+ it(`${spec}-icon-change`, async function () {
+ await tabsViewBasePage.navigateToSample("tab-view-icon-change");
+ const index = driver.nsCapabilities.device.platform === Platform.IOS
+ ? (driver.nsCapabilities.device.apiLevel >= 11 ? 2 : 3) : 1;
+
+ let btns = await driver.findElementsByClassName(driver.locators.button, 5000);
+ await btns[index].tap();
+ await driver.imageHelper.compareScreen();
+
+ btns = await driver.findElementsByClassName(driver.locators.button, 5000);
+ await btns[index - 1].tap();
+ await driver.imageHelper.compareScreen();
+
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+
+ await tabsViewBasePage.navigateBackToSuitMainPage();
+ });
+
+ it(`${spec}-icon-title-placment`, async function () {
+ await tabsViewBasePage.navigateToSample("icon-title-placement");
+ await driver.imageHelper.compareScreen();
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+ await tabsViewBasePage.navigateBackToSuitMainPage();
+ });
+
+ it(`${spec}-issue-5470`, async function () {
+ await tabsViewBasePage.navigateToSample("issue-5470");
+ await driver.imageHelper.compareScreen();
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+ await tabsViewBasePage.navigateBackToSuitMainPage();
+ });
+
+ it(`${spec}-swipe-enabled`, async function () {
+ await tabsViewBasePage.navigateToSample("swipe-enabled");
+ await driver.imageHelper.compareScreen();
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+ await tabsViewBasePage.navigateBackToSuitMainPage();
+ });
+
+ it(`${spec}-tabs-position`, async function () {
+ await tabsViewBasePage.navigateToSample("tabs-position");
+ await driver.imageHelper.compareScreen();
+ assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
+ await tabsViewBasePage.navigateBackToSuitMainPage();
+ });
+});
\ No newline at end of file
diff --git a/e2e/ui-tests-app/e2e/suites/tab-navigation/tabs/tabs-view-base-page.ts b/e2e/ui-tests-app/e2e/suites/tab-navigation/tabs/tabs-view-base-page.ts
new file mode 100644
index 000000000..a5f7392dd
--- /dev/null
+++ b/e2e/ui-tests-app/e2e/suites/tab-navigation/tabs/tabs-view-base-page.ts
@@ -0,0 +1,15 @@
+import { AppiumDriver } from "nativescript-dev-appium";
+import { PageObjectBaseModel } from "../../../page-object-base-model";
+import { ElementCacheStrategy } from "../../../helpers/navigation-helper";
+
+export class TabsViewBasePage extends PageObjectBaseModel {
+
+ constructor(_driver: AppiumDriver, elementCacheStrategy?: ElementCacheStrategy) {
+ super(_driver, ["tabs"], elementCacheStrategy);
+ }
+
+ async init(subSuiteName: string) {
+ this._naviagtionLinks.push(subSuiteName);
+ await super.initSuite();
+ }
+}
\ No newline at end of file
diff --git a/e2e/ui-tests-app/e2e/tsconfig.json b/e2e/ui-tests-app/e2e/tsconfig.json
new file mode 100644
index 000000000..2b7aa4b54
--- /dev/null
+++ b/e2e/ui-tests-app/e2e/tsconfig.json
@@ -0,0 +1,20 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es6",
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true,
+ "importHelpers": false,
+ "sourceMap": true,
+ "types": [
+ "mocha",
+ "chai",
+ "node"
+ ],
+ "lib": [
+ "es2015",
+ "dom"
+ ],
+ "baseUrl": "."
+ }
+}
\ No newline at end of file
diff --git a/e2e/ui-tests-app/nsconfig.json b/e2e/ui-tests-app/nsconfig.json
new file mode 100644
index 000000000..df89c5b16
--- /dev/null
+++ b/e2e/ui-tests-app/nsconfig.json
@@ -0,0 +1,3 @@
+{
+ "useLegacyWorkflow": false
+}
diff --git a/e2e/ui-tests-app/package.json b/e2e/ui-tests-app/package.json
new file mode 100644
index 000000000..84f7ea1dc
--- /dev/null
+++ b/e2e/ui-tests-app/package.json
@@ -0,0 +1,45 @@
+{
+ "nativescript": {
+ "id": "org.nativescript.uitestsapp",
+ "tns-android": {
+ "version": "next"
+ },
+ "tns-ios": {
+ "version": "next"
+ }
+ },
+ "main": "app.js",
+ "description": "NativeScript Application",
+ "license": "SEE LICENSE IN ",
+ "repository": "",
+ "dependencies": {
+ "tns-core-modules": "file:../../tns-core-modules"
+ },
+ "devDependencies": {
+ "@testdeck/mocha": "0.0.6",
+ "@types/chai": "~4.1.7",
+ "@types/mocha": "~5.2.5",
+ "@types/node": "~10.12.18",
+ "chai": "~4.1.2",
+ "mocha": "~5.2.0",
+ "mocha-junit-reporter": "~1.18.0",
+ "mocha-multi": "~1.0.1",
+ "mocha-typescript": "^1.1.17",
+ "mochawesome": "~3.1.2",
+ "nativescript-dev-appium": "next",
+ "nativescript-dev-webpack": "next",
+ "tns-platform-declarations": "next",
+ "typescript": "~3.4.1"
+ },
+ "gitHead": "8ab7726d1ee9991706069c1359c552e67ee0d1a4",
+ "readme": "NativeScript Application",
+ "scripts": {
+ "test": "mocha --opts ../config/mocha.opts",
+ "test-debug": "./node_modules/.bin/ns-dev-appium --startSession",
+ "test-watch": "tsc -p e2e --watch",
+ "pretest": "tsc -p e2e",
+ "watch": "testdeck-watch",
+ "load-images": "./e2e/scripts/sparse-checkout.sh uitestsapp https://github.com/NativeScript/functional-tests-images.git $PWD/../../../functional-tests-images",
+ "update-emulators": "cd $PWD/../../../functional-tests-images && . ./scripts/update-emulators.sh --appName uitestsapp"
+ }
+}
diff --git a/e2e/ui-tests-app/references.d.ts b/e2e/ui-tests-app/references.d.ts
new file mode 100644
index 000000000..992a504a0
--- /dev/null
+++ b/e2e/ui-tests-app/references.d.ts
@@ -0,0 +1,2 @@
+///
+///
\ No newline at end of file
diff --git a/e2e/ui-tests-app/tsconfig.json b/e2e/ui-tests-app/tsconfig.json
new file mode 100644
index 000000000..9c41240dc
--- /dev/null
+++ b/e2e/ui-tests-app/tsconfig.json
@@ -0,0 +1,30 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "target": "es5",
+ "experimentalDecorators": true,
+ "emitDecoratorMetadata": true,
+ "noEmitHelpers": true,
+ "noEmitOnError": true,
+ "lib": [
+ "es6",
+ "dom"
+ ],
+ "baseUrl": ".",
+ "paths": {
+ "~/*": [
+ "app/*"
+ ]
+ }
+ },
+ "include": [
+ "../tns-core-modules",
+ "**/*"
+ ],
+ "exclude": [
+ "../tns-core-modules/node_modules",
+ "node_modules",
+ "platforms",
+ "e2e"
+ ]
+}
\ No newline at end of file
diff --git a/e2e/ui-tests-app/tsconfig.tns.json b/e2e/ui-tests-app/tsconfig.tns.json
new file mode 100644
index 000000000..95f2ecee0
--- /dev/null
+++ b/e2e/ui-tests-app/tsconfig.tns.json
@@ -0,0 +1,7 @@
+{
+ "extends": "./tsconfig",
+ "compilerOptions": {
+ "module": "es2015",
+ "moduleResolution": "node"
+ }
+}
diff --git a/e2e/ui-tests-app/tsfmt.json b/e2e/ui-tests-app/tsfmt.json
new file mode 100644
index 000000000..f9e47f797
--- /dev/null
+++ b/e2e/ui-tests-app/tsfmt.json
@@ -0,0 +1,4 @@
+{
+ "indentSize": 4,
+ "tabSize": 4
+}
diff --git a/e2e/ui-tests-app/webpack.config.js b/e2e/ui-tests-app/webpack.config.js
new file mode 100644
index 000000000..234c34a84
--- /dev/null
+++ b/e2e/ui-tests-app/webpack.config.js
@@ -0,0 +1,309 @@
+const { join, relative, resolve, sep } = require("path");
+
+const webpack = require("webpack");
+const nsWebpack = require("nativescript-dev-webpack");
+const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target");
+const CleanWebpackPlugin = require("clean-webpack-plugin");
+const CopyWebpackPlugin = require("copy-webpack-plugin");
+const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
+const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');
+const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
+const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin");
+const TerserPlugin = require("terser-webpack-plugin");
+const hashSalt = Date.now().toString();
+
+module.exports = env => {
+ // Add your custom Activities, Services and other Android app components here.
+ const appComponents = [
+ "tns-core-modules/ui/frame",
+ "tns-core-modules/ui/frame/activity",
+ ];
+
+ const platform = env && (env.android && "android" || env.ios && "ios");
+ if (!platform) {
+ throw new Error("You need to provide a target platform!");
+ }
+
+ const platforms = ["ios", "android"];
+ const projectRoot = __dirname;
+
+ // Default destination inside platforms//...
+ const dist = resolve(projectRoot, nsWebpack.getAppPath(platform, projectRoot));
+ const appResourcesPlatformDir = platform === "android" ? "Android" : "iOS";
+
+ const {
+ // The 'appPath' and 'appResourcesPath' values are fetched from
+ // the nsconfig.json configuration file
+ // when bundling with `tns run android|ios --bundle`.
+ appPath = "app",
+ appResourcesPath = "app/App_Resources",
+
+ // You can provide the following flags when running 'tns run android|ios'
+ snapshot, // --env.snapshot
+ production, // --env.production
+ uglify, // --env.uglify
+ report, // --env.report
+ sourceMap, // --env.sourceMap
+ hiddenSourceMap, // --env.hiddenSourceMap
+ hmr, // --env.hmr,
+ unitTesting, // --env.unitTesting,
+ verbose, // --env.verbose
+ } = env;
+ const isAnySourceMapEnabled = !!sourceMap || !!hiddenSourceMap;
+ const externals = nsWebpack.getConvertedExternals(env.externals);
+
+ const appFullPath = resolve(projectRoot, appPath);
+ const appResourcesFullPath = resolve(projectRoot, appResourcesPath);
+
+ const entryModule = nsWebpack.getEntryModule(appFullPath, platform);
+ const entryPath = `.${sep}${entryModule}.ts`;
+ const entries = { bundle: entryPath };
+
+ const tsConfigPath = resolve(projectRoot, "tsconfig.tns.json");
+
+ const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some(e => e.indexOf("tns-core-modules") > -1);
+ if (platform === "ios" && !areCoreModulesExternal) {
+ entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules";
+ };
+
+ let sourceMapFilename = nsWebpack.getSourceMapFilename(hiddenSourceMap, __dirname, dist);
+
+ const itemsToClean = [`${dist}/**/*`];
+ if (platform === "android") {
+ itemsToClean.push(`${join(projectRoot, "platforms", "android", "app", "src", "main", "assets", "snapshots")}`);
+ itemsToClean.push(`${join(projectRoot, "platforms", "android", "app", "build", "configurations", "nativescript-android-snapshot")}`);
+ }
+
+ const config = {
+ mode: production ? "production" : "development",
+ context: appFullPath,
+ externals,
+ watchOptions: {
+ ignored: [
+ appResourcesFullPath,
+ // Don't watch hidden files
+ "**/.*",
+ ]
+ },
+ target: nativescriptTarget,
+ entry: entries,
+ output: {
+ pathinfo: false,
+ path: dist,
+ sourceMapFilename,
+ libraryTarget: "commonjs2",
+ filename: "[name].js",
+ globalObject: "global",
+ hashSalt
+ },
+ resolve: {
+ extensions: [".ts", ".js", ".scss", ".css"],
+ // Resolve {N} system modules from tns-core-modules
+ modules: [
+ resolve(__dirname, "node_modules/tns-core-modules"),
+ resolve(__dirname, "node_modules"),
+ "node_modules/tns-core-modules",
+ "node_modules",
+ ],
+ alias: {
+ '~': appFullPath
+ },
+ // resolve symlinks to symlinked modules
+ symlinks: true
+ },
+ resolveLoader: {
+ // don't resolve symlinks to symlinked loaders
+ symlinks: false
+ },
+ node: {
+ // Disable node shims that conflict with NativeScript
+ "http": false,
+ "timers": false,
+ "setImmediate": false,
+ "fs": "empty",
+ "__dirname": false,
+ },
+ devtool: hiddenSourceMap ? "hidden-source-map" : (sourceMap ? "inline-source-map" : "none"),
+ optimization: {
+ runtimeChunk: "single",
+ splitChunks: {
+ cacheGroups: {
+ vendor: {
+ name: "vendor",
+ chunks: "all",
+ test: (module, chunks) => {
+ const moduleName = module.nameForCondition ? module.nameForCondition() : '';
+ return /[\\/]node_modules[\\/]/.test(moduleName) ||
+ appComponents.some(comp => comp === moduleName);
+
+ },
+ enforce: true,
+ },
+ }
+ },
+ minimize: !!uglify,
+ minimizer: [
+ new TerserPlugin({
+ parallel: true,
+ cache: true,
+ sourceMap: isAnySourceMapEnabled,
+ terserOptions: {
+ output: {
+ comments: false,
+ semicolons: !isAnySourceMapEnabled
+ },
+ compress: {
+ // The Android SBG has problems parsing the output
+ // when these options are enabled
+ 'collapse_vars': platform !== "android",
+ sequences: platform !== "android",
+ }
+ }
+ })
+ ],
+ },
+ module: {
+ rules: [
+ {
+ test: nsWebpack.getEntryPathRegExp(appFullPath, entryPath),
+ use: [
+ // Require all Android app components
+ platform === "android" && {
+ loader: "nativescript-dev-webpack/android-app-components-loader",
+ options: { modules: appComponents }
+ },
+
+ {
+ loader: "nativescript-dev-webpack/bundle-config-loader",
+ options: {
+ loadCss: !snapshot, // load the application css if in debug mode
+ unitTesting,
+ appFullPath,
+ projectRoot,
+ }
+ },
+ ].filter(loader => !!loader)
+ },
+
+ {
+ test: /-page\.ts$/,
+ use: "nativescript-dev-webpack/script-hot-loader"
+ },
+
+ {
+ test: /\.(css|scss)$/,
+ use: "nativescript-dev-webpack/style-hot-loader"
+ },
+
+ {
+ test: /\.(html|xml)$/,
+ use: "nativescript-dev-webpack/markup-hot-loader"
+ },
+
+ { test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader" },
+
+ {
+ test: /\.css$/,
+ use: { loader: "css-loader", options: { url: false } }
+ },
+
+ {
+ test: /\.scss$/,
+ use: [
+ { loader: "css-loader", options: { url: false } },
+ "sass-loader"
+ ]
+ },
+ // TODO: Invetigate why do we need???
+ {
+ test: /\.png$|.jpg$|.ttf$|.otf$|.gradle$|.storyboard$|.plist$/,
+ use: { loader: "raw-loader" }
+ },
+ {
+ test: /\.ts$/,
+ use: {
+ loader: "ts-loader",
+ options: {
+ configFile: tsConfigPath,
+ // https://github.com/TypeStrong/ts-loader/blob/ea2fcf925ec158d0a536d1e766adfec6567f5fb4/README.md#faster-builds
+ // https://github.com/TypeStrong/ts-loader/blob/ea2fcf925ec158d0a536d1e766adfec6567f5fb4/README.md#hot-module-replacement
+ transpileOnly: true,
+ allowTsInNodeModules: true,
+ compilerOptions: {
+ sourceMap: isAnySourceMapEnabled,
+ declaration: false
+ }
+ },
+ }
+ },
+ ]
+ },
+ plugins: [
+ // Define useful constants like TNS_WEBPACK
+ new webpack.DefinePlugin({
+ "global.TNS_WEBPACK": "true",
+ "process": undefined,
+ }),
+ // Remove all files from the out dir.
+ new CleanWebpackPlugin(itemsToClean, { verbose: !!verbose }),
+ // Copy assets to out dir. Add your own globs as needed.
+ new CopyWebpackPlugin([
+ { from: { glob: "fonts/**" } },
+ { from: { glob: "**/*.jpg" } },
+ { from: { glob: "**/*.png" } },
+ { from: { glob: "**/*.html" } },
+ { from: { glob: "web-view/test.css" } },
+ ], { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }),
+ new nsWebpack.GenerateNativeScriptEntryPointsPlugin("bundle"),
+ // For instructions on how to set up workers with webpack
+ // check out https://github.com/nativescript/worker-loader
+ new NativeScriptWorkerPlugin(),
+ new nsWebpack.PlatformFSPlugin({
+ platform,
+ platforms,
+ }),
+ // Does IPC communication with the {N} CLI to notify events when running in watch mode.
+ new nsWebpack.WatchStateLoggerPlugin(),
+ // https://github.com/TypeStrong/ts-loader/blob/ea2fcf925ec158d0a536d1e766adfec6567f5fb4/README.md#faster-builds
+ // https://github.com/TypeStrong/ts-loader/blob/ea2fcf925ec158d0a536d1e766adfec6567f5fb4/README.md#hot-module-replacement
+ new ForkTsCheckerWebpackPlugin({
+ tsconfig: tsConfigPath,
+ async: false,
+ useTypescriptIncrementalApi: true,
+ memoryLimit: 4096
+ }),
+ new ExtraWatchWebpackPlugin({
+ files: [`node_modules/**/*.${platform}.ts`]
+ })
+ ],
+ };
+
+ if (report) {
+ // Generate report files for bundles content
+ config.plugins.push(new BundleAnalyzerPlugin({
+ analyzerMode: "static",
+ openAnalyzer: false,
+ generateStatsFile: true,
+ reportFilename: resolve(projectRoot, "report", `report.html`),
+ statsFilename: resolve(projectRoot, "report", `stats.json`),
+ }));
+ }
+
+ if (snapshot) {
+ config.plugins.push(new nsWebpack.NativeScriptSnapshotPlugin({
+ chunk: "vendor",
+ requireModules: [
+ "tns-core-modules/bundle-entry-points",
+ ],
+ projectRoot,
+ webpackConfig: config,
+ }));
+ }
+
+ if (hmr) {
+ config.plugins.push(new webpack.HotModuleReplacementPlugin());
+ }
+
+
+ return config;
+};
diff --git a/package.json b/package.json
index 31812ce45..cfb7e2cb8 100644
--- a/package.json
+++ b/package.json
@@ -82,7 +82,7 @@
"typedoc": "typedoc --tsconfig tsconfig.typedoc.json --out bin/dist/apiref --includeDeclarations --name NativeScript --theme ./node_modules/nativescript-typedoc-theme --excludeExternals --externalPattern \"**/+(tns-core-modules|module).d.ts\"",
"dev-typedoc": "npm run typedoc && cd bin/dist/apiref && npx http-server",
"test-tsc-es2016": "npm run tsc -- -p tsconfig.public.es2016.json",
- "tslint": "tslint --project tsconfig.json --config build/tslint.json 'tns-core-modules/**/*.ts' 'tests/**/*.ts' 'apps/**/*.ts' 'e2e/**/*.ts' -e '**/node_modules/**' -e '**/platforms/**'",
+ "tslint": "tslint --project tsconfig.tslint.json --config build/tslint.json",
"madge-ios": "tsc --skipLibCheck && tns prepare ios --path tests && madge --circular tests/platforms/ios/tests/app/tns_modules/tns-core-modules",
"madge-ios-image": "tsc --skipLibCheck && tns prepare ios --path tests && madge --image graph-tests-ios.svg tests/platforms/ios/tests/app/tns_modules/tns-core-modules",
"madge-android": "tsc --skipLibCheck && tns prepare android --path tests && madge --circular tests/platforms/android/app/src/main/assets/app/tns_modules/tns-core-modules",
diff --git a/tests/.editorconfig b/tests/.editorconfig
new file mode 100644
index 000000000..856527689
--- /dev/null
+++ b/tests/.editorconfig
@@ -0,0 +1,15 @@
+root = true
+
+[*]
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+charset = utf-8
+
+[*.json]
+indent_style = space
+indent_size = 2
+
+[*.ts]
+indent_style = space
+indent_size = 4
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 000000000..38209fae2
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,33 @@
+# NativeScript
+hooks/
+node_modules/
+platforms/
+
+# NativeScript Template
+*.js.map
+*.js
+!webpack.config.js
+
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# General
+.DS_Store
+.AppleDouble
+.LSOverride
+.idea
+.cloud
+.project
+tmp/
+typings/
+
+# Visual Studio Code
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
diff --git a/tests/.vscode/launch.json b/tests/.vscode/launch.json
deleted file mode 100644
index a51cfc788..000000000
--- a/tests/.vscode/launch.json
+++ /dev/null
@@ -1,49 +0,0 @@
-{
- "version": "0.2.0",
- "configurations": [
- {
- "name": "Launch on iOS",
- "type": "nativescript",
- "request": "launch",
- "platform": "ios",
- "appRoot": "${workspaceRoot}",
- "sourceMaps": true,
- "watch": true,
- "stopOnEntry": true,
- "tnsArgs": [
- "--sync-all-files"
- ]
- },
- {
- "name": "Attach on iOS",
- "type": "nativescript",
- "request": "attach",
- "platform": "ios",
- "appRoot": "${workspaceRoot}",
- "sourceMaps": true,
- "watch": false
- },
- {
- "name": "Launch on Android",
- "type": "nativescript",
- "request": "launch",
- "platform": "android",
- "appRoot": "${workspaceRoot}",
- "sourceMaps": true,
- "watch": true,
- "stopOnEntry": true,
- "tnsArgs": [
- "--sync-all-files"
- ]
- },
- {
- "name": "Attach on Android",
- "type": "nativescript",
- "request": "attach",
- "platform": "android",
- "appRoot": "${workspaceRoot}",
- "sourceMaps": true,
- "watch": false
- }
- ]
-}
\ No newline at end of file
diff --git a/tests/.vscode/settings.json b/tests/.vscode/settings.json
deleted file mode 100644
index 84421514e..000000000
--- a/tests/.vscode/settings.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "xml.fileAssociations": [
- {
- "systemId": "/Users/myankov/Work/NativeScript/tests/schema/tns.xsd",
- "pattern": "**/**/*.xml"
- }
- ],
- "files.exclude": {
- "schema": true
- }
-}
\ No newline at end of file
diff --git a/tests/.vscode/tasks.json b/tests/.vscode/tasks.json
deleted file mode 100644
index 926b1ddcd..000000000
--- a/tests/.vscode/tasks.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- // See https://go.microsoft.com/fwlink/?LinkId=733558
- // for the documentation about the tasks.json format
- "version": "0.1.0",
- "command": "tsc",
- "isShellCommand": true,
- "args": ["-p", "."],
- "showOutput": "silent",
- "problemMatcher": "$tsc"
-}
\ No newline at end of file
diff --git a/tests/LICENSE b/tests/LICENSE
new file mode 100644
index 000000000..4794b436d
--- /dev/null
+++ b/tests/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright (c) 2015-2019 Progress Software Corporation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/tests/app/App_Resources/Android/app.gradle b/tests/app/App_Resources/Android/app.gradle
index a6dd87303..d2c9cf657 100644
--- a/tests/app/App_Resources/Android/app.gradle
+++ b/tests/app/App_Resources/Android/app.gradle
@@ -2,15 +2,15 @@
// Uncomment to add recyclerview-v7 dependency
//dependencies {
-// compile 'com.android.support:recyclerview-v7:+'
+// implementation 'com.android.support:recyclerview-v7:+'
//}
-android {
- defaultConfig {
- generatedDensities = []
- }
- aaptOptions {
- additionalParameters "--no-version-vectors"
- }
-}
-project.ext.useAndroidX=true
\ No newline at end of file
+android {
+ defaultConfig {
+ generatedDensities = []
+ }
+ aaptOptions {
+ additionalParameters "--no-version-vectors"
+ }
+}
+project.ext.useAndroidX=true
diff --git a/tests/app/App_Resources/Android/drawable-hdpi/icon.png b/tests/app/App_Resources/Android/drawable-hdpi/icon.png
deleted file mode 100755
index 1034356e2..000000000
Binary files a/tests/app/App_Resources/Android/drawable-hdpi/icon.png and /dev/null differ
diff --git a/tests/app/App_Resources/Android/drawable-ldpi/icon.png b/tests/app/App_Resources/Android/drawable-ldpi/icon.png
deleted file mode 100755
index ddfc17a71..000000000
Binary files a/tests/app/App_Resources/Android/drawable-ldpi/icon.png and /dev/null differ
diff --git a/tests/app/App_Resources/Android/drawable-mdpi/icon.png b/tests/app/App_Resources/Android/drawable-mdpi/icon.png
deleted file mode 100755
index 486e41091..000000000
Binary files a/tests/app/App_Resources/Android/drawable-mdpi/icon.png and /dev/null differ
diff --git a/tests/app/App_Resources/Android/drawable-nodpi/icon.png b/tests/app/App_Resources/Android/drawable-nodpi/icon.png
deleted file mode 100755
index 1034356e2..000000000
Binary files a/tests/app/App_Resources/Android/drawable-nodpi/icon.png and /dev/null differ
diff --git a/apps/app/App_Resources/Android/AndroidManifest.xml b/tests/app/App_Resources/Android/src/main/AndroidManifest.xml
similarity index 64%
rename from apps/app/App_Resources/Android/AndroidManifest.xml
rename to tests/app/App_Resources/Android/src/main/AndroidManifest.xml
index 93e4c008e..a0c6d1a06 100644
--- a/apps/app/App_Resources/Android/AndroidManifest.xml
+++ b/tests/app/App_Resources/Android/src/main/AndroidManifest.xml
@@ -10,42 +10,29 @@
android:largeScreens="true"
android:xlargeScreens="true"/>
-
-
+
-
-
-
-
-
+ android:theme="@style/AppTheme">
+ android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout|locale|uiMode"
+ android:theme="@style/LaunchScreenTheme">
-
+
+
+
-
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png b/tests/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png
new file mode 100644
index 000000000..eb381c258
Binary files /dev/null and b/tests/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png differ
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png b/tests/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png
new file mode 100644
index 000000000..9cde84cd5
Binary files /dev/null and b/tests/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png differ
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png b/tests/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png
new file mode 100644
index 000000000..5218f4c90
Binary files /dev/null and b/tests/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png differ
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png b/tests/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png
new file mode 100644
index 000000000..748b2adf5
Binary files /dev/null and b/tests/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png differ
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png b/tests/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png
new file mode 100644
index 000000000..4d6a674b3
Binary files /dev/null and b/tests/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png differ
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png b/tests/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png
new file mode 100644
index 000000000..b9e102a76
Binary files /dev/null and b/tests/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png differ
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png b/tests/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png
new file mode 100644
index 000000000..efeaf2907
Binary files /dev/null and b/tests/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png differ
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png b/tests/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png
new file mode 100644
index 000000000..92ccc85a6
Binary files /dev/null and b/tests/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png differ
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png b/tests/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png
new file mode 100644
index 000000000..626338766
Binary files /dev/null and b/tests/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png differ
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml b/tests/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml
new file mode 100644
index 000000000..ada77f92c
--- /dev/null
+++ b/tests/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml
@@ -0,0 +1,8 @@
+
+ -
+
+
+ -
+
+
+
\ No newline at end of file
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png b/tests/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png
new file mode 100644
index 000000000..612bbd072
Binary files /dev/null and b/tests/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png differ
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png b/tests/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png
new file mode 100644
index 000000000..8bcde6277
Binary files /dev/null and b/tests/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png differ
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png b/tests/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png
new file mode 100644
index 000000000..ad8ee2f4b
Binary files /dev/null and b/tests/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png differ
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png b/tests/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png
new file mode 100644
index 000000000..0fa88e235
Binary files /dev/null and b/tests/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png differ
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png b/tests/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png
new file mode 100644
index 000000000..9d81c85dc
Binary files /dev/null and b/tests/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png differ
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png b/tests/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png
new file mode 100644
index 000000000..668327832
Binary files /dev/null and b/tests/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png differ
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png b/tests/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png
new file mode 100644
index 000000000..c650f6438
Binary files /dev/null and b/tests/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png differ
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png b/tests/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png
new file mode 100644
index 000000000..9a34d0d43
Binary files /dev/null and b/tests/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png differ
diff --git a/tests/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png b/tests/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png
new file mode 100644
index 000000000..fa6331c8d
Binary files /dev/null and b/tests/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png differ
diff --git a/tests/app/App_Resources/Android/src/main/res/values-v21/colors.xml b/tests/app/App_Resources/Android/src/main/res/values-v21/colors.xml
new file mode 100644
index 000000000..a64641a9d
--- /dev/null
+++ b/tests/app/App_Resources/Android/src/main/res/values-v21/colors.xml
@@ -0,0 +1,4 @@
+
+
+ #3d5afe
+
\ No newline at end of file
diff --git a/tests/app/App_Resources/Android/src/main/res/values-v21/styles.xml b/tests/app/App_Resources/Android/src/main/res/values-v21/styles.xml
new file mode 100644
index 000000000..dac8727c8
--- /dev/null
+++ b/tests/app/App_Resources/Android/src/main/res/values-v21/styles.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/app/App_Resources/Android/src/main/res/values/colors.xml b/tests/app/App_Resources/Android/src/main/res/values/colors.xml
new file mode 100644
index 000000000..74ad8829c
--- /dev/null
+++ b/tests/app/App_Resources/Android/src/main/res/values/colors.xml
@@ -0,0 +1,7 @@
+
+
+ #F5F5F5
+ #757575
+ #33B5E5
+ #272734
+
\ No newline at end of file
diff --git a/tests/app/App_Resources/Android/src/main/res/values/styles.xml b/tests/app/App_Resources/Android/src/main/res/values/styles.xml
new file mode 100644
index 000000000..c793e6d4c
--- /dev/null
+++ b/tests/app/App_Resources/Android/src/main/res/values/styles.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/app/App_Resources/Android/values/strings.xml b/tests/app/App_Resources/Android/values/strings.xml
deleted file mode 100644
index e04effe66..000000000
--- a/tests/app/App_Resources/Android/values/strings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- UnitTestApp
- UnitTestApp
-
\ No newline at end of file
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 000000000..1a8b0e645
--- /dev/null
+++ b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,122 @@
+{
+ "images" : [
+ {
+ "size" : "20x20",
+ "idiom" : "iphone",
+ "filename" : "icon-20@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "iphone",
+ "filename" : "icon-20@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "icon-29.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "icon-29@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "icon-29@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "icon-40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "icon-40@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "icon-60@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "icon-60@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "ipad",
+ "filename" : "icon-20.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "ipad",
+ "filename" : "icon-20@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "icon-29.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "icon-29@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "icon-40.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "icon-40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "icon-76.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "icon-76@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "83.5x83.5",
+ "idiom" : "ipad",
+ "filename" : "icon-83.5@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "1024x1024",
+ "idiom" : "ios-marketing",
+ "filename" : "icon-1024.png",
+ "scale" : "1x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png
new file mode 100644
index 000000000..a1d7eb479
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png
new file mode 100644
index 000000000..5797bdef4
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png
new file mode 100644
index 000000000..a0bc5691b
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png
new file mode 100644
index 000000000..851ac65fb
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png
new file mode 100644
index 000000000..bb9b9e86d
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png
new file mode 100644
index 000000000..ec609dcf3
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png
new file mode 100644
index 000000000..a97180800
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png
new file mode 100644
index 000000000..214800ee6
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png
new file mode 100644
index 000000000..8554b88a8
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png
new file mode 100644
index 000000000..a22626bae
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png
new file mode 100644
index 000000000..a22626bae
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png
new file mode 100644
index 000000000..492c9c8e8
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png
new file mode 100644
index 000000000..9208113cf
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png
new file mode 100644
index 000000000..24415e5a3
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png
new file mode 100644
index 000000000..b3ef1bf0c
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/Contents.json b/tests/app/App_Resources/iOS/Assets.xcassets/Contents.json
new file mode 100644
index 000000000..da4a164c9
--- /dev/null
+++ b/tests/app/App_Resources/iOS/Assets.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json
new file mode 100644
index 000000000..bb3b4a5f6
--- /dev/null
+++ b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json
@@ -0,0 +1,212 @@
+{
+ "images" : [
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "2688h",
+ "filename" : "Default-Portrait-XS-Max.png",
+ "minimum-system-version" : "12.0",
+ "orientation" : "portrait",
+ "scale" : "3x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "2688h",
+ "filename" : "Default-Landscape-XS-Max.png",
+ "minimum-system-version" : "12.0",
+ "orientation" : "landscape",
+ "scale" : "3x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "1792h",
+ "filename" : "Default-Portrait-XR.png",
+ "minimum-system-version" : "12.0",
+ "orientation" : "portrait",
+ "scale" : "2x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "1792h",
+ "filename" : "Default-Landscape-XR.png",
+ "minimum-system-version" : "12.0",
+ "orientation" : "landscape",
+ "scale" : "2x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "2436h",
+ "filename" : "Default-1125h.png",
+ "minimum-system-version" : "11.0",
+ "orientation" : "portrait",
+ "scale" : "3x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "2436h",
+ "filename" : "Default-Landscape-X.png",
+ "minimum-system-version" : "11.0",
+ "orientation" : "landscape",
+ "scale" : "3x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "736h",
+ "filename" : "Default-736h@3x.png",
+ "minimum-system-version" : "8.0",
+ "orientation" : "portrait",
+ "scale" : "3x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "736h",
+ "filename" : "Default-Landscape@3x.png",
+ "minimum-system-version" : "8.0",
+ "orientation" : "landscape",
+ "scale" : "3x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "667h",
+ "filename" : "Default-667h@2x.png",
+ "minimum-system-version" : "8.0",
+ "orientation" : "portrait",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "iphone",
+ "filename" : "Default@2x.png",
+ "extent" : "full-screen",
+ "minimum-system-version" : "7.0",
+ "scale" : "2x"
+ },
+ {
+ "extent" : "full-screen",
+ "idiom" : "iphone",
+ "subtype" : "retina4",
+ "filename" : "Default-568h@2x.png",
+ "minimum-system-version" : "7.0",
+ "orientation" : "portrait",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "ipad",
+ "filename" : "Default-Portrait.png",
+ "extent" : "full-screen",
+ "minimum-system-version" : "7.0",
+ "scale" : "1x"
+ },
+ {
+ "orientation" : "landscape",
+ "idiom" : "ipad",
+ "filename" : "Default-Landscape.png",
+ "extent" : "full-screen",
+ "minimum-system-version" : "7.0",
+ "scale" : "1x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "ipad",
+ "filename" : "Default-Portrait@2x.png",
+ "extent" : "full-screen",
+ "minimum-system-version" : "7.0",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "landscape",
+ "idiom" : "ipad",
+ "filename" : "Default-Landscape@2x.png",
+ "extent" : "full-screen",
+ "minimum-system-version" : "7.0",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "iphone",
+ "filename" : "Default.png",
+ "extent" : "full-screen",
+ "scale" : "1x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "iphone",
+ "filename" : "Default@2x.png",
+ "extent" : "full-screen",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "iphone",
+ "filename" : "Default-568h@2x.png",
+ "extent" : "full-screen",
+ "subtype" : "retina4",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "ipad",
+ "extent" : "to-status-bar",
+ "scale" : "1x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "ipad",
+ "filename" : "Default-Portrait.png",
+ "extent" : "full-screen",
+ "scale" : "1x"
+ },
+ {
+ "orientation" : "landscape",
+ "idiom" : "ipad",
+ "extent" : "to-status-bar",
+ "scale" : "1x"
+ },
+ {
+ "orientation" : "landscape",
+ "idiom" : "ipad",
+ "filename" : "Default-Landscape.png",
+ "extent" : "full-screen",
+ "scale" : "1x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "ipad",
+ "extent" : "to-status-bar",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "portrait",
+ "idiom" : "ipad",
+ "filename" : "Default-Portrait@2x.png",
+ "extent" : "full-screen",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "landscape",
+ "idiom" : "ipad",
+ "extent" : "to-status-bar",
+ "scale" : "2x"
+ },
+ {
+ "orientation" : "landscape",
+ "idiom" : "ipad",
+ "filename" : "Default-Landscape@2x.png",
+ "extent" : "full-screen",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png
new file mode 100644
index 000000000..2913f85d9
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png
new file mode 100644
index 000000000..d7f17fcd2
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png
new file mode 100644
index 000000000..b88415405
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png
new file mode 100644
index 000000000..faab4b631
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png
new file mode 100644
index 000000000..cd94a3ac2
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XR.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XR.png
new file mode 100644
index 000000000..686fda12d
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XR.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XS-Max.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XS-Max.png
new file mode 100644
index 000000000..415e9c861
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-XS-Max.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png
new file mode 100644
index 000000000..3365ba3cd
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png
new file mode 100644
index 000000000..a44945c1a
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png
new file mode 100644
index 000000000..e6dca6269
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XR.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XR.png
new file mode 100644
index 000000000..b66a4f2d5
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XR.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XS-Max.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XS-Max.png
new file mode 100644
index 000000000..e34463dd1
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait-XS-Max.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png
new file mode 100644
index 000000000..1a5007962
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png
new file mode 100644
index 000000000..73d8b920f
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png
new file mode 100644
index 000000000..9f1f6ce3e
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png
new file mode 100644
index 000000000..514fc5cde
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json
new file mode 100644
index 000000000..ab5edd0ca
--- /dev/null
+++ b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json
@@ -0,0 +1,23 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchScreen-AspectFill.png",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchScreen-AspectFill@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchScreen-AspectFill@3x.png",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png
new file mode 100644
index 000000000..c293f9c7a
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png
new file mode 100644
index 000000000..233693a6e
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@3x.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@3x.png
new file mode 100644
index 000000000..a954cc8f4
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@3x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json
new file mode 100644
index 000000000..444d7152d
--- /dev/null
+++ b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json
@@ -0,0 +1,23 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchScreen-Center.png",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchScreen-Center@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchScreen-Center@3x.png",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png
new file mode 100644
index 000000000..a5a775a2b
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png
new file mode 100644
index 000000000..154c19343
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png differ
diff --git a/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@3x.png b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@3x.png
new file mode 100644
index 000000000..b2973b025
Binary files /dev/null and b/tests/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@3x.png differ
diff --git a/tests/app/App_Resources/iOS/Default-Landscape-568h@2x.png b/tests/app/App_Resources/iOS/Default-Landscape-568h@2x.png
deleted file mode 100644
index d21bd292b..000000000
Binary files a/tests/app/App_Resources/iOS/Default-Landscape-568h@2x.png and /dev/null differ
diff --git a/tests/app/App_Resources/iOS/Default-Landscape-667h@2x.png b/tests/app/App_Resources/iOS/Default-Landscape-667h@2x.png
deleted file mode 100644
index 5305bbdf2..000000000
Binary files a/tests/app/App_Resources/iOS/Default-Landscape-667h@2x.png and /dev/null differ
diff --git a/tests/app/App_Resources/iOS/Icon-Small-50.png b/tests/app/App_Resources/iOS/Icon-Small-50.png
deleted file mode 100755
index 4a62478f9..000000000
Binary files a/tests/app/App_Resources/iOS/Icon-Small-50.png and /dev/null differ
diff --git a/tests/app/App_Resources/iOS/Icon-Small-50@2x.png b/tests/app/App_Resources/iOS/Icon-Small-50@2x.png
deleted file mode 100755
index 01ff7c16c..000000000
Binary files a/tests/app/App_Resources/iOS/Icon-Small-50@2x.png and /dev/null differ
diff --git a/tests/app/App_Resources/iOS/Icon-Small.png b/tests/app/App_Resources/iOS/Icon-Small.png
deleted file mode 100755
index 9e13a222a..000000000
Binary files a/tests/app/App_Resources/iOS/Icon-Small.png and /dev/null differ
diff --git a/tests/app/App_Resources/iOS/Icon-Small@2x.png b/tests/app/App_Resources/iOS/Icon-Small@2x.png
deleted file mode 100755
index 89dd84cd8..000000000
Binary files a/tests/app/App_Resources/iOS/Icon-Small@2x.png and /dev/null differ
diff --git a/tests/app/App_Resources/iOS/Info.plist b/tests/app/App_Resources/iOS/Info.plist
index 8c9f281bb..ea3e3ea23 100644
--- a/tests/app/App_Resources/iOS/Info.plist
+++ b/tests/app/App_Resources/iOS/Info.plist
@@ -8,25 +8,6 @@
${PRODUCT_NAME}
CFBundleExecutable
${EXECUTABLE_NAME}
- CFBundleIconFile
- icon.png
- CFBundleIcons
-
- CFBundlePrimaryIcon
-
- CFBundleIconFiles
-
- icon-40
- icon-60
- icon-72
- icon-76
- Icon-Small
- Icon-Small-50
-
- UIPrerenderedIcon
-
-
-
CFBundleInfoDictionaryVersion
6.0
CFBundleName
@@ -62,10 +43,5 @@
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
- NSAppTransportSecurity
-
- NSAllowsArbitraryLoads
-
-
diff --git a/tests/app/App_Resources/iOS/LaunchScreen.storyboard b/tests/app/App_Resources/iOS/LaunchScreen.storyboard
new file mode 100644
index 000000000..c4e5a3f39
--- /dev/null
+++ b/tests/app/App_Resources/iOS/LaunchScreen.storyboard
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/app/App_Resources/iOS/build.xcconfig b/tests/app/App_Resources/iOS/build.xcconfig
index 26e7a5841..9d738435d 100644
--- a/tests/app/App_Resources/iOS/build.xcconfig
+++ b/tests/app/App_Resources/iOS/build.xcconfig
@@ -1,5 +1,7 @@
// You can add custom settings here
// for example you can uncomment the following line to force distribution code signing
// CODE_SIGN_IDENTITY = iPhone Distribution
-// ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
-// ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = Brand Assets;
+// To build for device with XCode 8 you need to specify your development team. More info: https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html
+// DEVELOPMENT_TEAM = YOUR_TEAM_ID;
+ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
diff --git a/tests/app/App_Resources/iOS/icon-40.png b/tests/app/App_Resources/iOS/icon-40.png
deleted file mode 100755
index 9b36ac4fe..000000000
Binary files a/tests/app/App_Resources/iOS/icon-40.png and /dev/null differ
diff --git a/tests/app/App_Resources/iOS/icon-40@2x.png b/tests/app/App_Resources/iOS/icon-40@2x.png
deleted file mode 100755
index 8ce4b8899..000000000
Binary files a/tests/app/App_Resources/iOS/icon-40@2x.png and /dev/null differ
diff --git a/tests/app/App_Resources/iOS/icon-60.png b/tests/app/App_Resources/iOS/icon-60.png
deleted file mode 100755
index d2e951831..000000000
Binary files a/tests/app/App_Resources/iOS/icon-60.png and /dev/null differ
diff --git a/tests/app/App_Resources/iOS/icon-60@2x.png b/tests/app/App_Resources/iOS/icon-60@2x.png
deleted file mode 100755
index 693f67f66..000000000
Binary files a/tests/app/App_Resources/iOS/icon-60@2x.png and /dev/null differ
diff --git a/tests/app/App_Resources/iOS/icon-72.png b/tests/app/App_Resources/iOS/icon-72.png
deleted file mode 100755
index 556bdd688..000000000
Binary files a/tests/app/App_Resources/iOS/icon-72.png and /dev/null differ
diff --git a/tests/app/App_Resources/iOS/icon-72@2x.png b/tests/app/App_Resources/iOS/icon-72@2x.png
deleted file mode 100755
index 4f69cb25b..000000000
Binary files a/tests/app/App_Resources/iOS/icon-72@2x.png and /dev/null differ
diff --git a/tests/app/App_Resources/iOS/icon-76.png b/tests/app/App_Resources/iOS/icon-76.png
deleted file mode 100755
index 1c659c62a..000000000
Binary files a/tests/app/App_Resources/iOS/icon-76.png and /dev/null differ
diff --git a/tests/app/App_Resources/iOS/icon-76@2x.png b/tests/app/App_Resources/iOS/icon-76@2x.png
deleted file mode 100755
index bcc126d30..000000000
Binary files a/tests/app/App_Resources/iOS/icon-76@2x.png and /dev/null differ
diff --git a/tests/app/App_Resources/iOS/splashscreen.png b/tests/app/App_Resources/iOS/splashscreen.png
deleted file mode 100644
index a157c4dda..000000000
Binary files a/tests/app/App_Resources/iOS/splashscreen.png and /dev/null differ
diff --git a/tests/app/App_Resources/package.json b/tests/app/App_Resources/package.json
deleted file mode 100644
index 08e44e117..000000000
--- a/tests/app/App_Resources/package.json
+++ /dev/null
@@ -1,2 +0,0 @@
-{ "name" : "app-resources",
- "main" : "dummy.js" }
diff --git a/tests/app/app-root.xml b/tests/app/app-root.xml
new file mode 100644
index 000000000..54e70d976
--- /dev/null
+++ b/tests/app/app-root.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/tests/app/app.css b/tests/app/app.css
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/app/app/app.ts b/tests/app/app.ts
similarity index 84%
rename from tests/app/app/app.ts
rename to tests/app/app.ts
index 10dd7bb5c..80567d787 100644
--- a/tests/app/app/app.ts
+++ b/tests/app/app.ts
@@ -1,8 +1,7 @@
-var start;
+let start;
if (typeof NSDate !== "undefined") {
start = NSDate.date();
-}
-else {
+} else {
start = java.lang.System.currentTimeMillis();
}
@@ -11,7 +10,7 @@ import * as application from "tns-core-modules/application";
if (application.ios) {
// Observe application notifications.
application.ios.addNotificationObserver(UIApplicationDidFinishLaunchingNotification, (notification: NSNotification) => {
- console.log("UIApplicationDidFinishLaunchingNotification: " + notification)
+ console.log("UIApplicationDidFinishLaunchingNotification: " + notification);
});
}
@@ -20,11 +19,11 @@ application.on(application.displayedEvent, function (args: application.Applicati
(global).isDisplayedEventFired = true;
if (args.android) {
- // For Android applications, args.android is an android activity class.
- console.log("Activity: " + args.android);
+ // For Android applications, args.android is an Android activity class.
+ console.log("Displayed Activity: " + args.android);
} else if (args.ios) {
// For iOS applications, args.ios is UIApplication.
- console.log("UIApplication: " + args.ios);
+ console.log("Displayed UIApplication: " + args.ios);
}
});
@@ -40,44 +39,45 @@ application.on(application.launchEvent, function (args: application.ApplicationE
application.on(application.suspendEvent, function (args: application.ApplicationEventData) {
if (args.android) {
- // For Android applications, args.android is an android activity class.
- console.log("Activity: " + args.android);
+ // For Android applications, args.android is an Android activity class.
+ console.log("Suspend Activity: " + args.android);
} else if (args.ios) {
// For iOS applications, args.ios is UIApplication.
- console.log("UIApplication: " + args.ios);
+ console.log("Suspend UIApplication: " + args.ios);
}
});
application.on(application.resumeEvent, function (args: application.ApplicationEventData) {
if (args.android) {
- // For Android applications, args.android is an android activity class.
- console.log("Activity: " + args.android);
+ // For Android applications, args.android is an Android activity class.
+ console.log("Resume Activity: " + args.android);
} else if (args.ios) {
// For iOS applications, args.ios is UIApplication.
- console.log("UIApplication: " + args.ios);
+ console.log("Resume UIApplication: " + args.ios);
}
});
application.on(application.exitEvent, function (args: application.ApplicationEventData) {
if (args.android) {
- // For Android applications, args.android is an android activity class.
- console.log("Activity: " + args.android);
+ // For Android applications, args.android is an Android activity class.
+ console.log("Exit Activity: " + args.android);
} else if (args.ios) {
// For iOS applications, args.ios is UIApplication.
- console.log("UIApplication: " + args.ios);
+ console.log("Exit UIApplication: " + args.ios);
}
});
application.on(application.lowMemoryEvent, function (args: application.ApplicationEventData) {
if (args.android) {
- // For Android applications, args.android is an android activity class.
- console.log("Activity: " + args.android);
+ // For Android applications, args.android is an Android activity class.
+ console.log("Low Memory: " + args.android);
} else if (args.ios) {
// For iOS applications, args.ios is UIApplication.
- console.log("UIApplication: " + args.ios);
+ console.log("Low Memory: " + args.ios);
}
});
+// Error events.
application.on(application.uncaughtErrorEvent, function (args: application.UnhandledErrorEventData) {
console.log("NativeScriptError: " + args.error);
console.log((args.error).nativeException || (args.error).nativeError);
@@ -90,7 +90,7 @@ application.on(application.discardedErrorEvent, function (args: application.Disc
console.log((args.error).stackTrace || (args.error).stack);
});
-// Android activity events
+// Android activity events.
if (application.android) {
application.android.on(application.AndroidApplication.activityCreatedEvent, function (args: application.AndroidActivityBundleEventData) {
console.log("Event: " + args.eventName + ", Activity: " + args.activity + ", Bundle: " + args.bundle);
@@ -135,14 +135,13 @@ if (application.android) {
});
}
-var time;
+let time;
if (typeof NSDate !== "undefined") {
time = NSDate.date().timeIntervalSinceDate(start) * 1000;
-}
-else {
+} else {
time = java.lang.System.currentTimeMillis() - start;
}
console.log(`TIME TO LOAD APP: ${time} ms`);
-application.run({ moduleName: "app/appRoot" });
+application.run({ moduleName: "app-root" });
diff --git a/tests/app/app/appRoot.xml b/tests/app/app/appRoot.xml
deleted file mode 100644
index b78a0e763..000000000
--- a/tests/app/app/appRoot.xml
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/tests/app/app/button-page.xml b/tests/app/app/button-page.xml
deleted file mode 100644
index 21dc437ae..000000000
--- a/tests/app/app/button-page.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/tests/app/app/mainPage.xml b/tests/app/app/mainPage.xml
deleted file mode 100644
index 7cead486d..000000000
--- a/tests/app/app/mainPage.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/tests/app/app/package.json b/tests/app/app/package.json
deleted file mode 100644
index 780cb595f..000000000
--- a/tests/app/app/package.json
+++ /dev/null
@@ -1,2 +0,0 @@
-{ "name" : "testsapp",
- "main" : "app.js" }
diff --git a/tests/app/app/pageNavigation.ts b/tests/app/app/pageNavigation.ts
deleted file mode 100644
index 66b3bd4b2..000000000
--- a/tests/app/app/pageNavigation.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import * as frame from "tns-core-modules/ui/frame";
-import * as pages from "tns-core-modules/ui/page";
-import * as buttonModule from "tns-core-modules/ui/button";
-import * as tabViewModule from "tns-core-modules/ui/tab-view";
-
-export function createPage() {
- var tab = new tabViewModule.TabView();
- tab.items = [];
- for (var i = 0; i < 10; i++) {
-
- var button = new buttonModule.Button();
- button.text = "Test";
- button.on(buttonModule.Button.tapEvent, function () {
- var topFrame = frame.topmost();
- topFrame.goBack();
- });
-
- let item = new tabViewModule.TabViewItem();
- item.title = "Tab " + i;
- item.view = button;
- tab.items.push(item);
- }
- var page = new pages.Page();
- page.content = tab;
- return page;
-}
-//export var Page = new pages.Page();
diff --git a/tests/app/app/style_props.ts b/tests/app/app/style_props.ts
deleted file mode 100644
index df3179561..000000000
--- a/tests/app/app/style_props.ts
+++ /dev/null
@@ -1,102 +0,0 @@
-import * as buttonModule from "tns-core-modules/ui/button";
-import * as pages from "tns-core-modules/ui/page";
-import * as stackLayoutDef from "tns-core-modules/ui/layouts/stack-layout";
-
-// import {isAndroid} from "platform";
-// import * as style from "ui/styling/style";
-// import {PropertyMetadata, PropertyMetadataSettings} from "ui/core/dependency-observable";
-// import * as view from "ui/core/view";
-
-// on Android we explicitly set propertySettings to None because android will invalidate its layout (skip unnecessary native call).
-// let AffectsLayout = isAndroid ? PropertyMetadataSettings.None : PropertyMetadataSettings.AffectsLayout;
-
-// export var fontFamilyProperty = new styleProperty.Property("fontFamily", "font-family", new PropertyMetadata(undefined, AffectsLayout));
-
-// export class MyTextViewStyler implements style.Styler {
-// public static setFontFamilyProperty(view: view.View, newValue: any) {
-// if (view.android) {
-// (view.android).setTypeface(android.graphics.Typeface.create(newValue, android.graphics.Typeface.NORMAL));
-// }
-// else if (view.ios) {
-// var fontSize = (view._nativeView).titleLabel.font.pointSize;
-// (view._nativeView).titleLabel.font = UIFont.fontWithNameSize(newValue, fontSize);
-// }
-// }
-
-// public static resetFontFamilyProperty(view: view.View, nativeValue: any) {
-// if (view.android) {
-// (view.android).setTypeface(android.graphics.Typeface.create(nativeValue, android.graphics.Typeface.NORMAL));
-// }
-// else if (view.ios) {
-// var fontSize = (view._nativeView).titleLabel.font.pointSize;
-// (view._nativeView).titleLabel.font = UIFont.fontWithNameSize(nativeValue, fontSize);
-// }
-// }
-
-// public static getNativeFontFamilyValue = function (view: view.View): any {
-// if (view.android) {
-// return (view.android).getTypeface();
-// }
-// else if (view.ios) {
-// return (view._nativeView).titleLabel.font.fontName;
-// }
-// return null;
-// }
-
-// public static registerHandlers() {
-// style.registerHandler(fontFamilyProperty, new style.StylePropertyChangedHandler(
-// MyTextViewStyler.setFontFamilyProperty,
-// MyTextViewStyler.resetFontFamilyProperty,
-// MyTextViewStyler.getNativeFontFamilyValue), "MyButton");
-// }
-// }
-
-//export class MyStyle extends styles.Style {
-// get fontFamily(): string {
-// return this._getValue(fontFamilyProperty);
-// }
-// set fontFamily(value: string) {
-// this._setValue(fontFamilyProperty, value, observable.ValueSource.Local);
-// }
-//}
-
-//Object.defineProperty(styles.Style.prototype, "fontFamily", {
-// get: function () {
-// return this._getValue(fontFamilyProperty);
-// },
-// set: function (value) {
-// this._setValue(fontFamilyProperty, value, observable.ValueSource.Local);
-// },
-// enumerable: true,
-// configurable: true
-//});
-
-export class MyButton extends buttonModule.Button {
-
-}
-
-// MyTextViewStyler.registerHandlers();
-
-export function createPage() {
- var stackLayout = new stackLayoutDef.StackLayout();
-
- var btn = new MyButton();
- btn.text = "Alabala";
- btn.id = "btn";
-
- var btn1 = new MyButton();
- btn1.text = "Alabala";
- btn1.id = "btn1";
-
- var btn2 = new buttonModule.Button();
- btn2.text = "Alabala";
-
- stackLayout.addChild(btn);
- stackLayout.addChild(btn1);
- stackLayout.addChild(btn2);
-
- var page = new pages.Page();
- page.css = "#btn {font-family: Courier New} #btn1 {font-family: Times New Roman} #btn2 {color: yellow}";
- page.content = stackLayout;
- return page;
-}
diff --git a/tests/app/app/testPage.ts b/tests/app/app/testPage.ts
deleted file mode 100644
index 0e3e68183..000000000
--- a/tests/app/app/testPage.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import * as frame from "tns-core-modules/ui/frame";
-
-export function buttonTap(args) {
- frame.topmost().goBack();
-}
diff --git a/tests/app/app/testPage.xml b/tests/app/app/testPage.xml
deleted file mode 100644
index bfde57363..000000000
--- a/tests/app/app/testPage.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/tests/app/app/testRunnerPage.ts b/tests/app/app/testRunnerPage.ts
deleted file mode 100644
index f07e71e73..000000000
--- a/tests/app/app/testRunnerPage.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-import * as tests from "../testRunner";
-import * as pages from "tns-core-modules/ui/page";
-import * as bm from "tns-core-modules/ui/button";
-import * as listViewDef from "tns-core-modules/ui/list-view";
-import * as trace from "tns-core-modules/trace";
-trace.enable();
-trace.addCategories(trace.categories.Test + "," + trace.categories.Error);
-
-export function createPage() {
- var data: string[] = [""];
- for (var testModule in tests.allTests) {
- data.push(testModule);
- }
-
- var listView = new listViewDef.ListView();
-
- listView.on(listViewDef.ListView.itemLoadingEvent, (args: listViewDef.ItemEventData) => {
- var btn = args.view;
- if (btn) {
- btn.off(bm.Button.tapEvent);
- }
- else {
- btn = new bm.Button();
- args.view = btn;
- }
-
- if (!data[args.index]) {
- btn.text = "Run all";
- btn.on(bm.Button.tapEvent, function () {
- tests.runAll();
- });
- } else {
- var testModule = data[args.index];
- btn.text = testModule;
- btn.on(bm.Button.tapEvent, function () {
- tests.runAll(testModule);
- });
- }
- });
-
- listView.items = data;
-
- var page = new pages.Page();
- page.content = listView;
- return page;
-}
-//export var Page = page;
diff --git a/tests/app/application-settings/application-settings-tests.ts b/tests/app/application-settings/application-settings-tests.ts
index 03b8b4e4b..4ce83cecb 100644
--- a/tests/app/application-settings/application-settings-tests.ts
+++ b/tests/app/application-settings/application-settings-tests.ts
@@ -1,5 +1,5 @@
-var appSettings = require("tns-core-modules/application-settings");
-import * as TKUnit from "../TKUnit";
+var appSettings = require("tns-core-modules/application-settings");
+import * as TKUnit from "../tk-unit";
var stringKey: string = "stringKey";
var boolKey: string = "boolKey";
@@ -42,7 +42,7 @@ export var testDefaults = function () {
TKUnit.assert("No string value" === defaultValue, "Bad default string value");
TKUnit.assert(true === appSettings.getBoolean(noBoolKey, true), "Bad default boolean value");
TKUnit.assert(123.45 === appSettings.getNumber(noNumberKey, 123.45), "Bad default number value");
-}
+};
export var testDefaultsWithNoDefaultValueProvided = function () {
var defaultValue = appSettings.getString("noStringKey");
@@ -106,7 +106,7 @@ export var testAllKeys = function () {
TKUnit.assert(allKeys.indexOf(stringKey) !== -1, `${stringKey} is missing from .allKeys()`);
TKUnit.assert(allKeys.indexOf(boolKey) !== -1, `${boolKey} is missing from .allKeys()`);
TKUnit.assert(allKeys.indexOf(numberKey) !== -1, `${numberKey} is missing from .allKeys()`);
-}
+};
export var testInvalidKey = function () {
try {
diff --git a/tests/app/application/application-tests-common.ts b/tests/app/application/application-tests-common.ts
index 29be43736..aa821b436 100644
--- a/tests/app/application/application-tests-common.ts
+++ b/tests/app/application/application-tests-common.ts
@@ -11,7 +11,7 @@ if (app.android) {
}
// << application-app-check
-import * as TKUnit from "../TKUnit";
+import * as TKUnit from "../tk-unit";
export function testInitialized() {
if (platform.device.os === platform.platformNames.android) {
diff --git a/tests/app/application/application-tests.android.ts b/tests/app/application/application-tests.android.ts
index 3964b8bb1..3150ba958 100644
--- a/tests/app/application/application-tests.android.ts
+++ b/tests/app/application/application-tests.android.ts
@@ -1,9 +1,8 @@
/* tslint:disable:no-unused-variable */
import * as app from "tns-core-modules/application";
-import * as TKUnit from "../TKUnit";
-import * as commonTests from "./application-tests-common";
+import * as TKUnit from "../tk-unit";
-global.moduleMerge(commonTests, exports);
+export * from "./application-tests-common";
// >> application-app-android
var androidApp = app.android;
@@ -41,10 +40,9 @@ if (app.android) {
export var testAndroidApplicationInitialized = function () {
TKUnit.assert(app.android, "Android application not initialized.");
TKUnit.assert(app.android.context, "Android context not initialized.");
- TKUnit.assert(app.android.currentContext, "Android currentContext not initialized.");
TKUnit.assert(app.android.foregroundActivity, "Android foregroundActivity not initialized.");
TKUnit.assert(app.android.foregroundActivity.isNativeScriptActivity, "Andorid foregroundActivity.isNativeScriptActivity is true");
TKUnit.assert(app.android.startActivity, "Android startActivity not initialized.");
TKUnit.assert(app.android.nativeApp, "Android nativeApp not initialized.");
TKUnit.assert(app.android.packageName, "Android packageName not initialized.");
-}
+};
diff --git a/tests/app/application/application-tests.ios.ts b/tests/app/application/application-tests.ios.ts
index b019da98f..42239a6ca 100644
--- a/tests/app/application/application-tests.ios.ts
+++ b/tests/app/application/application-tests.ios.ts
@@ -1,8 +1,7 @@
/* tslint:disable:no-unused-variable */
import * as app from "tns-core-modules/application";
-import * as commonTests from "./application-tests-common";
-global.moduleMerge(commonTests, exports);
+export * from "./application-tests-common";
// >> application-ios-observer
//// Add the notification observer
diff --git a/tests/app/test-icon.png b/tests/app/assets/logo.png
similarity index 100%
rename from tests/app/test-icon.png
rename to tests/app/assets/logo.png
diff --git a/tests/app/small-image.png b/tests/app/assets/small-image.png
similarity index 100%
rename from tests/app/small-image.png
rename to tests/app/assets/small-image.png
diff --git a/tests/app/App_Resources/Android/drawable-nodpi/splashscreen.png b/tests/app/assets/splashscreen.png
similarity index 100%
rename from tests/app/App_Resources/Android/drawable-nodpi/splashscreen.png
rename to tests/app/assets/splashscreen.png
diff --git a/tests/app/assets/test-icon.png b/tests/app/assets/test-icon.png
new file mode 100644
index 000000000..add1ce15d
Binary files /dev/null and b/tests/app/assets/test-icon.png differ
diff --git a/tests/app/color/color-tests.ts b/tests/app/color/color-tests.ts
index 02a020ebb..e03a65b92 100644
--- a/tests/app/color/color-tests.ts
+++ b/tests/app/color/color-tests.ts
@@ -1,8 +1,8 @@
-// >> color-require
+// >> color-require
import * as colorModule from "tns-core-modules/color";
var Color = colorModule.Color;
// << color-require
-import * as TKUnit from "../TKUnit";
+import * as TKUnit from "../tk-unit";
export var test_Hex_Color = function () {
// >> color-hex
@@ -15,7 +15,7 @@ export var test_Hex_Color = function () {
TKUnit.assertEqual(color.b, 0, "Color.b not properly parsed");
TKUnit.assertEqual(color.hex, "#FF0000", "Color.hex not properly parsed");
TKUnit.assertEqual(color.argb, 0xFFFF0000, "Color.argb not properly parsed");
-}
+};
export var test_ShortHex_Color = function () {
// >> color-hex-short
@@ -28,7 +28,7 @@ export var test_ShortHex_Color = function () {
TKUnit.assertEqual(color.b, 0, "Color.b not properly parsed");
TKUnit.assertEqual(color.hex, "#FF8800", "Color.hex not properly parsed");
TKUnit.assertEqual(color.argb, 0xFFFF8800, "Color.argb not properly parsed");
-}
+};
export var test_Argb_Color = function () {
// >> color-rgb
@@ -41,7 +41,7 @@ export var test_Argb_Color = function () {
TKUnit.assertEqual(color.b, 100, "Color.b not properly parsed");
TKUnit.assertEqual(color.hex, "#64FF6464", "Color.hex not properly parsed");
TKUnit.assertEqual(color.argb, 0x64FF6464, "Color.argb not properly parsed");
-}
+};
export var test_ArgbInt_Color = function () {
// >> color-rgb-single
@@ -54,7 +54,7 @@ export var test_ArgbInt_Color = function () {
TKUnit.assertEqual(color.b, 100, "Color.b not properly parsed");
TKUnit.assertEqual(color.hex, "#64646464", "Color.hex not properly parsed");
TKUnit.assertEqual(color.argb, 0x64646464, "Color.argb not properly parsed");
-}
+};
export var test_rgb_Color_CSS = function () {
//
@@ -70,7 +70,7 @@ export var test_rgb_Color_CSS = function () {
TKUnit.assertEqual(color.b, 100, "Color.b not properly parsed");
TKUnit.assertEqual(color.hex, "#FF6464", "Color.hex not properly parsed");
TKUnit.assertEqual(color.argb, 0xFFFF6464, "Color.argb not properly parsed");
-}
+};
export var test_rgba_Color_CSS = function () {
var alpha = 0.5;
@@ -88,4 +88,4 @@ export var test_rgba_Color_CSS = function () {
TKUnit.assertEqual(color.b, 100, "Color.b not properly parsed");
TKUnit.assertEqual(color.hex, "#80FF6464", "Color.hex not properly parsed");
TKUnit.assertEqual(color.argb, 0x80FF6464, "Color.argb not properly parsed");
-}
+};
diff --git a/tests/app/connectivity/connectivity-tests.ts b/tests/app/connectivity/connectivity-tests.ts
index e4a57c7af..c0cde0c40 100644
--- a/tests/app/connectivity/connectivity-tests.ts
+++ b/tests/app/connectivity/connectivity-tests.ts
@@ -1,4 +1,4 @@
-// >> connectivity-require
+// >> connectivity-require
import * as connectivity from "tns-core-modules/connectivity";
// << connectivity-require
@@ -17,7 +17,7 @@ export var test_DummyTestForSnippetOnly0 = function () {
break;
}
// << connectivity-type
-}
+};
export var test_DummyTestForSnippetOnly1 = function () {
// >> connectivity-monitoring
@@ -37,4 +37,4 @@ export var test_DummyTestForSnippetOnly1 = function () {
//...
connectivity.stopMonitoring();
// << connectivity-monitoring
-}
+};
diff --git a/tests/app/console/console-tests.ts b/tests/app/console/console-tests.ts
index f674a8a40..74465ed15 100644
--- a/tests/app/console/console-tests.ts
+++ b/tests/app/console/console-tests.ts
@@ -1,11 +1,11 @@
-export var test_DummyTestForSnippetOnly0 = function () {
+export var test_DummyTestForSnippetOnly0 = function () {
// >> console-log
console.log("Hello, world!");
console.info("I am NativeScript");
console.warn("Low memory");
console.error("Uncaught Application Exception");
// << console-log
-}
+};
export var test_DummyTestForSnippetOnly1 = function () {
// >> console-time
@@ -14,23 +14,23 @@ export var test_DummyTestForSnippetOnly1 = function () {
// >> console-timeend
console.timeEnd("LoadTime");
// << console-timeend
-}
+};
export var test_DummyTestForSnippetOnly2 = function () {
// >> console-assert
console.assert(2 === 2, "2 equals 2");
// << console-assert
-}
+};
export var test_DummyTestForSnippetOnly3 = function () {
// >> console-dir
var obj = {name: "John", age: 34};
console.dir(obj);
// << console-dir
-}
+};
export var test_DummyTestForSnippetOnly5 = function () {
// >> console-trace
console.trace();
// << console-trace
-}
\ No newline at end of file
+};
\ No newline at end of file
diff --git a/tests/app/data/observable-array-tests.ts b/tests/app/data/observable-array-tests.ts
index 474cb4af5..11c8b31ac 100644
--- a/tests/app/data/observable-array-tests.ts
+++ b/tests/app/data/observable-array-tests.ts
@@ -1,4 +1,4 @@
-import * as TKUnit from "../TKUnit";
+import * as TKUnit from "../tk-unit";
import { Label } from "tns-core-modules/ui/label";
// >> observable-array-require
import { ObservableArray, ChangedData, ChangeType } from "tns-core-modules/data/observable-array";
diff --git a/tests/app/data/observable-tests.ts b/tests/app/data/observable-tests.ts
index 6e647b5de..bd70c2a2d 100644
--- a/tests/app/data/observable-tests.ts
+++ b/tests/app/data/observable-tests.ts
@@ -1,8 +1,8 @@
-// >> observable-require
+// >> observable-require
import { Observable, fromObject, fromObjectRecursive, PropertyChangeData, EventData, WrappedValue } from "tns-core-modules/data/observable";
// << observable-require
-import * as TKUnit from "../TKUnit";
+import * as TKUnit from "../tk-unit";
import * as types from "tns-core-modules/utils/types";
import { ObservableArray } from "tns-core-modules/data/observable-array";
@@ -29,7 +29,7 @@ export var test_Observable_Constructor = function () {
TKUnit.assert(name === "John", "Expected name is John");
TKUnit.assert(age === 34, "Expected age is 34");
TKUnit.assert(married === true, "Expected married is true");
-}
+};
export var tests_DummyTestForCodeSnippet = function () {
// >> observable-property-change
@@ -46,7 +46,7 @@ export var tests_DummyTestForCodeSnippet = function () {
// propertyChange Age 35
// propertyChange Married false
// << observable-property-change
-}
+};
export var test_Observable_Members = function () {
var obj = new Observable();
@@ -60,7 +60,7 @@ export var test_Observable_Members = function () {
TKUnit.assert(types.isDefined(obj.on), "Observable.on not defined");
TKUnit.assert(types.isDefined(obj.removeEventListener), "Observable.removeEventListener not defined");
TKUnit.assert(types.isDefined(obj.set), "Observable.set not defined");
-}
+};
export var test_Observable_UpdateAnotherPropertyWithinChangedCallback = function () {
var obj = new Observable();
@@ -69,7 +69,7 @@ export var test_Observable_UpdateAnotherPropertyWithinChangedCallback = function
if (pcd.propertyName === "name") {
pcd.object.set("test", "Changed test");
}
- }
+ };
obj.addEventListener(Observable.propertyChangeEvent, changedCallback);
@@ -83,7 +83,7 @@ export var test_Observable_UpdateAnotherPropertyWithinChangedCallback = function
TKUnit.assert(obj.get("name") === "Changed name", "Changed value for property name is not correct!");
TKUnit.assert(obj.get("test") === "Changed test", "Changed value for property test is not correct!");
-}
+};
// export var test_DependencyObservable_UpdateAnotherPropertyWithinChangedCallback = function () {
// var obj = new dependencyObservable.DependencyObservable();
@@ -135,12 +135,12 @@ export var test_Observable_addEventListener_SingleEvent = function () {
TKUnit.assert(data.object === obj, "PropertyChangeData.object value not valid.");
TKUnit.assert(data.propertyName === "testName", "PropertyChangeData.propertyName value not valid.");
TKUnit.assert(data.value === 1, "PropertyChangeData.value value not valid.");
- }
+ };
obj.addEventListener(Observable.propertyChangeEvent, callback);
obj.set("testName", 1);
TKUnit.assert(receivedCount === 1, "PropertyChanged event not raised properly.");
-}
+};
export var test_Observable_addEventListener_MultipleEvents = function () {
var obj = new TestObservable();
@@ -158,14 +158,14 @@ export var test_Observable_addEventListener_MultipleEvents = function () {
} else {
TKUnit.assert(data.eventName === TESTED_NAME, "Expected event name " + TESTED_NAME);
}
- }
+ };
var events = Observable.propertyChangeEvent + "," + TESTED_NAME;
obj.addEventListener(events, callback);
obj.set("testName", 1);
obj.test();
TKUnit.assert(receivedCount === 2, "Callbacks not raised properly.");
-}
+};
export var test_Observable_addEventListener_MultipleEvents_ShouldTrim = function () {
var obj = new TestObservable();
@@ -173,7 +173,7 @@ export var test_Observable_addEventListener_MultipleEvents_ShouldTrim = function
var receivedCount = 0;
var callback = function (data: EventData) {
receivedCount++;
- }
+ };
var events = Observable.propertyChangeEvent + " , " + TESTED_NAME;
obj.addEventListener(events, callback);
@@ -184,7 +184,7 @@ export var test_Observable_addEventListener_MultipleEvents_ShouldTrim = function
obj.test();
TKUnit.assert(receivedCount === 2, "Callbacks not raised properly.");
-}
+};
export var test_Observable_addEventListener_MultipleCallbacks = function () {
var obj = new TestObservable();
@@ -192,18 +192,18 @@ export var test_Observable_addEventListener_MultipleCallbacks = function () {
var receivedCount = 0;
var callback1 = function (data: EventData) {
receivedCount++;
- }
+ };
var callback2 = function (data: EventData) {
receivedCount++;
- }
+ };
obj.addEventListener(Observable.propertyChangeEvent, callback1);
obj.addEventListener(Observable.propertyChangeEvent, callback2);
obj.set("testName", 1);
TKUnit.assert(receivedCount === 2, "The propertyChanged notification should be raised twice.");
-}
+};
export var test_Observable_addEventListener_MultipleCallbacks_MultipleEvents = function () {
var obj = new TestObservable();
@@ -211,11 +211,11 @@ export var test_Observable_addEventListener_MultipleCallbacks_MultipleEvents = f
var receivedCount = 0;
var callback1 = function (data: EventData) {
receivedCount++;
- }
+ };
var callback2 = function (data: EventData) {
receivedCount++;
- }
+ };
var events = Observable.propertyChangeEvent + " , " + TESTED_NAME;
obj.addEventListener(events, callback1);
@@ -225,7 +225,7 @@ export var test_Observable_addEventListener_MultipleCallbacks_MultipleEvents = f
obj.test();
TKUnit.assert(receivedCount === 4, "The propertyChanged notification should be raised twice.");
-}
+};
export var test_Observable_removeEventListener_SingleEvent_SingleCallback = function () {
var obj = new Observable();
@@ -233,7 +233,7 @@ export var test_Observable_removeEventListener_SingleEvent_SingleCallback = func
var receivedCount = 0;
var callback = function (data: EventData) {
receivedCount++;
- }
+ };
obj.addEventListener(Observable.propertyChangeEvent, callback);
obj.set("testName", 1);
@@ -243,7 +243,7 @@ export var test_Observable_removeEventListener_SingleEvent_SingleCallback = func
obj.set("testName", 2);
TKUnit.assert(receivedCount === 1, "Observable.removeEventListener not working properly.");
-}
+};
export var test_Observable_removeEventListener_SingleEvent_MultipleCallbacks = function () {
var obj = new Observable();
@@ -251,11 +251,11 @@ export var test_Observable_removeEventListener_SingleEvent_MultipleCallbacks = f
var receivedCount = 0;
var callback1 = function (data: EventData) {
receivedCount++;
- }
+ };
var callback2 = function (data: EventData) {
receivedCount++;
- }
+ };
obj.addEventListener(Observable.propertyChangeEvent, callback1);
obj.addEventListener(Observable.propertyChangeEvent, callback2);
@@ -272,7 +272,7 @@ export var test_Observable_removeEventListener_SingleEvent_MultipleCallbacks = f
obj.set("testName", 3);
TKUnit.assert(receivedCount === 3, "Observable.removeEventListener not working properly with multiple listeners.");
-}
+};
export var test_Observable_removeEventListener_MutlipleEvents_SingleCallback = function () {
var obj = new TestObservable();
@@ -280,7 +280,7 @@ export var test_Observable_removeEventListener_MutlipleEvents_SingleCallback = f
var receivedCount = 0;
var callback = function (data: EventData) {
receivedCount++;
- }
+ };
var events = Observable.propertyChangeEvent + " , " + TESTED_NAME;
obj.addEventListener(events, callback);
@@ -297,7 +297,7 @@ export var test_Observable_removeEventListener_MutlipleEvents_SingleCallback = f
obj.test();
TKUnit.assert(receivedCount === 2, "Expected receive count is 2");
-}
+};
export var test_Observable_removeEventListener_SingleEvent_NoCallbackSpecified = function () {
var obj = new TestObservable();
@@ -305,11 +305,11 @@ export var test_Observable_removeEventListener_SingleEvent_NoCallbackSpecified =
var receivedCount = 0;
var callback1 = function (data: EventData) {
receivedCount++;
- }
+ };
var callback2 = function (data: EventData) {
receivedCount++;
- }
+ };
obj.addEventListener(Observable.propertyChangeEvent, callback1);
obj.addEventListener(Observable.propertyChangeEvent, callback2);
@@ -321,7 +321,7 @@ export var test_Observable_removeEventListener_SingleEvent_NoCallbackSpecified =
obj.set("testName", 2);
TKUnit.assert(receivedCount === 2, "Expected receive count is 2");
-}
+};
export var test_Observable_WhenCreatedWithJSON_PropertyChangedWithDotNotation_RaisesPropertyChangedEvent = function () {
var json = {
@@ -336,14 +336,14 @@ export var test_Observable_WhenCreatedWithJSON_PropertyChangedWithDotNotation_Ra
TKUnit.assert(data.object === obj, "PropertyChangeData.object value not valid.");
TKUnit.assert(data.propertyName === "count", "PropertyChangeData.propertyName value not valid.");
TKUnit.assert(data.value === 6, "PropertyChangeData.value value not valid.");
- }
+ };
obj.addEventListener(Observable.propertyChangeEvent, callback);
(obj).count++;
TKUnit.assert(receivedCount === 1, "PropertyChanged event not raised properly.");
-}
+};
export var test_Observable_WhenCreatedWithJSON_PropertyChangedWithBracketsNotation_RaisesPropertyChangedEvent = function () {
var json = {
@@ -358,14 +358,14 @@ export var test_Observable_WhenCreatedWithJSON_PropertyChangedWithBracketsNotati
TKUnit.assert(data.object === obj, "PropertyChangeData.object value not valid.");
TKUnit.assert(data.propertyName === "count", "PropertyChangeData.propertyName value not valid.");
TKUnit.assert(data.value === 6, "PropertyChangeData.value value not valid.");
- }
+ };
obj.addEventListener(Observable.propertyChangeEvent, callback);
obj["count"]++;
TKUnit.assert(receivedCount === 1, "PropertyChanged event not raised properly.");
-}
+};
export var test_AddingTwoEventHandlersAndRemovingWithinHandlerShouldRaiseAllEvents = function () {
var observableInstance = new Observable();
@@ -375,12 +375,12 @@ export var test_AddingTwoEventHandlersAndRemovingWithinHandlerShouldRaiseAllEven
var firstHandler = function (args) {
observableInstance.off(Observable.propertyChangeEvent, firstHandler, firstObserver);
firstHandlerCalled = true;
- }
+ };
var secondHandler = function (args) {
observableInstance.off(Observable.propertyChangeEvent, secondHandler, secondObserver);
secondHandlerCalled = true;
- }
+ };
var firstObserver = new Observable();
var secondObserver = new Observable();
@@ -392,7 +392,7 @@ export var test_AddingTwoEventHandlersAndRemovingWithinHandlerShouldRaiseAllEven
TKUnit.assertEqual(firstHandlerCalled, true);
TKUnit.assertEqual(secondHandlerCalled, true);
-}
+};
export var test_ObservableCreatedWithJSON_shouldDistinguishSeparateObjects = function () {
var obj1 = { val: 1 };
@@ -469,7 +469,7 @@ export function test_ObservablesCreatedWithJSON_shouldNotEmitTwoTimesPropertyCha
var propertyChangeCounter = 0;
var propertyChangeHandler = function (args) {
propertyChangeCounter++;
- }
+ };
testObservable.on(Observable.propertyChangeEvent, propertyChangeHandler);
testObservable.set("property1", 2);
@@ -482,7 +482,7 @@ export function test_ObservableShouldEmitPropertyChangeWithSameObjectUsingWrappe
var propertyChangeCounter = 0;
var propertyChangeHandler = function (args) {
propertyChangeCounter++;
- }
+ };
testObservable.on(Observable.propertyChangeEvent, propertyChangeHandler);
testArray.push(2);
@@ -501,7 +501,7 @@ export function test_CorrectEventArgsWhenWrappedValueIsUsed() {
let actualArgsValue;
let propertyChangeHandler = function (args) {
actualArgsValue = args.value;
- }
+ };
testObservable.on(Observable.propertyChangeEvent, propertyChangeHandler);
testArray.push(2);
@@ -575,5 +575,6 @@ export function test_fromObjectRecursive_does_not_override_source_object_propert
const myObj = {};
const source = { name: "a", value: myObj };
const observable = fromObjectRecursive(source);
+ TKUnit.assertNotNull(observable);
TKUnit.assertEqual(source.value, myObj);
-}
\ No newline at end of file
+}
diff --git a/tests/app/data/virtual-array-tests.ts b/tests/app/data/virtual-array-tests.ts
index 54c7df9eb..446836f31 100644
--- a/tests/app/data/virtual-array-tests.ts
+++ b/tests/app/data/virtual-array-tests.ts
@@ -1,4 +1,4 @@
-import * as TKUnit from "../TKUnit";
+import * as TKUnit from "../tk-unit";
import * as types from "tns-core-modules/utils/types";
import * as virtualArrayModule from "tns-core-modules/data/virtual-array";
@@ -42,12 +42,12 @@ export var test_VirtualArray_setItemShouldRaiseChangeEventWhenYouSetDifferentIte
// args.index is start index of the page where the requested index is located.
// args.count number of requested items.
//
- // Note: Virtual array will divide total number of items to pages using "loadSize" property value. When you request an
+ // Note: Virtual array will divide total number of items to pages using "loadSize" property value. When you request an
// item at specific index the array will raise "itemsLoading" event with "ItemsLoading" argument index set to the first index of the requested page
- // and count set to number of items in this page.
+ // and count set to number of items in this page.
//
- // Important: If you have already loaded items in the requested page the array will raise multiple times "itemsLoading" event to request
- // all ranges of still not loaded items in this page.
+ // Important: If you have already loaded items in the requested page the array will raise multiple times "itemsLoading" event to request
+ // all ranges of still not loaded items in this page.
var itemsToLoad = new Array();
for (var i = 0; i < args.count; i++) {
diff --git a/tests/app/debugger/dom-node-tests.ts b/tests/app/debugger/dom-node-tests.ts
index ae7c2c249..f5a7e7845 100644
--- a/tests/app/debugger/dom-node-tests.ts
+++ b/tests/app/debugger/dom-node-tests.ts
@@ -1,4 +1,4 @@
-import { assert, assertEqual } from "../TKUnit";
+import { assert, assertEqual } from "../tk-unit";
import { DOMNode } from "tns-core-modules/debugger/dom-node";
import { attachDOMInspectorCommandCallbacks, attachCSSInspectorCommandCallbacks, attachDOMInspectorEventCallbacks } from "tns-core-modules/debugger/devtools-elements";
import { InspectorCommands, InspectorEvents } from "tns-core-modules/debugger/devtools-elements";
@@ -25,7 +25,7 @@ function getTestInspector(): InspectorCommands & InspectorEvents {
childNodeRemoved(parentId: number, nodeId: number): void { /* to be replaced */ },
attributeModified(nodeId: number, attrName: string, attrValue: string) { /* to be replaced */ },
attributeRemoved(nodeId: number, attrName: string) { /* to be replaced */ }
- }
+ };
attachDOMInspectorCommandCallbacks(inspector);
attachDOMInspectorEventCallbacks(inspector);
@@ -48,7 +48,7 @@ function getIOSDOMInspector() {
getComputedStylesForNode(nodeId: number): any { return []; },
setAttributeAsText(nodeId: number, text: string, name: string): void { /* */ }
}
- }
+ };
}
export function setUp(): void {
@@ -114,7 +114,7 @@ export function test_childNodeInserted_in_dom_node() {
currentInspector.childNodeInserted = (parentId, lastNodeId, node) => {
childNodeInsertedCalled = true;
actualParentId = parentId;
- }
+ };
const stack = new StackLayout();
stack.ensureDomNode();
@@ -155,7 +155,7 @@ export function test_childNodeInserted_at_index_in_dom_node() {
assertEqual(lastNodeId, btn1._domId, "Child inserted at index 1's previous sibling does not match.");
assertEqual(node.toObject().nodeId, lbl._domId, "Child id doesn't match");
called = true;
- }
+ };
stack.insertChild(lbl, 1);
assert(called, "childNodeInserted not called");
@@ -169,7 +169,7 @@ export function test_childNodeRemoved_in_dom_node() {
currentInspector.childNodeRemoved = (parentId, nodeId) => {
childNodeRemovedCalled = true;
actualRemovedNodeId = nodeId;
- }
+ };
const stack = new StackLayout();
stack.ensureDomNode();
@@ -213,7 +213,7 @@ export function test_property_change_calls_attributeModified() {
assertEqual(attrName, "text", "attrName");
assertEqual(attrValue, "new value", "attrValue");
callbackCalled = true;
- }
+ };
btn.text = "new value";
@@ -231,7 +231,7 @@ export function test_property_change_from_native_calls_attributeModified() {
assertEqual(attrName, "text", "attrName");
assertEqual(attrValue, "new value", "attrValue");
callbackCalled = true;
- }
+ };
textProperty.nativeValueChange(tv, "new value");
@@ -249,7 +249,7 @@ export function test_property_reset_calls_attributeRemoved() {
assertEqual(nodeId, domNode.nodeId, "nodeId");
assertEqual(attrName, "text", "attrName");
callbackCalled = true;
- }
+ };
btn.text = unsetValue;
@@ -267,7 +267,7 @@ export function test_coercible_property_change_calls_attributeModified() {
assertEqual(attrName, "value", "attrName");
assertEqual(attrValue, "10", "attrValue");
callbackCalled = true;
- }
+ };
slider.value = 10;
@@ -285,7 +285,7 @@ export function test_coercible_property_reset_calls_attributeRemoved() {
assertEqual(nodeId, domNode.nodeId, "nodeId");
assertEqual(attrName, "value", "attrName");
callbackCalled = true;
- }
+ };
slider.value = unsetValue;
@@ -355,7 +355,7 @@ export function test_inspector_ui_removeNode() {
childNodeRemovedCalled = true;
assertEqual(parentId, expectedParentId);
assertEqual(nodeId, expectedNodeId);
- }
+ };
currentInspector.removeNode(label.domNode.nodeId);
diff --git a/tests/app/fetch/fetch-tests.ts b/tests/app/fetch/fetch-tests.ts
index 835f405d9..b6542061f 100644
--- a/tests/app/fetch/fetch-tests.ts
+++ b/tests/app/fetch/fetch-tests.ts
@@ -1,5 +1,5 @@
/* tslint:disable:no-unused-variable */
-import * as TKUnit from "../TKUnit";
+import * as TKUnit from "../tk-unit";
import * as types from "tns-core-modules/utils/types";
export var test_fetch_defined = function () {
@@ -56,11 +56,11 @@ export var test_fetch_formData = function (done: (err: Error, res?: string) => v
export var test_fetch_fail_invalid_url = function (done) {
var completed: boolean;
- var isReady = function () { return completed; }
+ var isReady = function () { return completed; };
fetch("hgfttp://httpbin.org/get").catch(function (e) {
completed = true;
- done(null)
+ done(null);
}).catch(failOnError(done));
};
@@ -145,4 +145,4 @@ export var test_fetch_post_json = function (done) {
const failOnError = function (done: (err: Error, res?: string) => void) {
return e => done(e);
-}
+};
diff --git a/tests/app/file-name-resolver-tests/file-name-resolver-tests.ts b/tests/app/file-name-resolver-tests/file-name-resolver-tests.ts
deleted file mode 100644
index ce1a43199..000000000
--- a/tests/app/file-name-resolver-tests/file-name-resolver-tests.ts
+++ /dev/null
@@ -1,245 +0,0 @@
-import * as TKUnit from "../TKUnit";
-import * as fs from "tns-core-modules/file-system";
-import * as enums from "tns-core-modules/ui/enums";
-import * as resolver from "tns-core-modules/file-system/file-name-resolver";
-
-var androidPhonePortraitContext: resolver.PlatformContext = {
- width: 360,
- height: 640,
- deviceType: enums.DeviceType.Phone,
- os: "android"
-}
-
-var androidPhoneLandsacpeContext: resolver.PlatformContext = {
- width: 640,
- height: 360,
- deviceType: enums.DeviceType.Phone,
- os: "android"
-}
-
-var androidTabletPortraitContext: resolver.PlatformContext = {
- width: 600,
- height: 960,
- deviceType: enums.DeviceType.Tablet,
- os: "android"
-}
-
-var iPhonePortraitContext: resolver.PlatformContext = {
- width: 320,
- height: 480,
- deviceType: enums.DeviceType.Phone,
- os: "ios"
-}
-
-var iPhoneLandscapeContext: resolver.PlatformContext = {
- width: 480,
- height: 320,
- deviceType: enums.DeviceType.Phone,
- os: "ios"
-}
-
-export function test_findFileMatch_fileName() {
- var candidates: Array = [
- "test.xml",
- "test2.xml",
- "other.xml"
- ];
-
- testTemplate(candidates, androidPhonePortraitContext, "test.xml")
-};
-
-export function test_findFileMatch_os_android() {
- var candidates: Array = [
- "test.xml",
- "test.ios.xml",
- "test.android.xml",
- "other.xml"
- ];
-
- testTemplate(candidates, androidPhonePortraitContext, "test.android.xml")
-};
-
-export function test_findFileMatch_os_ios() {
- var candidates: Array = [
- "test.xml",
- "test.ios.xml",
- "test.android.xml",
- "other.xml"
- ];
-
- testTemplate(candidates, iPhonePortraitContext, "test.ios.xml")
-};
-
-export function test_findFileMatch_os_fallback() {
- var candidates: Array = [
- "test.xml",
- "test.ios.xml",
- "other.xml"
- ];
-
- testTemplate(candidates, androidPhonePortraitContext, "test.xml")
-};
-
-export function test_findFileMatch_minWH_fallback() {
- var candidates: Array = [
- "test.xml",
- "test.minWH600.xml",
- "other.xml"
- ];
-
- testTemplate(candidates, androidPhonePortraitContext, "test.xml")
-}
-
-export function test_findFileMatch_minWH_best_value() {
- var candidates: Array = [
- "test.xml",
- "test.minWH400.xml",
- "test.minWH500.xml",
- "test.minWH600.xml",
- "test.minWH700.xml",
- "other.xml"
- ];
-
- testTemplate(candidates, androidTabletPortraitContext, "test.minWH600.xml")
-}
-
-export function test_findFileMatch_minW_fallback() {
- var candidates: Array = [
- "test.xml",
- "test.minW600.xml",
- "other.xml"
- ];
-
- testTemplate(candidates, androidPhonePortraitContext, "test.xml")
-}
-
-export function test_findFileMatch_minW_best_value() {
- var candidates: Array = [
- "test.xml",
- "test.minW400.xml",
- "test.minW500.xml",
- "test.minW600.xml",
- "test.minW700.xml",
- "other.xml"
- ];
-
- testTemplate(candidates, androidTabletPortraitContext, "test.minW600.xml")
-}
-
-export function test_findFileMatch_minH_fallback() {
- var candidates: Array = [
- "test.xml",
- "test.minH600.xml",
- "other.xml"
- ];
-
- testTemplate(candidates, androidPhoneLandsacpeContext, "test.xml")
-}
-
-export function test_findFileMatch_minH_best_value() {
- var candidates: Array = [
- "test.xml",
- "test.minH400.xml",
- "test.minH500.xml",
- "test.minH600.xml",
- "test.minH700.xml",
- "other.xml"
- ];
-
- testTemplate(candidates, androidPhonePortraitContext, "test.minH600.xml")
-}
-
-export function test_findFileMatch_orienation_fallback() {
- var candidates: Array = [
- "test.xml",
- "test.land.xml",
- "other.xml"
- ];
-
- testTemplate(candidates, androidTabletPortraitContext, "test.xml")
-}
-
-export function test_findFileMatch_orienation_portrait() {
- var candidates: Array = [
- "test.xml",
- "test.land.xml",
- "test.port.xml",
- "other.xml"
- ];
-
- testTemplate(candidates, androidTabletPortraitContext, "test.port.xml")
-}
-
-export function test_findFileMatch_orienation_landscape() {
- var candidates: Array = [
- "test.xml",
- "test.land.xml",
- "test.port.xml",
- "other.xml"
- ];
-
- testTemplate(candidates, androidPhoneLandsacpeContext, "test.land.xml")
-}
-
-export function test_findFileMatch_choose_most_specific_file() {
- var candidates: Array = [
- "test.xml",
- "test.android.xml",
- "test.android.port.xml",
- "other.xml"
- ];
-
- testTemplate(candidates, androidPhonePortraitContext, "test.android.port.xml")
-}
-
-export function test_findFileMatch_with_multiple_matches_loads_by_priority() {
- var candidates: Array = [
- "test.xml",
- "test.android.xml",
- "test.tablet.xml",
- "test.land.xml",
- "test.minH600.xml",
- "test.minW600.xml",
- "test.minWH600.xml",
- "other.xml"
- ];
-
- testTemplate(candidates, androidTabletPortraitContext, "test.minWH600.xml")
-}
-
-function testTemplate(candidates: Array, context: resolver.PlatformContext, expected: string) {
- var result = resolver._findFileMatch("test", ".xml", candidates, context);
- TKUnit.assertEqual(result, expected, "File path");
-}
-
-var testFilePath = "~/file-name-resolver-tests/files/test".replace("~", fs.knownFolders.currentApp().path);
-
-export function test_file_resolver_with_andorid_phone_portratit() {
- var fileResolver = new resolver.FileNameResolver(androidPhonePortraitContext);
- var result = fileResolver.resolveFileName(testFilePath, "xml");
- TKUnit.assertEqual(result, testFilePath + ".xml", "File path");
-}
-
-export function test_file_resolver_with_andorid_phone_landscape() {
- var fileResolver = new resolver.FileNameResolver(androidPhoneLandsacpeContext);
- var result = fileResolver.resolveFileName(testFilePath, "xml");
- TKUnit.assertEqual(result, testFilePath + ".land.xml", "File path");
-}
-
-export function test_file_resolver_with_andorid_tablet_portrait() {
- var fileResolver = new resolver.FileNameResolver(androidTabletPortraitContext);
- var result = fileResolver.resolveFileName(testFilePath, "xml");
- TKUnit.assertEqual(result, testFilePath + ".minWH600.xml", "File path");
-}
-
-export function test_file_resolver_with_ios_phone_landscape() {
- var fileResolver = new resolver.FileNameResolver(iPhoneLandscapeContext);
- var result = fileResolver.resolveFileName(testFilePath, "xml");
- TKUnit.assertEqual(result, testFilePath + ".land.xml", "File path");
-}
-
-export function test_file_resolver_with_ios_phone_portrait() {
- var fileResolver = new resolver.FileNameResolver(iPhonePortraitContext);
- var result = fileResolver.resolveFileName(testFilePath, "xml");
- TKUnit.assertEqual(result, testFilePath + ".xml", "File path");
-}
diff --git a/tests/app/file-system-access-tests/file-system-access-tests.ts b/tests/app/file-system-access-tests/file-system-access-tests.ts
index c1ed3c8da..364561449 100644
--- a/tests/app/file-system-access-tests/file-system-access-tests.ts
+++ b/tests/app/file-system-access-tests/file-system-access-tests.ts
@@ -1,11 +1,11 @@
-import * as TKUnit from "../TKUnit";
+import * as TKUnit from "../tk-unit";
import * as fs from "tns-core-modules/file-system";
export var test_UTF8_BOM_is_not_returned = function () {
- var actualResult: string;
- var path = fs.path.join(__dirname, "xml.expected");
+ var path = fs.path.join(fs.knownFolders.currentApp().path, "file-system-access-tests", "xml.expected");
if (!fs.File.exists(path)) {
TKUnit.assert(false, "Could not read file utf8.txt");
+
return;
}
@@ -13,7 +13,7 @@ export var test_UTF8_BOM_is_not_returned = function () {
var onError = function (error) {
TKUnit.assert(false, "Could not read file utf8.txt");
- }
+ };
var text = file.readTextSync(onError);
if (text) {
@@ -24,10 +24,11 @@ export var test_UTF8_BOM_is_not_returned = function () {
};
export var test_file_exists_on_folder = function () {
- var path = fs.path.join(__dirname, "folder");
+ var path = fs.path.join(fs.knownFolders.currentApp().path, "file-system-access-tests", "folder");
if (!fs.Folder.exists(path)) {
TKUnit.assert(false, `Could not read path ${path}`);
+
return;
}
@@ -40,4 +41,4 @@ export var test_leading_slash_is_not_returned = function () {
var path = fs.path.join(...parts);
TKUnit.assertEqual(path, expected, "Leading slash should not be part of the path");
-}
+};
diff --git a/tests/app/file-system/file-system-tests.ts b/tests/app/file-system/file-system-tests.ts
index 60d2db33e..7815afe58 100644
--- a/tests/app/file-system/file-system-tests.ts
+++ b/tests/app/file-system/file-system-tests.ts
@@ -3,7 +3,7 @@
import * as fs from "tns-core-modules/file-system";
// << file-system-require
-import * as TKUnit from "../TKUnit";
+import * as TKUnit from "../tk-unit";
import * as appModule from "tns-core-modules/application";
import * as platform from "tns-core-modules/platform";
@@ -71,7 +71,7 @@ export var testFileFromPath = function () {
// << (hide)
});
// << file-system-create
-}
+};
export var testFolderFromPath = function () {
// >> file-system-create-folder
@@ -83,7 +83,7 @@ export var testFolderFromPath = function () {
folder.remove();
// << (hide)
// << file-system-create-folder
-}
+};
export var testFileWrite = function () {
// >> file-system-write-string
@@ -124,7 +124,7 @@ export var testGetFile = function () {
file.remove();
// << (hide)
// << file-system-create-file
-}
+};
export var testGetFolder = function () {
// >> file-system-get-folder
@@ -180,7 +180,7 @@ export var testFileReadWriteBinary = function () {
var fileName = "logo.png";
var error;
- var sourceFile = fs.File.fromPath(__dirname + "/../" + fileName);
+ var sourceFile = fs.File.fromPath(__dirname + "/assets/" + fileName);
var destinationFile = fs.knownFolders.documents().getFile(fileName);
var source = sourceFile.readSync(e => { error = e; });
@@ -319,10 +319,11 @@ export var testEnumEntities = function () {
testFolderFound = true;
}
}
- }
+ };
// << (hide)
documents.eachEntity(function (entity) {
console.log(entity.name);
+
// Return true to continue, or return false to stop the iteration.
return true;
});
@@ -490,7 +491,7 @@ export var testFolderRemove = function () {
// << (hide)
});
// << file-system-remove-folder
-}
+};
export var testFolderClear = function () {
// >> file-system-clear-folder
@@ -550,7 +551,7 @@ export function testKnownFolderRemove(done) {
function (error) {
done(null);
});
-};
+}
export function test_FSEntity_Properties() {
var documents = fs.knownFolders.documents();
@@ -570,6 +571,7 @@ export function test_FileSize(done) {
var file = fs.knownFolders.documents().getFile("Test_File_Size.txt");
file.writeText("Hello World!").then(() => {
TKUnit.assert(file.size === "Hello World!".length);
+
return file.remove();
}).then(() => done())
.catch(done);
@@ -581,6 +583,7 @@ export function test_UnlockAfterWrite(done) {
return file.readText();
}).then(value => {
TKUnit.assert(value === "Hello World!");
+
return file.remove();
}).then(() => done())
.catch(done);
diff --git a/tests/app/fps-meter/fps-meter-tests.ts b/tests/app/fps-meter/fps-meter-tests.ts
index 23d43d3bf..294d0d582 100644
--- a/tests/app/fps-meter/fps-meter-tests.ts
+++ b/tests/app/fps-meter/fps-meter-tests.ts
@@ -1,4 +1,4 @@
-// >> fps-meter-require
+// >> fps-meter-require
import * as fpsMeter from "tns-core-modules/fps-meter";
// << fps-meter-require
@@ -12,4 +12,4 @@ export var test_DummyTestForSnippetOnly0 = function () {
fpsMeter.removeCallback(callbackId);
fpsMeter.stop();
// << fps-meter-logging
-}
+};
diff --git a/tests/app/http/http-tests.ts b/tests/app/http/http-tests.ts
index 1cd5283e9..39ccc1b8b 100644
--- a/tests/app/http/http-tests.ts
+++ b/tests/app/http/http-tests.ts
@@ -1,5 +1,5 @@
import { ImageSource } from "tns-core-modules/image-source";
-import * as TKUnit from "../TKUnit";
+import * as TKUnit from "../tk-unit";
import * as http from "tns-core-modules/http";
import * as fs from "tns-core-modules/file-system";
import { addHeader } from "tns-core-modules/http/http-request";
@@ -9,11 +9,8 @@ export var test_getString_isDefined = function () {
};
export var test_getString = function (done: (err: Error, res?: string) => void) {
- var result;
-
http.getString("https://httpbin.org/get").then(function (r) {
//// Argument (r) is string!
- result = r;
done(null);
}, function (e) {
//// Argument (e) is Error!
@@ -22,14 +19,8 @@ export var test_getString = function (done: (err: Error, res?: string) => void)
};
export var test_getString_fail = function (done) {
- var result;
- var completed: boolean;
- var isReady = function () { return completed; }
-
http.getString({ url: "hgfttp://httpbin.org/get", method: "GET", timeout: 2000 }).catch(function (e) {
- completed = true;
- result = e;
- done(null)
+ done(null);
});
};
@@ -157,7 +148,7 @@ export var test_gzip_request_explicit = function(done) {
}, function (e) {
done(e);
});
-}
+};
export var test_gzip_request_implicit = function(done) {
var result;
@@ -176,7 +167,7 @@ export var test_gzip_request_implicit = function(done) {
}, function (e) {
done(e);
});
-}
+};
export var test_getImage_isDefined = function () {
TKUnit.assert(typeof (http.getImage) !== "undefined", "Method http.getImage() should be defined!");
@@ -330,7 +321,7 @@ export var test_request_responseStatusCodeShouldBeDefined = function (done) {
var statusCode = response.statusCode;
result = response;
try {
- TKUnit.assert(typeof (result.statusCode) !== "undefined", "response.statusCode should be defined!");
+ TKUnit.assert(typeof (statusCode) !== "undefined", "response.statusCode should be defined!");
done(null);
}
catch (err) {
@@ -384,9 +375,6 @@ export var test_request_responseContentShouldBeDefined = function (done) {
http.request({ url: "https://httpbin.org/get", method: "GET" }).then(function (response) {
//// Argument (response) is HttpResponse!
//// Content property of the response is HttpContent!
- var str = response.content.toString();
- var obj = response.content.toJSON();
- var img = response.content.toImage();
result = response;
try {
TKUnit.assert(typeof (result.content) !== "undefined", "response.content should be defined!");
diff --git a/tests/app/image-source/image-source-snippet.ts b/tests/app/image-source/image-source-snippet.ts
index c70988a25..b8ab9cea2 100644
--- a/tests/app/image-source/image-source-snippet.ts
+++ b/tests/app/image-source/image-source-snippet.ts
@@ -12,6 +12,6 @@ export function imageSourceFromAsset(imageAsset) {
if (saved) {
console.log("Image saved successfully!");
}
- })
+ });
}
// << imagesource-from-imageasset-save-to
\ No newline at end of file
diff --git a/tests/app/image-source/image-source-tests.ts b/tests/app/image-source/image-source-tests.ts
index be4e630cc..712015d3d 100644
--- a/tests/app/image-source/image-source-tests.ts
+++ b/tests/app/image-source/image-source-tests.ts
@@ -2,14 +2,13 @@
import * as imageAssetModule from "tns-core-modules/image-asset";
import * as fs from "tns-core-modules/file-system";
import * as app from "tns-core-modules/application";
-import * as TKUnit from "../TKUnit";
-import * as platform from "tns-core-modules/platform";
+import * as TKUnit from "../tk-unit";
-const imagePath = "~/logo.png";
-const splashscreenPath = "~/splashscreen.png";
+const imagePath = "~/assets/logo.png";
+const splashscreenPath = "~/assets/splashscreen.png";
const splashscreenWidth = 372;
const splashscreenHeight = 218;
-const smallImagePath = "~/small-image.png";
+const smallImagePath = "~/assets/small-image.png";
export function testFromResource() {
// >> imagesource-resname
@@ -86,7 +85,7 @@ export function testFromAssetFileNotFound(done) {
keepAspectRatio: true
};
- let img = imageSource.fromAsset(asset).then((source) => {
+ imageSource.fromAsset(asset).then((source) => {
done("Should not resolve with invalid file name.");
}, (error) => {
TKUnit.assertNotNull(error);
@@ -102,7 +101,7 @@ export function testFromAssetSimple(done) {
keepAspectRatio: true
};
- let img = imageSource.fromAsset(asset).then((source) => {
+ imageSource.fromAsset(asset).then((source) => {
TKUnit.assertEqual(source.width, splashscreenWidth);
TKUnit.assertEqual(source.height, splashscreenHeight);
done();
@@ -157,7 +156,7 @@ export function testFromAssetWithScalingAndAspectRatio(done) {
keepAspectRatio: true
};
- let img = imageSource.fromAsset(asset).then((source) => {
+ imageSource.fromAsset(asset).then((source) => {
TKUnit.assertEqual(source.width, 18);
TKUnit.assertEqual(source.height, scaleHeight);
done();
@@ -173,7 +172,7 @@ export function testFromAssetWithScalingAndDefaultAspectRatio(done) {
asset.options.width = scaleWidth;
asset.options.height = scaleHeight;
- let img = imageSource.fromAsset(asset).then((source) => {
+ imageSource.fromAsset(asset).then((source) => {
TKUnit.assertEqual(source.width, 18);
TKUnit.assertEqual(source.height, scaleHeight);
done();
@@ -192,7 +191,7 @@ export function testFromAssetWithBiggerScaling(done) {
keepAspectRatio: false
};
- let img = imageSource.fromAsset(asset).then((source) => {
+ imageSource.fromAsset(asset).then((source) => {
TKUnit.assertEqual(source.width, scaleWidth);
TKUnit.assertEqual(source.height, scaleHeight);
done();
diff --git a/tests/app/app/app-new.css b/tests/app/livesync/app-new-page.css
similarity index 94%
rename from tests/app/app/app-new.css
rename to tests/app/livesync/app-new-page.css
index 2b3afb687..5ad9ea7d5 100644
--- a/tests/app/app/app-new.css
+++ b/tests/app/livesync/app-new-page.css
@@ -1,3 +1,3 @@
Button, Label {
color: green;
-}
+}
\ No newline at end of file
diff --git a/tests/app/app/app-new.scss b/tests/app/livesync/app-new-scss-page.scss
similarity index 94%
rename from tests/app/app/app-new.scss
rename to tests/app/livesync/app-new-scss-page.scss
index 2b3afb687..5ad9ea7d5 100644
--- a/tests/app/app/app-new.scss
+++ b/tests/app/livesync/app-new-scss-page.scss
@@ -1,3 +1,3 @@
Button, Label {
color: green;
-}
+}
\ No newline at end of file
diff --git a/tests/app/app/application.css b/tests/app/livesync/application-page.css
similarity index 94%
rename from tests/app/app/application.css
rename to tests/app/livesync/application-page.css
index 119b358a7..89fff3b12 100644
--- a/tests/app/app/application.css
+++ b/tests/app/livesync/application-page.css
@@ -1,3 +1,3 @@
Button, Label {
color: black;
-}
+}
\ No newline at end of file
diff --git a/tests/app/app/button-page.css b/tests/app/livesync/button-css-page.css
similarity index 93%
rename from tests/app/app/button-page.css
rename to tests/app/livesync/button-css-page.css
index 68d098e0c..1f811bb24 100644
--- a/tests/app/app/button-page.css
+++ b/tests/app/livesync/button-css-page.css
@@ -1,3 +1,3 @@
Button {
color: green;
-}
+}
\ No newline at end of file
diff --git a/tests/app/livesync/button-scss-page.scss b/tests/app/livesync/button-scss-page.scss
new file mode 100644
index 000000000..1f811bb24
--- /dev/null
+++ b/tests/app/livesync/button-scss-page.scss
@@ -0,0 +1,3 @@
+Button {
+ color: green;
+}
\ No newline at end of file
diff --git a/tests/app/livesync/livesync-button-page.scss b/tests/app/livesync/livesync-button-page.scss
index 3b012936e..e69de29bb 100644
--- a/tests/app/livesync/livesync-button-page.scss
+++ b/tests/app/livesync/livesync-button-page.scss
@@ -1,3 +0,0 @@
-Button {
- color: cyan;
-}
\ No newline at end of file
diff --git a/tests/app/livesync/livesync-tests.ts b/tests/app/livesync/livesync-tests.ts
index 87e3c67d6..7bf950f90 100644
--- a/tests/app/livesync/livesync-tests.ts
+++ b/tests/app/livesync/livesync-tests.ts
@@ -1,42 +1,59 @@
-import * as helper from "../ui/helper";
-import * as TKUnit from "../TKUnit";
+import * as helper from "../ui-helper";
+import * as TKUnit from "../tk-unit";
import * as app from "tns-core-modules/application/application";
import * as frame from "tns-core-modules/ui/frame";
-
import { Color } from "tns-core-modules/color";
import { createViewFromEntry } from "tns-core-modules/ui/builder";
import { Page } from "tns-core-modules/ui/page";
import { Frame } from "tns-core-modules/ui/frame";
-const appCssFileName = "./app/application.css";
-const appNewCssFileName = "./app/app-new.css";
-const appNewScssFileName = "./app/app-new.scss";
-const buttonCssFileName = "./app/button-page.css";
+const LIVESYNC_FOLDER = "livesync/";
-const buttonPageModuleName = "livesync/livesync-button-page";
-const buttonHtmlPageFileName = "./livesync/livesync-button-page.html";
-const buttonXmlPageFileName = "./livesync/livesync-button-page.xml";
-const buttonJsPageFileName = "./livesync/livesync-button-page.js";
-const buttonTsPageFileName = "./livesync/livesync-button-page.ts";
-const buttonScssPageFileName = "./livesync/livesync-button-page.scss";
-const labelPageModuleName = "livesync/livesync-label-page";
+const appCssFileName = `${LIVESYNC_FOLDER}application-page.css`;
+const appNewCssFileName = `${LIVESYNC_FOLDER}app-new-page.css`;
+// `.scss` module registers in webpack as `.css`
+// https://github.com/NativeScript/NativeScript/blob/5.4.2/tns-core-modules/globals/globals.ts#L32-L33
+const appNewScssFileNameAsCss = `${LIVESYNC_FOLDER}app-new-scss-page.css`;
+const appNewScssFileName = `${LIVESYNC_FOLDER}app-new-scss-page.scss`;
+
+const buttonCssModuleName = `${LIVESYNC_FOLDER}button-css-page`;
+const buttonScssModuleName = `${LIVESYNC_FOLDER}button-scss-page`;
+const buttonCssFileName = `${LIVESYNC_FOLDER}button-css-page.css`;
+const buttonScssFileName = `${LIVESYNC_FOLDER}button-scss-page.scss`;
+
+const buttonPageModuleName = `${LIVESYNC_FOLDER}livesync-button-page`;
+const buttonHtmlPageFileName = `${LIVESYNC_FOLDER}livesync-button-page.html`;
+const buttonXmlPageFileName = `${LIVESYNC_FOLDER}livesync-button-page.xml`;
+const buttonJsPageFileName = `${LIVESYNC_FOLDER}livesync-button-page.js`;
+const buttonTsPageFileName = `${LIVESYNC_FOLDER}livesync-button-page.ts`;
+const buttonScssPageFileName = `${LIVESYNC_FOLDER}livesync-button-page.scss`;
+const labelPageModuleName = `${LIVESYNC_FOLDER}livesync-label-page`;
const green = new Color("green");
+export function setUp() {
+ const labelPage = createViewFromEntry(({ moduleName: labelPageModuleName }));
+ helper.navigate(() => labelPage);
+}
+
+export function tearDown() {
+ app.setCssFileName(appCssFileName);
+}
+
export function test_onLiveSync_ModuleContext_AppStyle_AppNewCss() {
- _test_onLiveSync_ModuleContext_AppStyle(appNewCssFileName);
+ _test_onLiveSync_ModuleContext_AppStyle(appNewCssFileName, appNewCssFileName);
}
export function test_onLiveSync_ModuleContext_AppStyle_AppNewScss() {
- _test_onLiveSync_ModuleContext_AppStyle(appNewScssFileName);
+ _test_onLiveSync_ModuleContext_AppStyle(appNewScssFileNameAsCss, appNewScssFileName);
}
-export function test_onLiveSync_ModuleContext_ContextUndefined() {
+export function test_onLiveSync_ModuleContext_Undefined() {
_test_onLiveSync_ModuleContext({ type: undefined, path: undefined });
}
-export function test_onLiveSync_ModuleContext_ModuleUndefined() {
+export function test_onLiveSync_ModuleContext_PathUndefined() {
_test_onLiveSync_ModuleContext({ type: "script", path: undefined });
}
@@ -49,7 +66,11 @@ export function test_onLiveSync_ModuleContext_Script_TsFile() {
}
export function test_onLiveSync_ModuleContext_Style_CssFile() {
- _test_onLiveSync_ModuleContext_TypeStyle({ type: "style", path: buttonCssFileName });
+ _test_onLiveSync_ModuleContext_TypeStyle(buttonCssModuleName, buttonCssFileName);
+}
+
+export function test_onLiveSync_ModuleContext_Style_ScssFile() {
+ _test_onLiveSync_ModuleContext_TypeStyle(buttonScssModuleName, buttonScssFileName);
}
export function test_onLiveSync_ModuleContext_Markup_HtmlFile() {
@@ -60,14 +81,14 @@ export function test_onLiveSync_ModuleContext_Markup_XmlFile() {
_test_onLiveSync_ModuleReplace({ type: "markup", path: buttonXmlPageFileName });
}
-export function test_onLiveSync_ModuleContext_Markup_Script_XmlFile() {
+export function test_onLiveSync_ModuleContext_MarkupXml_ScriptTs_Files() {
_test_onLiveSync_ModuleReplace_Multiple([
{ type: "script", path: buttonTsPageFileName },
{ type: "markup", path: buttonXmlPageFileName }
]);
}
-export function test_onLiveSync_ModuleContext_Markup_Script_Style_XmlFile() {
+export function test_onLiveSync_ModuleContext_MarkupXml_ScriptTs_StyleScss_Files() {
_test_onLiveSync_ModuleReplace_Multiple([
{ type: "script", path: buttonTsPageFileName },
{ type: "markup", path: buttonXmlPageFileName },
@@ -75,14 +96,14 @@ export function test_onLiveSync_ModuleContext_Markup_Script_Style_XmlFile() {
]);
}
-export function test_onLiveSync_ModuleContext_Markup_Script_HtmlFile() {
+export function test_onLiveSync_ModuleContext_MarkupHtml_ScriptTs_Files() {
_test_onLiveSync_ModuleReplace_Multiple([
{ type: "script", path: buttonTsPageFileName },
{ type: "markup", path: buttonHtmlPageFileName }
]);
}
-export function test_onLiveSync_ModuleContext_Markup_Script_Style_HtmlFile() {
+export function test_onLiveSync_ModuleContext_MarkupHtml_ScriptTs_StyleScss_Files() {
_test_onLiveSync_ModuleReplace_Multiple([
{ type: "script", path: buttonTsPageFileName },
{ type: "markup", path: buttonHtmlPageFileName },
@@ -90,23 +111,14 @@ export function test_onLiveSync_ModuleContext_Markup_Script_Style_HtmlFile() {
]);
}
-export function setUp() {
- const labelPage = createViewFromEntry(({ moduleName: labelPageModuleName }));
- helper.navigate(() => labelPage);
-}
-
-export function tearDown() {
- app.setCssFileName(appCssFileName);
-}
-
-function _test_onLiveSync_ModuleContext_AppStyle(styleFileName: string) {
+function _test_onLiveSync_ModuleContext_AppStyle(appStyleFileName: string, livesyncStyleFileName: string) {
const pageBeforeNavigation = helper.getCurrentPage();
const buttonPage = createViewFromEntry(({ moduleName: buttonPageModuleName }));
helper.navigateWithHistory(() => buttonPage);
- app.setCssFileName(styleFileName);
+ app.setCssFileName(appStyleFileName);
const pageBeforeLiveSync = helper.getCurrentPage();
- global.__onLiveSync({ type: "style", path: styleFileName });
+ livesync({ type: "style", path: livesyncStyleFileName });
const pageAfterLiveSync = helper.getCurrentPage();
TKUnit.waitUntilReady(() => pageAfterLiveSync.getViewById("button").style.color.toString() === green.toString());
@@ -121,10 +133,10 @@ function _test_onLiveSync_ModuleContext_AppStyle(styleFileName: string) {
TKUnit.assertTrue(pageAfterNavigationBack._cssState.isSelectorsLatestVersionApplied(), "Latest selectors version is NOT applied!");
}
-function _test_onLiveSync_ModuleContext(context: { type, path }) {
+function _test_onLiveSync_ModuleContext(context: ModuleContext) {
const buttonPage = createViewFromEntry(({ moduleName: buttonPageModuleName }));
helper.navigateWithHistory(() => buttonPage);
- global.__onLiveSync({ type: context.type, path: context.path });
+ livesync({ type: context.type, path: context.path });
TKUnit.waitUntilReady(() => !!frame.topmost());
const topmostFrame = frame.topmost();
@@ -132,12 +144,12 @@ function _test_onLiveSync_ModuleContext(context: { type, path }) {
TKUnit.assertTrue(topmostFrame.currentPage.getViewById("label").isLoaded);
}
-function _test_onLiveSync_ModuleReplace(context: { type, path }) {
+function _test_onLiveSync_ModuleReplace(context: ModuleContext) {
const pageBeforeNavigation = helper.getCurrentPage();
const buttonPage = createViewFromEntry(({ moduleName: buttonPageModuleName }));
helper.navigateWithHistory(() => buttonPage);
- global.__onLiveSync({ type: context.type, path: context.path });
+ livesync({ type: context.type, path: context.path });
const topmostFrame = frame.topmost();
waitUntilLivesyncComplete(topmostFrame);
TKUnit.assertTrue(topmostFrame.currentPage.getViewById("button").isLoaded, "Button page is NOT loaded!");
@@ -151,37 +163,15 @@ function _test_onLiveSync_ModuleReplace(context: { type, path }) {
TKUnit.assertEqual(pageBeforeNavigation, pageAfterBackNavigation, "Pages are different!");
}
-function _test_onLiveSync_ModuleReplace_Multiple(context: { type: string, path: string }[]) {
- const pageBeforeNavigation = helper.getCurrentPage();
- const buttonPage = createViewFromEntry(({ moduleName: buttonPageModuleName }));
- helper.navigateWithHistory(() => buttonPage);
-
- context.forEach(item => {
- global.__onLiveSync(item);
- });
-
- const topmostFrame = frame.topmost();
- waitUntilLivesyncComplete(topmostFrame);
- TKUnit.assertTrue(topmostFrame.currentPage.getViewById("button").isLoaded, "Button page is NOT loaded!");
- TKUnit.assertEqual(topmostFrame.backStack.length, 1, "Backstack is clean!");
- TKUnit.assertTrue(topmostFrame.canGoBack(), "Can NOT go back!");
-
- helper.goBack();
- const pageAfterBackNavigation = helper.getCurrentPage();
- TKUnit.assertTrue(topmostFrame.currentPage.getViewById("label").isLoaded, "Label page is NOT loaded!");
- TKUnit.assertEqual(topmostFrame.backStack.length, 0, "Backstack is NOT clean!");
- TKUnit.assertEqual(pageBeforeNavigation, pageAfterBackNavigation, "Pages are different!");
-}
-
-function _test_onLiveSync_ModuleContext_TypeStyle(context: { type, path }) {
+function _test_onLiveSync_ModuleContext_TypeStyle(styleModuleName: string, livesyncStyleFileName: string) {
const pageBeforeNavigation = helper.getCurrentPage();
const buttonPage = createViewFromEntry(({ moduleName: buttonPageModuleName }));
helper.navigateWithHistory(() => buttonPage);
const pageBeforeLiveSync = helper.getCurrentPage();
- pageBeforeLiveSync._moduleName = "button-page";
+ pageBeforeLiveSync._moduleName = styleModuleName;
- global.__onLiveSync({ type: context.type, path: context.path });
+ livesync({ type: "style", path: livesyncStyleFileName });
const topmostFrame = frame.topmost();
waitUntilLivesyncComplete(topmostFrame);
@@ -197,6 +187,33 @@ function _test_onLiveSync_ModuleContext_TypeStyle(context: { type, path }) {
TKUnit.assertTrue(pageAfterNavigationBack._cssState.isSelectorsLatestVersionApplied(), "Latest selectors version is NOT applied!");
}
+function _test_onLiveSync_ModuleReplace_Multiple(context: ModuleContext[]) {
+ const pageBeforeNavigation = helper.getCurrentPage();
+ const buttonPage = createViewFromEntry(({ moduleName: buttonPageModuleName }));
+ helper.navigateWithHistory(() => buttonPage);
+
+ context.forEach(item => {
+ livesync(item);
+ });
+
+ const topmostFrame = frame.topmost();
+ waitUntilLivesyncComplete(topmostFrame);
+ TKUnit.assertTrue(topmostFrame.currentPage.getViewById("button").isLoaded, "Button page is NOT loaded!");
+ TKUnit.assertEqual(topmostFrame.backStack.length, 1, "Backstack is clean!");
+ TKUnit.assertTrue(topmostFrame.canGoBack(), "Can NOT go back!");
+
+ helper.goBack();
+ const pageAfterBackNavigation = helper.getCurrentPage();
+ TKUnit.assertTrue(topmostFrame.currentPage.getViewById("label").isLoaded, "Label page is NOT loaded!");
+ TKUnit.assertEqual(topmostFrame.backStack.length, 0, "Backstack is NOT clean!");
+ TKUnit.assertEqual(pageBeforeNavigation, pageAfterBackNavigation, "Pages are different!");
+}
+
+function livesync(context: ModuleContext) {
+ const ls = (global).__hmrSyncBackup || global.__onLiveSync;
+ ls(context);
+}
+
function waitUntilLivesyncComplete(frame: Frame) {
TKUnit.waitUntilReady(() => frame.navigationQueueIsEmpty());
}
diff --git a/tests/app/app/mainPage.ts b/tests/app/main-page.ts
similarity index 70%
rename from tests/app/app/mainPage.ts
rename to tests/app/main-page.ts
index 2f3939b22..e48982712 100644
--- a/tests/app/app/mainPage.ts
+++ b/tests/app/main-page.ts
@@ -1,6 +1,7 @@
-import { Page } from "tns-core-modules/ui/page";
import * as trace from "tns-core-modules/trace";
-import * as tests from "../testRunner";
+import { Page } from "tns-core-modules/ui/page";
+
+import * as tests from "./test-runner";
let executeTests = true;
@@ -18,8 +19,6 @@ trace.addCategories(trace.categories.Test + "," + trace.categories.Error);
// ));
function runTests() {
- // setTimeout(() => tests.runAll("BOTTOM-NAVIGATION-ROOT.test_android_default_offset_should_preload_1_tab_on_each_side"), 10);
- // setTimeout(() => tests.runAll("BOTTOM-NAVIGATION-ROOT"), 10);
setTimeout(() => tests.runAll(""), 10);
}
diff --git a/tests/app/main-page.xml b/tests/app/main-page.xml
new file mode 100644
index 000000000..880573bd4
--- /dev/null
+++ b/tests/app/main-page.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/tests/app/name-resolvers-tests/file-name-resolver-tests.ts b/tests/app/name-resolvers-tests/file-name-resolver-tests.ts
new file mode 100644
index 000000000..548c713af
--- /dev/null
+++ b/tests/app/name-resolvers-tests/file-name-resolver-tests.ts
@@ -0,0 +1,42 @@
+import * as TKUnit from "../tk-unit";
+import * as fs from "tns-core-modules/file-system";
+import { FileNameResolver } from "tns-core-modules/file-system/file-name-resolver";
+import {
+ androidPhonePortraitContext,
+ androidPhoneLandscapeContext,
+ androidTabletPortraitContext,
+ iPhoneLandscapeContext,
+ iPhonePortraitContext
+} from "./qualifier-matcher-tests";
+
+const testFilePath = "~/name-resolvers-tests/files/test".replace("~", fs.knownFolders.currentApp().path);
+
+export function test_file_resolver_with_android_phone_portrait() {
+ const fileResolver = new FileNameResolver(androidPhonePortraitContext);
+ const result = fileResolver.resolveFileName(testFilePath, "xml");
+ TKUnit.assertEqual(result, testFilePath + ".xml", "File path");
+}
+
+export function test_file_resolver_with_android_phone_landscape() {
+ const fileResolver = new FileNameResolver(androidPhoneLandscapeContext);
+ const result = fileResolver.resolveFileName(testFilePath, "xml");
+ TKUnit.assertEqual(result, testFilePath + ".land.xml", "File path");
+}
+
+export function test_file_resolver_with_android_tablet_portrait() {
+ const fileResolver = new FileNameResolver(androidTabletPortraitContext);
+ const result = fileResolver.resolveFileName(testFilePath, "xml");
+ TKUnit.assertEqual(result, testFilePath + ".minWH600.xml", "File path");
+}
+
+export function test_file_resolver_with_ios_phone_landscape() {
+ const fileResolver = new FileNameResolver(iPhoneLandscapeContext);
+ const result = fileResolver.resolveFileName(testFilePath, "xml");
+ TKUnit.assertEqual(result, testFilePath + ".land.xml", "File path");
+}
+
+export function test_file_resolver_with_ios_phone_portrait() {
+ const fileResolver = new FileNameResolver(iPhonePortraitContext);
+ const result = fileResolver.resolveFileName(testFilePath, "xml");
+ TKUnit.assertEqual(result, testFilePath + ".xml", "File path");
+}
diff --git a/tests/app/file-name-resolver-tests/files/other.xml b/tests/app/name-resolvers-tests/files/other.xml
similarity index 100%
rename from tests/app/file-name-resolver-tests/files/other.xml
rename to tests/app/name-resolvers-tests/files/other.xml
diff --git a/tests/app/file-name-resolver-tests/files/test.land.xml b/tests/app/name-resolvers-tests/files/test.land.xml
similarity index 100%
rename from tests/app/file-name-resolver-tests/files/test.land.xml
rename to tests/app/name-resolvers-tests/files/test.land.xml
diff --git a/tests/app/file-name-resolver-tests/files/test.minWH600.xml b/tests/app/name-resolvers-tests/files/test.minWH600.xml
similarity index 100%
rename from tests/app/file-name-resolver-tests/files/test.minWH600.xml
rename to tests/app/name-resolvers-tests/files/test.minWH600.xml
diff --git a/tests/app/file-name-resolver-tests/files/test.xml b/tests/app/name-resolvers-tests/files/test.xml
similarity index 100%
rename from tests/app/file-name-resolver-tests/files/test.xml
rename to tests/app/name-resolvers-tests/files/test.xml
diff --git a/tests/app/name-resolvers-tests/module-name-resolver-tests.ts b/tests/app/name-resolvers-tests/module-name-resolver-tests.ts
new file mode 100644
index 000000000..c84305021
--- /dev/null
+++ b/tests/app/name-resolvers-tests/module-name-resolver-tests.ts
@@ -0,0 +1,50 @@
+import * as TKUnit from "../tk-unit";
+import { ModuleNameResolver, ModuleListProvider } from "tns-core-modules/module-name-resolver";
+
+import {
+ androidPhonePortraitContext,
+ androidPhoneLandscapeContext,
+ androidTabletPortraitContext,
+ iPhoneLandscapeContext,
+ iPhonePortraitContext
+} from "./qualifier-matcher-tests";
+
+const testModule = "name-resolvers-tests/files/test";
+const moduleProvider: ModuleListProvider = () => {
+ return [
+ "name-resolvers-tests/files/other.xml",
+ "name-resolvers-tests/files/test.land.xml",
+ "name-resolvers-tests/files/test.minWH600.xml",
+ "name-resolvers-tests/files/test.xml",
+ ];
+};
+
+export function test_module_name_resolver_with_android_phone_portrait() {
+ const moduleResolver = new ModuleNameResolver(androidPhonePortraitContext, moduleProvider);
+ const result = moduleResolver.resolveModuleName(testModule, "xml");
+ TKUnit.assertEqual(result, testModule + ".xml");
+}
+
+export function test_module_name_resolver_with_android_phone_landscape() {
+ const moduleResolver = new ModuleNameResolver(androidPhoneLandscapeContext, moduleProvider);
+ const result = moduleResolver.resolveModuleName(testModule, "xml");
+ TKUnit.assertEqual(result, testModule + ".land.xml");
+}
+
+export function test_module_name_resolver_with_android_tablet_portrait() {
+ const moduleResolver = new ModuleNameResolver(androidTabletPortraitContext, moduleProvider);
+ const result = moduleResolver.resolveModuleName(testModule, "xml");
+ TKUnit.assertEqual(result, testModule + ".minWH600.xml");
+}
+
+export function test_module_name_resolver_with_ios_phone_landscape() {
+ const moduleResolver = new ModuleNameResolver(iPhoneLandscapeContext, moduleProvider);
+ const result = moduleResolver.resolveModuleName(testModule, "xml");
+ TKUnit.assertEqual(result, testModule + ".land.xml");
+}
+
+export function test_module_name_resolver_with_ios_phone_portrait() {
+ const moduleResolver = new ModuleNameResolver(iPhonePortraitContext, moduleProvider);
+ const result = moduleResolver.resolveModuleName(testModule, "xml");
+ TKUnit.assertEqual(result, testModule + ".xml");
+}
diff --git a/tests/app/name-resolvers-tests/qualifier-matcher-tests.ts b/tests/app/name-resolvers-tests/qualifier-matcher-tests.ts
new file mode 100644
index 000000000..6e95230e2
--- /dev/null
+++ b/tests/app/name-resolvers-tests/qualifier-matcher-tests.ts
@@ -0,0 +1,232 @@
+import * as TKUnit from "../tk-unit";
+import * as enums from "tns-core-modules/ui/enums";
+import { findMatch, PlatformContext } from "tns-core-modules/module-name-resolver/qualifier-matcher";
+
+export const androidPhonePortraitContext: PlatformContext = {
+ width: 360,
+ height: 640,
+ deviceType: enums.DeviceType.Phone,
+ os: "android"
+};
+
+export const androidPhoneLandscapeContext: PlatformContext = {
+ width: 640,
+ height: 360,
+ deviceType: enums.DeviceType.Phone,
+ os: "android"
+};
+
+export const androidTabletPortraitContext: PlatformContext = {
+ width: 600,
+ height: 960,
+ deviceType: enums.DeviceType.Tablet,
+ os: "android"
+};
+
+export const iPhonePortraitContext: PlatformContext = {
+ width: 320,
+ height: 480,
+ deviceType: enums.DeviceType.Phone,
+ os: "ios"
+};
+
+export const iPhoneLandscapeContext: PlatformContext = {
+ width: 480,
+ height: 320,
+ deviceType: enums.DeviceType.Phone,
+ os: "ios"
+};
+
+export function test_findFileMatch_fileName() {
+ var candidates: Array = [
+ "test.xml",
+ "test2.xml",
+ "other.xml"
+ ];
+
+ findMatchTemplate(candidates, androidPhonePortraitContext, "test.xml");
+}
+
+export function test_findFileMatch_os_android() {
+ var candidates: Array = [
+ "test.xml",
+ "test.ios.xml",
+ "test.android.xml",
+ "other.xml"
+ ];
+
+ findMatchTemplate(candidates, androidPhonePortraitContext, "test.android.xml");
+}
+
+export function test_findFileMatch_os_ios() {
+ var candidates: Array = [
+ "test.xml",
+ "test.ios.xml",
+ "test.android.xml",
+ "other.xml"
+ ];
+
+ findMatchTemplate(candidates, iPhonePortraitContext, "test.ios.xml");
+}
+
+export function test_findFileMatch_os_fallback() {
+ var candidates: Array = [
+ "test.xml",
+ "test.ios.xml",
+ "other.xml"
+ ];
+
+ findMatchTemplate(candidates, androidPhonePortraitContext, "test.xml");
+}
+
+export function test_findFileMatch_minWH_fallback() {
+ var candidates: Array = [
+ "test.xml",
+ "test.minWH600.xml",
+ "other.xml"
+ ];
+
+ findMatchTemplate(candidates, androidPhonePortraitContext, "test.xml");
+}
+
+export function test_findFileMatch_minWH_best_value() {
+ var candidates: Array = [
+ "test.xml",
+ "test.minWH400.xml",
+ "test.minWH500.xml",
+ "test.minWH600.xml",
+ "test.minWH700.xml",
+ "other.xml"
+ ];
+
+ findMatchTemplate(candidates, androidTabletPortraitContext, "test.minWH600.xml");
+}
+
+export function test_findFileMatch_minW_fallback() {
+ var candidates: Array = [
+ "test.xml",
+ "test.minW600.xml",
+ "other.xml"
+ ];
+
+ findMatchTemplate(candidates, androidPhonePortraitContext, "test.xml");
+}
+
+export function test_findFileMatch_minW_best_value() {
+ var candidates: Array = [
+ "test.xml",
+ "test.minW400.xml",
+ "test.minW500.xml",
+ "test.minW600.xml",
+ "test.minW700.xml",
+ "other.xml"
+ ];
+
+ findMatchTemplate(candidates, androidTabletPortraitContext, "test.minW600.xml");
+}
+
+export function test_findFileMatch_minH_fallback() {
+ var candidates: Array = [
+ "test.xml",
+ "test.minH600.xml",
+ "other.xml"
+ ];
+
+ findMatchTemplate(candidates, androidPhoneLandscapeContext, "test.xml");
+}
+
+export function test_findFileMatch_minH_best_value() {
+ var candidates: Array = [
+ "test.xml",
+ "test.minH400.xml",
+ "test.minH500.xml",
+ "test.minH600.xml",
+ "test.minH700.xml",
+ "other.xml"
+ ];
+
+ findMatchTemplate(candidates, androidPhonePortraitContext, "test.minH600.xml");
+}
+
+export function test_findFileMatch_orientation_fallback() {
+ var candidates: Array = [
+ "test.xml",
+ "test.land.xml",
+ "other.xml"
+ ];
+
+ findMatchTemplate(candidates, androidTabletPortraitContext, "test.xml");
+}
+
+export function test_findFileMatch_orientation_portrait() {
+ var candidates: Array = [
+ "test.xml",
+ "test.land.xml",
+ "test.port.xml",
+ "other.xml"
+ ];
+
+ findMatchTemplate(candidates, androidTabletPortraitContext, "test.port.xml");
+}
+
+export function test_findFileMatch_orientation_landscape() {
+ var candidates: Array = [
+ "test.xml",
+ "test.land.xml",
+ "test.port.xml",
+ "other.xml"
+ ];
+
+ findMatchTemplate(candidates, androidPhoneLandscapeContext, "test.land.xml");
+}
+
+export function test_findFileMatch_choose_most_specific_file() {
+ var candidates: Array = [
+ "test.xml",
+ "test.android.xml",
+ "test.android.port.xml",
+ "other.xml"
+ ];
+
+ findMatchTemplate(candidates, androidPhonePortraitContext, "test.android.port.xml");
+}
+
+export function test_findFileMatch_with_multiple_matches_loads_by_priority() {
+ var candidates: Array = [
+ "test.xml",
+ "test.android.xml",
+ "test.tablet.xml",
+ "test.land.xml",
+ "test.minH600.xml",
+ "test.minW600.xml",
+ "test.minWH600.xml",
+ "other.xml"
+ ];
+
+ findMatchTemplate(candidates, androidTabletPortraitContext, "test.minWH600.xml");
+}
+
+function findMatchTemplate(candidates: Array, context: PlatformContext, expected: string) {
+ var result = findMatch("test", ".xml", candidates, context);
+ TKUnit.assertEqual(result, expected, "module name");
+}
+
+export function test_findFileMatch_with_empty_extension() {
+ var candidates: Array = [
+ "test",
+ "other"
+ ];
+
+ var result = findMatch("test", "", candidates, androidTabletPortraitContext);
+ TKUnit.assertEqual(result, "test", "module name");
+}
+
+export function test_findFileMatch_with_null_extension() {
+ var candidates: Array = [
+ "test",
+ "other"
+ ];
+
+ var result = findMatch("test", null, candidates, androidTabletPortraitContext);
+ TKUnit.assertEqual(result, "test", "module name");
+}
diff --git a/tests/app/navigation/navigation-tests.ts b/tests/app/navigation/navigation-tests.ts
index 42cc2327d..5dd97733e 100644
--- a/tests/app/navigation/navigation-tests.ts
+++ b/tests/app/navigation/navigation-tests.ts
@@ -1,10 +1,9 @@
-import * as TKUnit from "../TKUnit";
+import * as TKUnit from "../tk-unit";
import { EventData, Page, NavigatedData } from "tns-core-modules/ui/page";
import { topmost as topmostFrame, NavigationTransition } from "tns-core-modules/ui/frame";
import { StackLayout, } from "tns-core-modules/ui/layouts/stack-layout";
-import { GridLayout, } from "tns-core-modules/ui/layouts/grid-layout";
import { Color } from "tns-core-modules/color";
-import * as helper from "../ui/helper";
+import * as helper from "../ui-helper";
import * as frame from "tns-core-modules/ui/frame";
// Creates a random colorful page full of meaningless stuff.
let id = 0;
@@ -13,6 +12,7 @@ let pageFactory = function (): Page {
page.actionBarHidden = true;
page.id = `NavTestPage${id++}`;
page.style.backgroundColor = new Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255));
+
return page;
};
@@ -61,6 +61,7 @@ export function test_backAndForwardParentPage_nestedFrames() {
const page = (title) => {
const p = new Page();
p["tag"] = title;
+
return p;
};
@@ -75,7 +76,7 @@ export function test_backAndForwardParentPage_nestedFrames() {
parentPage.content = stack;
return parentPage;
- }
+ };
const back = pages => topmostFrame().goBack(topmostFrame().backStack[topmostFrame().backStack.length - pages]);
const currentPageMustBe = tag => TKUnit.assertEqual(topmostFrame().currentPage["tag"], tag, "Expected current page to be " + tag + " it was " + topmostFrame().currentPage["tag"] + " instead.");
@@ -110,7 +111,7 @@ export function test_backAndForwardParentPage_nestedFrames() {
back(2);
TKUnit.waitUntilReady(() => topmostFrame().navigationQueueIsEmpty());
- const frameStack = frame.stack();
+ const frameStack = frame._stack();
TKUnit.assertEqual(frameStack.length, 1, "There should be only one frame left in the stack");
TKUnit.assertEqual(topmostFrame().currentPage, mainTestPage, "We should be on the main test page at the end of the test.");
}
@@ -122,6 +123,7 @@ function _test_backToEntry(transition?: NavigationTransition) {
p.actionBarHidden = true;
p.id = `NavTestPage${id++}`;
p["tag"] = tag;
+
return p;
};
@@ -181,7 +183,7 @@ export function test_backToEntry_WithTransition() {
function _test_ClearHistory(transition?: NavigationTransition) {
let topmost = topmostFrame();
- let x = 0;
+
helper.navigateWithEntry({ create: pageFactory, clearHistory: true, transition: transition, animated: !!transition });
TKUnit.assertEqual(topmost.backStack.length, 0, "1.topmost.backStack.length");
TKUnit.assertEqual(topmost.canGoBack(), false, "1.topmost.canGoBack().");
@@ -239,12 +241,6 @@ export function test_ClearHistoryWithTransitionDoesNotBreakNavigation() {
export function test_ClearHistoryWithTransitionDoesNotBreakNavigation_WithLocalTransition() {
const topmost = topmostFrame();
- let originalCachePagesOnNavigate: boolean;
- if (topmost.android) {
- originalCachePagesOnNavigate = topmost.android.cachePagesOnNavigate;
- topmostFrame().android.cachePagesOnNavigate = true;
- }
-
let mainTestPage = topmost.currentPage;
let mainPageFactory = function (): Page {
return mainTestPage;
@@ -262,10 +258,6 @@ export function test_ClearHistoryWithTransitionDoesNotBreakNavigation_WithLocalT
// Go back to main
helper.navigateWithEntry({ create: mainPageFactory, clearHistory: true, transition: { name: "fade", duration: 10 }, animated: true });
- if (topmost.android) {
- topmostFrame().android.cachePagesOnNavigate = originalCachePagesOnNavigate;
- }
-
TKUnit.assertEqual(topmost.currentPage, mainTestPage, "We should be on the main test page at the end of the test.");
TKUnit.assertEqual(topmost.backStack.length, 0, "Back stack should be empty at the end of the test.");
}
@@ -286,6 +278,7 @@ function _test_NavigationEvents(transition?: NavigationTransition) {
secondPage.id = "second-page";
attachEventListeners(secondPage, actualSecondPageEvents);
secondPage.style.backgroundColor = new Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255));
+
return secondPage;
};
@@ -335,6 +328,7 @@ function _test_NavigationEvents_WithBackstackVisibile_False_Forward_Back(transit
secondPage.id = "second-page";
attachEventListeners(secondPage, actualSecondPageEvents);
secondPage.style.backgroundColor = new Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255));
+
return secondPage;
};
@@ -374,6 +368,7 @@ function _test_NavigationEvents_WithBackstackVisibile_False_Forward_Forward(tran
secondPage.id = "second-page";
attachEventListeners(secondPage, actualSecondPageEvents);
secondPage.style.backgroundColor = new Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255));
+
return secondPage;
};
@@ -420,6 +415,7 @@ function _test_NavigationEvents_WithClearHistory(transition?: NavigationTransiti
secondPage.id = "second-page";
attachEventListeners(secondPage, actualSecondPageEvents);
secondPage.style.backgroundColor = new Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255));
+
return secondPage;
};
@@ -464,7 +460,7 @@ function _test_Navigate_From_Page_Event_Handler(eventName: string) {
const secondPageFactory = function (): Page {
const secondPage = new Page();
secondPage.id = "second-page";
- secondPage.on(Page.navigatedToEvent, () => { secondPageNavigatedTo = true });
+ secondPage.on(Page.navigatedToEvent, () => { secondPageNavigatedTo = true; });
return secondPage;
};
@@ -478,4 +474,4 @@ function _test_Navigate_From_Page_Event_Handler(eventName: string) {
helper.navigateWithEntry({ create: firstPageFactory });
TKUnit.waitUntilReady(() => secondPageNavigatedTo);
-}
\ No newline at end of file
+}
diff --git a/tests/app/navigation/transition-tests.ts b/tests/app/navigation/transition-tests.ts
index cdf9b0e37..1d49af6be 100644
--- a/tests/app/navigation/transition-tests.ts
+++ b/tests/app/navigation/transition-tests.ts
@@ -1,11 +1,10 @@
-import * as TKUnit from "../TKUnit";
-import * as helper from "../ui/helper";
+import * as helper from "../ui-helper";
import * as platform from "tns-core-modules/platform";
import * as trace from "tns-core-modules/trace";
import { Color } from "tns-core-modules/color";
-import { NavigationEntry, NavigationTransition, topmost as topmostFrame } from "tns-core-modules/ui/frame";
+import { NavigationEntry, NavigationTransition } from "tns-core-modules/ui/frame";
import { Page } from "tns-core-modules/ui/page";
-import { AnimationCurve } from "tns-core-modules/ui/enums"
+import { AnimationCurve } from "tns-core-modules/ui/enums";
import { CustomTransition } from "./custom-transition";
function _testTransition(navigationTransition: NavigationTransition) {
@@ -18,26 +17,22 @@ function _testTransition(navigationTransition: NavigationTransition) {
let page = new Page();
page.id = testId;
page.style.backgroundColor = new Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255));
+
return page;
},
animated: true,
transition: navigationTransition
- }
+ };
helper.navigateWithEntry(navigationEntry);
}
export function test_Transitions() {
- const topmost = topmostFrame();
- const mainTestPage = topmost.currentPage;
- const mainPageFactory = function (): Page {
- return mainTestPage;
- };
-
helper.navigate(() => {
const page = new Page();
- page.id = "TransitionsTestPage_MAIN"
+ page.id = "TransitionsTestPage_MAIN";
page.style.backgroundColor = new Color(255, Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255));
+
return page;
});
@@ -60,4 +55,4 @@ export function test_Transitions() {
});
// helper.navigateWithEntry({ create: mainPageFactory, clearHistory: true, animated: false });
-}
\ No newline at end of file
+}
diff --git a/tests/app/package.json b/tests/app/package.json
index 46c676fd0..24cb7bc4c 100644
--- a/tests/app/package.json
+++ b/tests/app/package.json
@@ -1,2 +1,6 @@
-{ "name" : "tns-samples-tests",
- "main" : "app/app.js" }
+{
+ "main": "app.js",
+ "android": {
+ "v8Flags": "--expose_gc"
+ }
+}
diff --git a/tests/app/pages/app.ts b/tests/app/pages/app.ts
deleted file mode 100644
index db3999631..000000000
--- a/tests/app/pages/app.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-import * as application from "tns-core-modules/application";
-application.start({ moduleName: "pages/page14" });
diff --git a/tests/app/pages/file-load-test.ts b/tests/app/pages/file-load-test.ts
index 25fb3a489..5274f676e 100644
--- a/tests/app/pages/file-load-test.ts
+++ b/tests/app/pages/file-load-test.ts
@@ -1,4 +1,4 @@
-import * as label from "tns-core-modules/ui/label";
+import * as label from "tns-core-modules/ui/label";
import * as pages from "tns-core-modules/ui/page";
import * as fs from "tns-core-modules/file-system";
import * as fileResolverModule from "tns-core-modules/file-system/file-name-resolver";
@@ -25,5 +25,6 @@ export function createPage() {
lbl.textWrap = true;
page.content = lbl;
+
return page;
}
diff --git a/tests/app/pages/navigation/pageA-new-activity.ts b/tests/app/pages/navigation/pageA-new-activity.ts
index 29e8180e8..a4b2f8780 100644
--- a/tests/app/pages/navigation/pageA-new-activity.ts
+++ b/tests/app/pages/navigation/pageA-new-activity.ts
@@ -1,4 +1,4 @@
-import * as pages from "tns-core-modules/ui/page";
+import * as pages from "tns-core-modules/ui/page";
import * as frame from "tns-core-modules/ui/frame";
import * as stackModule from "tns-core-modules/ui/layouts/stack-layout";
import * as button from "tns-core-modules/ui/button";
@@ -21,6 +21,7 @@ export function createPage() {
stack.addChild(txt);
page.content = stack;
+
return page;
}
//export var Page = page;
diff --git a/tests/app/pages/navigation/pageA.ts b/tests/app/pages/navigation/pageA.ts
index bf526ee01..079ed62a5 100644
--- a/tests/app/pages/navigation/pageA.ts
+++ b/tests/app/pages/navigation/pageA.ts
@@ -1,4 +1,4 @@
-import * as pages from "tns-core-modules/ui/page";
+import * as pages from "tns-core-modules/ui/page";
import * as frame from "tns-core-modules/ui/frame";
import * as stackModule from "tns-core-modules/ui/layouts/stack-layout";
import * as button from "tns-core-modules/ui/button";
@@ -6,9 +6,6 @@ import * as text from "tns-core-modules/ui/text-field";
import * as color from "tns-core-modules/color";
import * as list from "tns-core-modules/ui/list-view";
-//// Enable page caching
-//frame.topmost().android.cachePagesOnNavigate = true;
-
export function createPage() {
var page = new pages.Page();
var stack = new stackModule.StackLayout();
@@ -54,5 +51,6 @@ export function createPage() {
stack.addChild(lv);
page.content = stack;
+
return page;
}
diff --git a/tests/app/pages/navigation/pageB-new-activity.ts b/tests/app/pages/navigation/pageB-new-activity.ts
index 0ef54d1ed..2c5312555 100644
--- a/tests/app/pages/navigation/pageB-new-activity.ts
+++ b/tests/app/pages/navigation/pageB-new-activity.ts
@@ -1,4 +1,4 @@
-import * as pages from "tns-core-modules/ui/page";
+import * as pages from "tns-core-modules/ui/page";
import * as frame from "tns-core-modules/ui/frame";
import * as stackModule from "tns-core-modules/ui/layouts/stack-layout";
import * as button from "tns-core-modules/ui/button";
@@ -28,6 +28,7 @@ export function createPage() {
stack.addChild(txt);
page.content = stack;
+
return page;
}
//export var Page = page;
diff --git a/tests/app/pages/navigation/pageB.ts b/tests/app/pages/navigation/pageB.ts
index 1b6c3b64e..989766350 100644
--- a/tests/app/pages/navigation/pageB.ts
+++ b/tests/app/pages/navigation/pageB.ts
@@ -1,4 +1,4 @@
-import * as pages from "tns-core-modules/ui/page";
+import * as pages from "tns-core-modules/ui/page";
import * as frame from "tns-core-modules/ui/frame";
import * as stackModule from "tns-core-modules/ui/layouts/stack-layout";
import * as button from "tns-core-modules/ui/button";
@@ -52,6 +52,7 @@ export function createPage() {
}
page.content = stack;
+
return page;
}
//export var Page = page;
diff --git a/tests/app/pages/navigation/pageC-new-activity.ts b/tests/app/pages/navigation/pageC-new-activity.ts
index e1f3947ea..0af3783e5 100644
--- a/tests/app/pages/navigation/pageC-new-activity.ts
+++ b/tests/app/pages/navigation/pageC-new-activity.ts
@@ -1,4 +1,4 @@
-import * as pages from "tns-core-modules/ui/page";
+import * as pages from "tns-core-modules/ui/page";
import * as frame from "tns-core-modules/ui/frame";
import * as stackModule from "tns-core-modules/ui/layouts/stack-layout";
import * as button from "tns-core-modules/ui/button";
@@ -28,6 +28,7 @@ export function createPage() {
stack.addChild(txt);
page.content = stack;
+
return page;
}
//export var Page = page;
diff --git a/tests/app/pages/navigation/pageC.ts b/tests/app/pages/navigation/pageC.ts
index d230f4c63..61260e640 100644
--- a/tests/app/pages/navigation/pageC.ts
+++ b/tests/app/pages/navigation/pageC.ts
@@ -1,4 +1,4 @@
-import * as pages from "tns-core-modules/ui/page";
+import * as pages from "tns-core-modules/ui/page";
import * as frame from "tns-core-modules/ui/frame";
import * as stackModule from "tns-core-modules/ui/layouts/stack-layout";
import * as button from "tns-core-modules/ui/button";
@@ -37,6 +37,7 @@ export function createPage() {
stack.addChild(txt);
page.content = stack;
+
return page;
}
//export var Page = page;
diff --git a/tests/app/pages/page10.ts b/tests/app/pages/page10.ts
index 430348bdf..d0f9aadee 100644
--- a/tests/app/pages/page10.ts
+++ b/tests/app/pages/page10.ts
@@ -1,4 +1,4 @@
-import * as pages from "tns-core-modules/ui/page";
+import * as pages from "tns-core-modules/ui/page";
import * as imageSource from "tns-core-modules/image-source";
import * as gridModule from "tns-core-modules/ui/layouts/grid-layout";
import * as enums from "tns-core-modules/ui/enums";
@@ -43,5 +43,6 @@ export function createPage() {
var page = new pages.Page();
page.content = stack;
page.css = "GridLayout { background-color: yellow } image { background-color: green } label { background-color: red } stackpnael { background-color: pink }";
+
return page;
}
diff --git a/tests/app/pages/page11.ts b/tests/app/pages/page11.ts
index d194e0d85..d20ec6aa1 100644
--- a/tests/app/pages/page11.ts
+++ b/tests/app/pages/page11.ts
@@ -1,4 +1,4 @@
-import * as gridModule from "tns-core-modules/ui/layouts/grid-layout";
+import * as gridModule from "tns-core-modules/ui/layouts/grid-layout";
import * as sp from "tns-core-modules/ui/layouts/stack-layout";
import * as button from "tns-core-modules/ui/button";
import { Page } from "tns-core-modules/ui/page";
@@ -70,6 +70,7 @@ export function createPage() {
grid.getChildAt(i).android.setGravity(gravity);
}
});
+
return page;
}
-//export var Page = page;
+//export var Page = page;
diff --git a/tests/app/pages/page12.ts b/tests/app/pages/page12.ts
index b5b436947..6ae2a7e5c 100644
--- a/tests/app/pages/page12.ts
+++ b/tests/app/pages/page12.ts
@@ -1,4 +1,4 @@
-import * as pages from "tns-core-modules/ui/page";
+import * as pages from "tns-core-modules/ui/page";
import * as btns from "tns-core-modules/ui/button";
import * as tb from "tns-core-modules/ui/text-field";
import * as gridLayoutModule from "tns-core-modules/ui/layouts/grid-layout";
@@ -53,5 +53,6 @@ export function createPage() {
gridLayout.addChild(txt2);
page.content = gridLayout;
+
return page;
}
diff --git a/tests/app/pages/page13.ts b/tests/app/pages/page13.ts
index 9da10d3bd..acb6961d1 100644
--- a/tests/app/pages/page13.ts
+++ b/tests/app/pages/page13.ts
@@ -1,4 +1,4 @@
-import * as pages from "tns-core-modules/ui/page";
+import * as pages from "tns-core-modules/ui/page";
import * as btns from "tns-core-modules/ui/button";
import * as layout from "tns-core-modules/ui/layouts/stack-layout";
@@ -20,6 +20,7 @@ export function createPage() {
btn.marginBottom = 100;
page.content = linearLayout;
+
return page;
}
@@ -29,5 +30,6 @@ function addButton(layout: layout.StackLayout, text: "left" | "center" | "right"
btn.horizontalAlignment = text;
layout.addChild(btn);
layout.style.paddingLeft = 5;
+
return btn;
}
diff --git a/tests/app/pages/page15.ts b/tests/app/pages/page15.ts
index 76b24190d..9b8c9de9e 100644
--- a/tests/app/pages/page15.ts
+++ b/tests/app/pages/page15.ts
@@ -1,4 +1,4 @@
-import * as pageModule from "tns-core-modules/ui/page";
+import * as pageModule from "tns-core-modules/ui/page";
import * as buttonModule from "tns-core-modules/ui/button";
import * as stackModule from "tns-core-modules/ui/layouts/stack-layout";
@@ -35,5 +35,6 @@ export function createPage() {
stackLayout.addChild(btn4);
page.content = stackLayout;
+
return page;
}
diff --git a/tests/app/pages/page16.ts b/tests/app/pages/page16.ts
index d18b2f45c..21493f117 100644
--- a/tests/app/pages/page16.ts
+++ b/tests/app/pages/page16.ts
@@ -1,4 +1,4 @@
-import * as pageModule from "tns-core-modules/ui/page";
+import * as pageModule from "tns-core-modules/ui/page";
import * as buttonModule from "tns-core-modules/ui/button";
import * as stackModule from "tns-core-modules/ui/layouts/stack-layout";
import * as frame from "tns-core-modules/ui/frame";
@@ -51,5 +51,6 @@ export function createPage() {
stackLayout.addChild(btn2);
page.content = stackLayout;
+
return page;
}
diff --git a/tests/app/pages/page17.ts b/tests/app/pages/page17.ts
index 0f8847ae3..5e483ae89 100644
--- a/tests/app/pages/page17.ts
+++ b/tests/app/pages/page17.ts
@@ -29,7 +29,7 @@ export function buttonTap(args: observable.EventData) {
currentPage.actionBar.android.icon = "res://ic_test";
}
else if (i % 3 === 1) {
- currentPage.actionBar.android.icon = "~/test-icon.png";
+ currentPage.actionBar.android.icon = "~/assets/test-icon.png";
}
else if (i % 3 === 2) {
currentPage.actionBar.android.icon = undefined;
diff --git a/tests/app/pages/page20.ts b/tests/app/pages/page20.ts
index 4181d1d8b..77c419073 100644
--- a/tests/app/pages/page20.ts
+++ b/tests/app/pages/page20.ts
@@ -7,5 +7,5 @@ trace.enable();
export function onTap(args: observable.EventData) {
var btn = args.object;
- (btn.page).showModal("tests/pages/page21", null, null);
+ (btn.page).showModal("tests/pages/page21", { context: null, closeCallback: null });
}
diff --git a/tests/app/pages/page5.ts b/tests/app/pages/page5.ts
index b78b881b2..2eced9fba 100644
--- a/tests/app/pages/page5.ts
+++ b/tests/app/pages/page5.ts
@@ -1,4 +1,4 @@
-import * as gridModule from "tns-core-modules/ui/layouts/grid-layout";
+import * as gridModule from "tns-core-modules/ui/layouts/grid-layout";
import * as pages from "tns-core-modules/ui/page";
import * as buttons from "tns-core-modules/ui/button";
import * as app from "tns-core-modules/application";
@@ -20,10 +20,10 @@ function printDeviceInfoAndroid() {
console.log("metrics.heightPixels = " + metrics.heightPixels); //metrics.heightPixels = 1776
var config = app.android.context.getResources().getConfiguration();
- console.log("config.screenWidthDp = " + config.screenWidthDp);
- console.log("config.screenHeightDp = " + config.screenHeightDp);
- console.log("config.smallestScreenWidthDp = " + config.smallestScreenWidthDp);
- console.log("config.orientation = " + (config.orientation === android.content.res.Configuration.ORIENTATION_PORTRAIT ? "portrait" : "ladscape"));
+ console.log("config.screenWidthDp = " + config.screenWidthDp);
+ console.log("config.screenHeightDp = " + config.screenHeightDp);
+ console.log("config.smallestScreenWidthDp = " + config.smallestScreenWidthDp);
+ console.log("config.orientation = " + (config.orientation === android.content.res.Configuration.ORIENTATION_PORTRAIT ? "portrait" : "ladscape"));
}
function printDeviceInfoIOS() {
@@ -43,17 +43,17 @@ function printDeviceInfoIOS() {
}
function printTNSInfo() {
- console.log("platform.device.model = " + platform.device.model);
- console.log("platform.device.os = " + platform.device.os);
- console.log("platform.device.osVersion = " + platform.device.osVersion);
- console.log("platform.device.sdkVersion = " + platform.device.sdkVersion);
- console.log("platform.device.deviceType = " + platform.device.deviceType);
+ console.log("platform.device.model = " + platform.device.model);
+ console.log("platform.device.os = " + platform.device.os);
+ console.log("platform.device.osVersion = " + platform.device.osVersion);
+ console.log("platform.device.sdkVersion = " + platform.device.sdkVersion);
+ console.log("platform.device.deviceType = " + platform.device.deviceType);
console.log("platform.screen.mainScreen.widthDIPs = " + platform.screen.mainScreen.widthDIPs);
- console.log("platform.screen.mainScreen.heightDIPs = " + platform.screen.mainScreen.heightDIPs);
- console.log("platform.screen.mainScreen.scale = " + platform.screen.mainScreen.scale);
- console.log("platform.screen.mainScreen.widthPixels = " + platform.screen.mainScreen.widthPixels);
- console.log("platform.screen.mainScreen.heightPixels = " + platform.screen.mainScreen.heightPixels);
+ console.log("platform.screen.mainScreen.heightDIPs = " + platform.screen.mainScreen.heightDIPs);
+ console.log("platform.screen.mainScreen.scale = " + platform.screen.mainScreen.scale);
+ console.log("platform.screen.mainScreen.widthPixels = " + platform.screen.mainScreen.widthPixels);
+ console.log("platform.screen.mainScreen.heightPixels = " + platform.screen.mainScreen.heightPixels);
}
function print() {
@@ -80,6 +80,7 @@ export function createPage() {
grid.addChild(btn);
page.content = grid;
+
return page;
}
//export var Page = page;
diff --git a/tests/app/pages/page6.ts b/tests/app/pages/page6.ts
index c07a40447..577516cb3 100644
--- a/tests/app/pages/page6.ts
+++ b/tests/app/pages/page6.ts
@@ -1,4 +1,4 @@
-import * as pages from "tns-core-modules/ui/page";
+import * as pages from "tns-core-modules/ui/page";
import * as fpsModule from "tns-core-modules/fps-meter";
export function createPage() {
@@ -20,6 +20,7 @@ export function createPage() {
startTime = java.lang.System.nanoTime();
var page = new pages.Page();
+
return page;
}
//var gridLayout = new grid.GridLayout();
diff --git a/tests/app/pages/page7.ts b/tests/app/pages/page7.ts
index 439ec9d69..d92f9254e 100644
--- a/tests/app/pages/page7.ts
+++ b/tests/app/pages/page7.ts
@@ -1,4 +1,4 @@
-import * as pages from "tns-core-modules/ui/page";
+import * as pages from "tns-core-modules/ui/page";
import * as buttons from "tns-core-modules/ui/button";
import { VerticalAlignment } from "tns-core-modules/ui/core/view";
@@ -16,7 +16,7 @@ export function createPage() {
btn.on(buttons.Button.tapEvent, function () {
//page.css = "button { vertical-align:" + vAligns[(count++) % 4] + " }";
btn.verticalAlignment = vAligns[(count++) % 4];
- })
+ });
//export function performanceTest() {
// var testBtn = new buttons.Button();
@@ -55,6 +55,7 @@ export function createPage() {
// }
page.content = btn;
+
return page;
}
-//export var Page = page;
+//export var Page = page;
diff --git a/tests/app/pages/page8.ts b/tests/app/pages/page8.ts
index 96bc6b25c..244d9cfc5 100644
--- a/tests/app/pages/page8.ts
+++ b/tests/app/pages/page8.ts
@@ -13,6 +13,7 @@ export function createPage() {
function createTxt(text: string) {
var tv = new textView.TextView();
tv.text = text;
+
return tv;
}
@@ -60,6 +61,7 @@ export function createPage() {
page.content = scrollView;
timer.setTimeout(performGet, 2000);
+
return page;
}
diff --git a/tests/app/pages/page9.ts b/tests/app/pages/page9.ts
index e9471f859..06a0154b9 100644
--- a/tests/app/pages/page9.ts
+++ b/tests/app/pages/page9.ts
@@ -1,4 +1,4 @@
-import * as pages from "tns-core-modules/ui/page";
+import * as pages from "tns-core-modules/ui/page";
import * as imageSource from "tns-core-modules/image-source";
import * as gridModule from "tns-core-modules/ui/layouts/grid-layout";
import * as img from "tns-core-modules/ui/image";
@@ -23,5 +23,6 @@ export function createPage() {
var page = new pages.Page();
page.content = grid;
page.css = "GridLayout { background-color: pink } image { background-color: green }";
+
return page;
}
diff --git a/tests/app/pages/performance-test/test-big.ts b/tests/app/pages/performance-test/test-big.ts
index 896c7699d..7e170599e 100644
--- a/tests/app/pages/performance-test/test-big.ts
+++ b/tests/app/pages/performance-test/test-big.ts
@@ -1,7 +1,7 @@
-import * as observable from "tns-core-modules/data/observable";
+import * as observable from "tns-core-modules/data/observable";
declare function __stopCPUProfiler(name: string);
export function pageLoaded(args: observable.EventData) {
- __stopCPUProfiler("xml-performance-test-big");
+ __stopCPUProfiler("xml-performance-test-big");
}
diff --git a/tests/app/pages/property-bindings.ts b/tests/app/pages/property-bindings.ts
index dd8a09ea2..6c6ca5aa2 100644
--- a/tests/app/pages/property-bindings.ts
+++ b/tests/app/pages/property-bindings.ts
@@ -67,7 +67,7 @@ export function createPage() {
targetProperty: desc.name,
};
control.bind(options, slider);
- };
+ }
function createBooleanPropertyUI(desc: BoolPropertyDescriptor) {
var lbl = new labels.Label();
@@ -85,7 +85,7 @@ export function createPage() {
targetProperty: desc.name,
};
control.bind(options, sw);
- };
+ }
function createStringPropertyUI(desc: StringPropertyDescriptor) {
var lbl = new labels.Label();
@@ -102,7 +102,7 @@ export function createPage() {
targetProperty: desc.name,
};
control.bind(options, txt);
- };
+ }
createNumericPropertyUI({ name: "style.minWidth", value: 30, min: 10, max: 300 });
createNumericPropertyUI({ name: "style.width", value: 100, min: 10, max: 300 });
@@ -121,6 +121,7 @@ export function createPage() {
createStringPropertyUI({ name: "className", value: "testClass" });
page.css = ".testClass { background-color: LightGreen }";
+
return page;
}
//export var Page = page;
diff --git a/tests/app/pages/sandbox-project.ts b/tests/app/pages/sandbox-project.ts
deleted file mode 100644
index d4b88b40a..000000000
--- a/tests/app/pages/sandbox-project.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-import * as application from "tns-core-modules/application";
-application.start({ moduleName: "apps/tests/pages/nnikolovTestPage" });
diff --git a/tests/app/platform/platform-tests.ts b/tests/app/platform/platform-tests.ts
index b94c17708..9b6b98ceb 100644
--- a/tests/app/platform/platform-tests.ts
+++ b/tests/app/platform/platform-tests.ts
@@ -1,4 +1,4 @@
-import * as TKUnit from "../TKUnit";
+import * as TKUnit from "../tk-unit";
import * as app from "tns-core-modules/application";
import { isIOS, isAndroid } from "tns-core-modules/platform";
@@ -15,7 +15,7 @@ export function test_setTimeout_isDefined() {
expected = "iOS";
}
TKUnit.assertEqual(platformModule.device.os, expected, "device.os");
-};
+}
export function snippet_print_all() {
// >> platform-current
@@ -35,7 +35,7 @@ export function snippet_print_all() {
console.log("Screen height (DIPs): " + platformModule.screen.mainScreen.heightDIPs);
console.log("Screen scale: " + platformModule.screen.mainScreen.scale);
// << platform-current
-};
+}
export function testIsIOSandIsAndroid() {
if (isIOS) {
diff --git a/tests/app/profiling/profiling-tests.ts b/tests/app/profiling/profiling-tests.ts
index e8bb9eb6f..c2f0536c3 100644
--- a/tests/app/profiling/profiling-tests.ts
+++ b/tests/app/profiling/profiling-tests.ts
@@ -1,4 +1,4 @@
-import { assert, assertEqual, assertFalse, assertNull, assertTrue, assertThrows } from "../TKUnit";
+import { assert, assertEqual, assertFalse, assertNull, assertTrue, assertThrows } from "../tk-unit";
import { enable, disable, profile, time, start, stop, timer, isRunning, resetProfiles } from "tns-core-modules/profiling";
enable();
@@ -50,6 +50,7 @@ function retry(count: number, action: () => void) {
for (var i = 1; i <= count; i++) {
try {
action();
+
return;
} catch (e) {
if (i === count) {
@@ -61,7 +62,7 @@ function retry(count: number, action: () => void) {
export function test_time_returns_number() {
assertEqual(typeof time(), "number");
-};
+}
export function test_isRunning() {
resetProfiles();
@@ -121,7 +122,7 @@ export function test_start_stop() {
const res = timer(name);
assertEqual(res.count, 1);
-};
+}
export function test_start_stop_count() {
resetProfiles();
@@ -134,7 +135,7 @@ export function test_start_stop_count() {
const res = timer(name);
assertEqual(res.count, 10);
-};
+}
export function test_profile_decorator_count() {
resetProfiles();
@@ -178,7 +179,7 @@ export function test_start_stop_performance() {
assertEqual(res.count, count);
assert(res.totalTime <= 500, `Total time for ${count} timer operations is too much: ${res.totalTime}`);
});
-};
+}
export function test_profile_decorator_performance() {
retry(5, () => {
diff --git a/tests/app/splashscreen.png b/tests/app/splashscreen.png
deleted file mode 100644
index a157c4dda..000000000
Binary files a/tests/app/splashscreen.png and /dev/null differ
diff --git a/tests/app/styling/app.ts b/tests/app/styling/app.ts
deleted file mode 100644
index 051c73290..000000000
--- a/tests/app/styling/app.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import * as application from "tns-core-modules/application";
-
-import * as trace from "tns-core-modules/trace";
-trace.enable();
-trace.setCategories(trace.categories.concat(
- trace.categories.Layout
-//, trace.categories.NativeLifecycle
-//, trace.categories.Navigation
-//, trace.categories.ViewHierarchy
-//, trace.categories.VisualTreeEvents
- ));
-
-application.start({ moduleName: "styling/mainPage" });
diff --git a/tests/app/styling/mainPage.ts b/tests/app/styling/mainPage.ts
deleted file mode 100644
index 4b90c65f0..000000000
--- a/tests/app/styling/mainPage.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-import * as pagesModule from "tns-core-modules/ui/page";
-import * as enums from "tns-core-modules/ui/enums";
-import * as stackLayoutModule from "tns-core-modules/ui/layouts/stack-layout";
-import * as buttonModule from "tns-core-modules/ui/button";
-import * as labelModule from "tns-core-modules/ui/label";
-import * as textFieldModule from "tns-core-modules/ui/text-field";
-import * as textViewModule from "tns-core-modules/ui/text-view";
-import * as colorModule from "tns-core-modules/color";
-
-export function createPage() {
- var width = 200;
- var textAlignment = enums.TextAlignment.right;
-
- var stack = new stackLayoutModule.StackLayout();
- var view;
-
- view = new buttonModule.Button();
- view.width = width;
- view.style.backgroundColor = new colorModule.Color("Blue");
- view.style.textAlignment = textAlignment;
- view.text = "Button";
- stack.addChild(view);
-
- view = new labelModule.Label();
- view.width = width;
- view.text = "Label";
- view.style.backgroundColor = new colorModule.Color("Green");
- view.style.textAlignment = textAlignment;
- stack.addChild(view);
-
- view = new textFieldModule.TextField();
- view.width = width;
- view.text = "TextField";
- view.style.backgroundColor = new colorModule.Color("Yellow");
- view.style.textAlignment = textAlignment;
- stack.addChild(view);
-
- view = new textViewModule.TextView();
- view.width = width;
- view.text = "TextView";
- view.style.backgroundColor = new colorModule.Color("Red");
- view.style.textAlignment = textAlignment;
- stack.addChild(view);
-
- var page = new pagesModule.Page();
- page.content = stack;
- return page;
-}
-//export var Page = page;
diff --git a/tests/app/styling/package.json b/tests/app/styling/package.json
deleted file mode 100644
index 596b14ed4..000000000
--- a/tests/app/styling/package.json
+++ /dev/null
@@ -1,2 +0,0 @@
-{ "name" : "styling",
- "main" : "app.js" }
diff --git a/tests/app/testRunner.ts b/tests/app/test-runner.ts
similarity index 91%
rename from tests/app/testRunner.ts
rename to tests/app/test-runner.ts
index 3697ae309..a1ff7bc6e 100644
--- a/tests/app/testRunner.ts
+++ b/tests/app/test-runner.ts
@@ -1,20 +1,21 @@
-/* tslint:disable */
-import * as TKUnit from "./TKUnit";
-import { _resetRootView } from "tns-core-modules/application";
-import { messageType } from "tns-core-modules/trace";
-import { topmost, Frame } from "tns-core-modules/ui/frame";
-import { Page } from "tns-core-modules/ui/page";
-import { TextView } from "tns-core-modules/ui/text-view";
-import { Button } from "tns-core-modules/ui/button";
-import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
-import * as platform from "tns-core-modules/platform";
-import "./ui-test";
-import { ios } from "tns-core-modules/utils/utils";
+/* tslint:disable */
+import * as TKUnit from './tk-unit';
+import './ui-test';
+
+import { _resetRootView } from 'tns-core-modules/application';
+import * as platform from 'tns-core-modules/platform';
+import { messageType } from 'tns-core-modules/trace';
+import { Button } from 'tns-core-modules/ui/button';
+import { Frame, topmost } from 'tns-core-modules/ui/frame';
+import { StackLayout } from 'tns-core-modules/ui/layouts/stack-layout';
+import { Page } from 'tns-core-modules/ui/page';
+import { TextView } from 'tns-core-modules/ui/text-view';
+import { ios } from 'tns-core-modules/utils/utils';
Frame.defaultAnimatedNavigation = false;
export function isRunningOnEmulator(): boolean {
- // This checks are not good enough to be added to modules but keeps unittests green.
+ // These checks are not good enough to be added to modules but they keep unit tests green.
if (platform.device.os === platform.platformNames.android) {
return android.os.Build.FINGERPRINT.indexOf("generic") > -1 ||
@@ -24,7 +25,6 @@ export function isRunningOnEmulator(): boolean {
android.os.Build.PRODUCT.toLocaleLowerCase().indexOf("emulator") > -1; // VS Emulator
}
else if (platform.device.os === platform.platformNames.ios) {
- //return platform.device.model === "iPhone Simulator";
return (__dirname.search("Simulator") > -1);
}
}
@@ -79,8 +79,8 @@ allTests["COLOR"] = colorTests;
import * as bindableTests from "./ui/core/bindable/bindable-tests";
allTests["BINDABLE"] = bindableTests;
-import * as bindintExpressionTests from "./ui/core/bindable/binding-expressions-tests";
-allTests["BINDING-EXPRESSIONS"] = bindintExpressionTests;
+import * as bindingExpressionTests from "./ui/core/bindable/binding-expressions-tests";
+allTests["BINDING-EXPRESSIONS"] = bindingExpressionTests;
import * as xmlParserTests from "./xml-parser-tests/xml-parser-tests";
allTests["XML-PARSER"] = xmlParserTests;
@@ -91,9 +91,15 @@ allTests["FORMATTEDSTRING"] = formattedStringTests;
import * as fileSystemAccessTests from "./file-system-access-tests/file-system-access-tests";
allTests["FILE-SYSTEM-ACCESS"] = fileSystemAccessTests;
-import * as fileNameResolverTests from "./file-name-resolver-tests/file-name-resolver-tests";
+import * as qualifierMatcherTests from "./name-resolvers-tests/qualifier-matcher-tests";
+allTests["QUALIFIER-MATCHER"] = qualifierMatcherTests;
+
+import * as fileNameResolverTests from "./name-resolvers-tests/file-name-resolver-tests";
allTests["FILE-NAME-RESOLVER"] = fileNameResolverTests;
+import * as moduleNameResolverTests from "./name-resolvers-tests/module-name-resolver-tests";
+allTests["MODULE-NAME-RESOLVER"] = moduleNameResolverTests;
+
import * as weakEventsTests from "./ui/core/weak-event-listener/weak-event-listener-tests";
allTests["WEAK-EVENTS"] = weakEventsTests;
@@ -112,6 +118,7 @@ allTests["SCROLL-VIEW"] = scrollViewTests;
import * as actionBarTests from "./ui/action-bar/action-bar-tests";
allTests["ACTION-BAR"] = actionBarTests;
+//TODO: 1 test commented out: test_EventInCodelessFragment
import * as xmlDeclarationTests from "./xml-declaration/xml-declaration-tests";
allTests["XML-DECLARATION"] = xmlDeclarationTests;
@@ -174,6 +181,9 @@ allTests["BORDER"] = borderTests;
import * as builderTests from "./ui/builder/builder-tests";
allTests["BUILDER"] = builderTests;
+import * as builderFileQualifierTests from "./ui/builder/builder-file-qualifiers-tests";
+allTests["BUILDER-QUALIFIERS"] = builderFileQualifierTests;
+
import * as buttonTests from "./ui/button/button-tests";
allTests["BUTTON"] = buttonTests;
@@ -300,7 +310,7 @@ const testsWithLongDelay = {
testLocation: 10000,
testLocationOnce: 10000,
testLocationOnceMaximumAge: 10000,
- //web-view-tests
+ // web-view-tests
testLoadExistingUrl: 10000 * 5,
testLoadLocalFile: 10000 * 5,
testLoadInvalidUrl: 10000,
@@ -316,8 +326,6 @@ let running = false;
let testsQueue = new Array();
function printRunTestStats() {
- const testCases = new Array();
-
let failedTestCount = 0;
const failedTestInfo = [];
const slowTests = new Array();
@@ -328,12 +336,12 @@ function printRunTestStats() {
let testName = testCase.testName;
if (!testCase.isPassed) {
failedTestCount++;
- failedTestInfo.push(testCase.testName + " FAILED: " + testCase.errorMessage);
+ failedTestInfo.push(testName + " FAILED: " + testCase.errorMessage);
}
let duration = (testCase.duration / 1000).toFixed(2);
if (testCase.duration > 500) {
- slowTests.push(`${testCase.testName}: ${duration}s`);
+ slowTests.push(`${testName}: ${duration}s`);
}
});
@@ -464,8 +472,6 @@ export function runAll(testSelector?: string) {
console.log("TESTS: " + singleModuleName ? singleModuleName : "" + " " + singleTestName ? singleTestName : "");
- const totalSuccess = 0;
- const totalFailed: Array = [];
testsQueue.push(new TestInfo(() => { running = true; startTime = TKUnit.time(); }));
for (const name in allTests) {
if (singleModuleName && (singleModuleName !== name.toLowerCase())) {
diff --git a/tests/app/text/formatted-string-tests.ts b/tests/app/text/formatted-string-tests.ts
index d137fc54d..a66f28d5b 100644
--- a/tests/app/text/formatted-string-tests.ts
+++ b/tests/app/text/formatted-string-tests.ts
@@ -1,11 +1,11 @@
-// >> formatted-string-require
+// >> formatted-string-require
import { FormattedString } from "tns-core-modules/text/formatted-string";
import { Span } from "tns-core-modules/text/span";
// << formatted-string-require
import { Observable } from "tns-core-modules/data/observable";
import { Label } from "tns-core-modules/ui/label";
-import * as TKUnit from "../TKUnit";
+import * as TKUnit from "../tk-unit";
export function test_FormattedString_RemovesEventListeners_for_spans() {
// >> formatted-string-set
@@ -22,7 +22,7 @@ export function test_FormattedString_RemovesEventListeners_for_spans() {
TKUnit.assert(formattedString.spans.getItem(0).hasListeners(Observable.propertyChangeEvent) === true, "Listener for spans collection change event is not attached!");
const removedSpan = formattedString.spans.pop();
TKUnit.assert(removedSpan.hasListeners(Observable.propertyChangeEvent) === false, "Listener for spans collection change event is not removed!");
-};
+}
export function test_FormattedTextProperty_IsChanged_When_SpanIsAdded() {
const formattedString = new FormattedString();
@@ -37,7 +37,7 @@ export function test_FormattedTextProperty_IsChanged_When_SpanIsAdded() {
formattedString.spans.push(firstSpan);
TKUnit.assertTrue(formattedTextChanged, "FormattedText property is not changed.");
-};
+}
export function test_FormattedTextProperty_IsChanged_When_SpanIsChanged() {
const formattedString = new FormattedString();
@@ -57,7 +57,7 @@ export function test_FormattedTextProperty_IsChanged_When_SpanIsChanged() {
TKUnit.assertTrue(formattedTextChanged, "FormattedText property is not changed.");
TKUnit.assert(formattedString.spans.getItem(0).fontSize === expectedValue, "FormattedString internal span is not changed as expected");
-};
+}
export function test_FormattedTextProperty_DoNotCrash_When_KnownColorIsSetForForegroundColor() {
const formattedString = new FormattedString();
@@ -76,4 +76,4 @@ export function test_FormattedTextProperty_DoNotCrash_When_KnownColorIsSetForFor
TKUnit.assertEqual(formattedString.spans.getItem(0).color.name, expectedValue1);
TKUnit.assertEqual(formattedString.spans.getItem(1).backgroundColor.name, expectedValue2);
-};
+}
diff --git a/tests/app/timer/timer-tests.ts b/tests/app/timer/timer-tests.ts
index c6c13b1b3..c8c8a55d6 100644
--- a/tests/app/timer/timer-tests.ts
+++ b/tests/app/timer/timer-tests.ts
@@ -1,4 +1,4 @@
-import * as TKUnit from "../TKUnit";
+import * as TKUnit from "../tk-unit";
import * as timer from "tns-core-modules/timer";
// >> timer-require
@@ -9,19 +9,19 @@ import * as timer from "tns-core-modules/timer";
export function test_setTimeout_isDefined() {
TKUnit.assertNotEqual(timer.setTimeout, undefined, "Method timer.setTimeout() should be defined!");
-};
+}
export function test_clearTimeout_isDefined() {
TKUnit.assertNotEqual(timer.clearTimeout, undefined, "Method timer.clearTimeout() should be defined!");
-};
+}
export function test_setInsDefined() {
TKUnit.assertNotEqual(timer.setInterval, undefined, "Method timer.setInterval() should be defined!");
-};
+}
export function test_clear_isDefined() {
TKUnit.assertNotEqual(timer.clearInterval, undefined, "Method timer.clearInterval() should be defined!");
-};
+}
export function test_setTimeout() {
let completed: boolean;
@@ -37,7 +37,7 @@ export function test_setTimeout() {
TKUnit.waitUntilReady(() => completed, 0.5, false);
timer.clearTimeout(id);
TKUnit.assert(completed, "Callback should be called!");
-};
+}
export function test_setTimeout_extraArgs() {
let completed: boolean;
@@ -54,7 +54,7 @@ export function test_setTimeout_extraArgs() {
TKUnit.waitUntilReady(() => completed, 0.5, false);
timer.clearTimeout(id);
TKUnit.assert(completed, "Callback called with expected argument!");
-};
+}
export function test_setTimeout_callbackCalledAfterSpecifiedTime() {
let completed = false;
@@ -70,7 +70,7 @@ export function test_setTimeout_callbackCalledAfterSpecifiedTime() {
TKUnit.waitUntilReady(() => completed, 1);
timer.clearTimeout(id);
TKUnit.assert(completed, "Callback should be called after the specified time!");
-};
+}
export function test_setTimeout_callbackNotCalled() {
let completed = false;
@@ -80,7 +80,7 @@ export function test_setTimeout_callbackNotCalled() {
TKUnit.wait(30 / 1000);
TKUnit.assert(!completed, "Callback should not be called after the specified time!");
-};
+}
export function test_setTimeout_shouldReturnNumber() {
let id = timer.setTimeout(() => {
@@ -88,7 +88,7 @@ export function test_setTimeout_shouldReturnNumber() {
});
timer.clearTimeout(id);
TKUnit.assertTrue(typeof id === "number", "Callback should return number!");
-};
+}
export function test_setTimeout_callbackShouldBeCleared() {
let completed = false;
@@ -108,7 +108,7 @@ export function test_setTimeout_callbackShouldBeCleared() {
TKUnit.wait(0.060);
timer.clearTimeout(id);
TKUnit.assert(!completed, "Callback should be cleared when clearTimeout() is executed for specified id!");
-};
+}
export function test_setInterval_callbackCalledDuringPeriod(done) {
let counter = 0;
@@ -129,11 +129,10 @@ export function test_setInterval_callbackCalledDuringPeriod(done) {
// << (hide)
}, 50);
// << timer-set-expression
-};
+}
export function test_setInterval_callbackCalledWithExtraArgs(done) {
let counter: number = 0;
- const expected: number = 4;
const rnd: number = Math.random();
const start = TKUnit.time();
@@ -145,11 +144,9 @@ export function test_setInterval_callbackCalledWithExtraArgs(done) {
done(end - start > 250 ? new Error("setInterval too slow.") : null);
}
}, 50, rnd);
-};
+}
export function test_setInterval_callbackShouldBeCleared(done) {
- let counter = 0;
-
const start = TKUnit.time();
// >> timer-set-interval
const id = timer.setInterval(() => {
@@ -161,7 +158,7 @@ export function test_setInterval_callbackShouldBeCleared(done) {
timer.clearInterval(id);
}, 50);
// << timer-set-interval
-};
+}
export function test_clearTimeout_multipleTimes_afterTick() {
let completed = false;
@@ -211,4 +208,4 @@ export function test_clearTimeout_insideCallback() {
TKUnit.waitUntilReady(() => completed, 0.5);
TKUnit.assert(completed, "Callback should be called");
-}
\ No newline at end of file
+}
diff --git a/tests/app/TKUnit.ts b/tests/app/tk-unit.ts
similarity index 97%
rename from tests/app/TKUnit.ts
rename to tests/app/tk-unit.ts
index f5fda0c8f..9f81fdaf8 100644
--- a/tests/app/TKUnit.ts
+++ b/tests/app/tk-unit.ts
@@ -1,4 +1,5 @@
-/* tslint:disable */
+/* tslint:disable */
+
/* Notes:
1. all test function names should begin with 'test'
@@ -10,11 +11,11 @@
*/
-import * as Application from "tns-core-modules/application";
+import * as application from "tns-core-modules/application";
+import * as platform from "tns-core-modules/platform";
import * as timer from "tns-core-modules/timer";
import * as trace from "tns-core-modules/trace";
import * as types from "tns-core-modules/utils/types";
-import * as platform from "tns-core-modules/platform";
const sdkVersion = parseInt(platform.device.sdkVersion);
@@ -34,14 +35,12 @@ export interface TestInfoEntry {
export function time(): number {
if (global.android) {
return java.lang.System.nanoTime() / 1000000; // 1 ms = 1000000 ns
- }
- else {
+ } else {
return CACurrentMediaTime() * 1000;
}
}
export function write(message: string, type?: number) {
- //console.log(message);
trace.write(message, trace.categories.Test, type);
}
@@ -51,8 +50,7 @@ function runTest(testInfo: TestInfoEntry) {
try {
if (testInfo.instance) {
testInfo.testFunc.apply(testInfo.instance);
- }
- else {
+ } else {
testInfo.testFunc();
}
@@ -116,7 +114,7 @@ function runAsync(testInfo: TestInfoEntry, recursiveIndex: number, testTimeout?:
runTests(testsQueue, recursiveIndex + 1);
} else if (error) {
write(`--- [${testInfo.testName}] FAILED: ${error.message}, duration: ${duration.toFixed(2)}`, trace.messageType.error);
- testInfo.errorMessage = error.message;
+ testInfo.errorMessage = error.message;
runTests(testsQueue, recursiveIndex + 1);
} else {
const testEndTime = time();
@@ -208,7 +206,7 @@ export function assertEqual(actual
}
}
else if (actual !== expected) {
- throw new Error(`${message} Actual: <${actual}>(${typeof (actual)}). Expected: <${expected}>(${typeof (expected)})` );
+ throw new Error(`${message} Actual: <${actual}>(${typeof (actual)}). Expected: <${expected}>(${typeof (expected)})`);
}
}
@@ -363,7 +361,7 @@ export function waitUntilReady(isReady: () => boolean, timeoutSec: number = 3, s
return;
}
- if (Application.ios) {
+ if (application.ios) {
const timeoutMs = timeoutSec * 1000;
let totalWaitTime = 0;
while (true) {
@@ -383,7 +381,7 @@ export function waitUntilReady(isReady: () => boolean, timeoutSec: number = 3, s
}
}
}
- } else if (Application.android) {
+ } else if (application.android) {
doModalAndroid(isReady, timeoutSec, shouldThrow);
}
}
diff --git a/tests/app/trace/trace-error-tests.ts b/tests/app/trace/trace-error-tests.ts
index bdf787eb5..cdf5e6741 100644
--- a/tests/app/trace/trace-error-tests.ts
+++ b/tests/app/trace/trace-error-tests.ts
@@ -1,8 +1,8 @@
-import {
+import {
ErrorHandler, getErrorHandler, setErrorHandler, DefaultErrorHandler,
error as traceError
} from "tns-core-modules/trace";
-import * as TKUnit from "../TKUnit";
+import * as TKUnit from "../tk-unit";
let cachedErrorHandler: ErrorHandler;
export function setUpModule() {
@@ -11,14 +11,14 @@ export function setUpModule() {
// before each
export function tearDown() {
- setErrorHandler(cachedErrorHandler)
+ setErrorHandler(cachedErrorHandler);
}
export function test_DefaultErrorHandler_throws() {
setErrorHandler(new DefaultErrorHandler());
TKUnit.assertThrows(() => {
- traceError(new Error("TEST"))
- }, "DefaultErrorHandler should throw.", "TEST")
+ traceError(new Error("TEST"));
+ }, "DefaultErrorHandler should throw.", "TEST");
}
export function test_trace_error_should_call_handler() {
@@ -30,7 +30,7 @@ export function test_trace_error_should_call_handler() {
});
traceError(new Error("TEST"));
- TKUnit.assert(called, "trace.error() should call handler")
+ TKUnit.assert(called, "trace.error() should call handler");
}
export function test_trace_error_should_create_error_from_string() {
@@ -44,8 +44,8 @@ export function test_trace_error_should_create_error_from_string() {
});
traceError("TEST");
- TKUnit.assert(called, "trace.error() should call handler;")
- TKUnit.assert(actualError instanceof Error, "trace.error() wrap string in error")
+ TKUnit.assert(called, "trace.error() should call handler;");
+ TKUnit.assert(actualError instanceof Error, "trace.error() wrap string in error");
}
export function test_trace_error_should_pass_errors() {
@@ -62,6 +62,6 @@ export function test_trace_error_should_pass_errors() {
});
traceError(testError);
- TKUnit.assert(called, "trace.error() should call handler;")
- TKUnit.assertDeepEqual(actualError, testError)
+ TKUnit.assert(called, "trace.error() should call handler;");
+ TKUnit.assertDeepEqual(actualError, testError);
}
diff --git a/tests/app/trace/trace-tests.ts b/tests/app/trace/trace-tests.ts
index daedf025b..9b65ba8ef 100644
--- a/tests/app/trace/trace-tests.ts
+++ b/tests/app/trace/trace-tests.ts
@@ -1,4 +1,4 @@
-// >> trace-require
+// >> trace-require
import * as trace from "tns-core-modules/trace";
// << trace-require
@@ -7,7 +7,7 @@ export var test_DummyTestForSnippetOnly0 = function () {
trace.setCategories(trace.categories.All);
trace.enable();
// << trace-all-categories
-}
+};
export var test_DummyTestForSnippetOnly1 = function () {
// >> trace-specific-categories
@@ -23,7 +23,7 @@ export var test_DummyTestForSnippetOnly1 = function () {
));
trace.enable();
// << trace-specific-categories
-}
+};
export var test_DummyTestForSnippetOnly2 = function () {
// >> trace-message
@@ -33,4 +33,4 @@ export var test_DummyTestForSnippetOnly2 = function () {
trace.write("My Debug Message", trace.categories.Debug);
}
// << trace-message
-}
+};
diff --git a/tests/app/ui/helper.ts b/tests/app/ui-helper.ts
similarity index 96%
rename from tests/app/ui/helper.ts
rename to tests/app/ui-helper.ts
index 6ccd5b490..2dba322c9 100644
--- a/tests/app/ui/helper.ts
+++ b/tests/app/ui-helper.ts
@@ -1,38 +1,35 @@
-import * as frame from "tns-core-modules/ui/frame";
-import { ViewBase, View, unsetValue, isIOS } from "tns-core-modules/ui/core/view";
-import { Page } from "tns-core-modules/ui/page";
-import { TabView, TabViewItem } from "tns-core-modules/ui/tab-view";
-import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
-import { Button } from "tns-core-modules/ui/button";
-import * as TKUnit from "../TKUnit";
-import * as utils from "tns-core-modules/utils/utils";
-import { ActionBar } from "tns-core-modules/ui/action-bar";
import { Color } from "tns-core-modules/color";
-
-import { LayoutBase } from "tns-core-modules/ui/layouts/layout-base";
import { FormattedString, Span } from "tns-core-modules/text/formatted-string";
-import { _getProperties, _getStyleProperties } from "tns-core-modules/ui/core/properties";
-import { device } from "tns-core-modules/platform";
+import { ActionBar } from "tns-core-modules/ui/action-bar";
// TODO: Remove this and get it from global to decouple builder for angular
import { createViewFromEntry } from "tns-core-modules/ui/builder";
+import { Button } from "tns-core-modules/ui/button";
+import { isIOS, unsetValue, View, ViewBase } from "tns-core-modules/ui/core/view";
+import * as frame from "tns-core-modules/ui/frame";
+import { LayoutBase } from "tns-core-modules/ui/layouts/layout-base";
+import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
+import { Page } from "tns-core-modules/ui/page";
+import { TabView, TabViewItem } from "tns-core-modules/ui/tab-view";
+import * as utils from "tns-core-modules/utils/utils";
+
+import * as TKUnit from "./tk-unit";
const DELTA = 0.1;
-const sdkVersion = parseInt(device.sdkVersion);
-export var ASYNC = 0.2;
-export var MEMORY_ASYNC = 2;
+export let ASYNC = 0.2;
+export let MEMORY_ASYNC = 2;
export function getColor(uiColor: UIColor): Color {
- var redRef = new interop.Reference();
- var greenRef = new interop.Reference();
- var blueRef = new interop.Reference();
- var alphaRef = new interop.Reference();
+ let redRef = new interop.Reference();
+ let greenRef = new interop.Reference();
+ let blueRef = new interop.Reference();
+ let alphaRef = new interop.Reference();
uiColor.getRedGreenBlueAlpha(redRef, greenRef, blueRef, alphaRef);
- var red = redRef.value * 255;
- var green = greenRef.value * 255;
- var blue = blueRef.value * 255;
- var alpha = alphaRef.value * 255;
+ let red = redRef.value * 255;
+ let green = greenRef.value * 255;
+ let blue = blueRef.value * 255;
+ let alpha = alphaRef.value * 255;
return new Color(alpha, red, green, blue);
}
@@ -79,14 +76,13 @@ export function do_PageTest_WithStackLayout_AndButton(test: (views: [Page, Stack
}
export interface PageOptions {
- pageCss?: any,
- actionBar?: boolean,
- actionBarFlat?: boolean,
- actionBarHidden?: boolean,
- tabBar?: boolean
+ pageCss?: any;
+ actionBar?: boolean;
+ actionBarFlat?: boolean;
+ actionBarHidden?: boolean;
+ tabBar?: boolean;
}
-//export function buildUIAndRunTest(controlToTest, testFunction, options) {
export function buildUIAndRunTest(controlToTest: T, testFunction: (views: [T, Page]) => void, options?: PageOptions) {
clearPage();
let newPage = getCurrentPage();
@@ -172,16 +168,19 @@ export function navigateToModuleAndRunTest(moduleName, context, testFunction) {
export function navigate(pageFactory: () => Page, navigationContext?: any): Page {
let entry: frame.NavigationEntry = { create: pageFactory, animated: false, context: navigationContext, clearHistory: true };
+
return navigateWithEntry(entry);
}
export function navigateWithHistory(pageFactory: () => Page, navigationContext?: any): Page {
let entry: frame.NavigationEntry = { create: pageFactory, animated: false, context: navigationContext, clearHistory: false };
+
return navigateWithEntry(entry);
}
export function navigateToModule(moduleName: string, context?: any): Page {
let entry: frame.NavigationEntry = { moduleName: moduleName, context: context, animated: false, clearHistory: true };
+
return navigateWithEntry(entry);
}
@@ -197,6 +196,7 @@ export function getClearCurrentPage(): Page {
page.className = unsetValue;
page.id = unsetValue;
page.css = "";
+
return page;
}
@@ -237,6 +237,7 @@ export function navigateWithEntry(entry: frame.NavigationEntry, topFrame?: frame
};
waitUntilNavigatedFrom(() => topFrame ? topFrame.navigate(entry) : frame.topmost().navigate(entry));
+
return page;
}
@@ -304,12 +305,6 @@ export function _generateFormattedString(): FormattedString {
return formattedString;
}
-// const props = _getProperties();
-// const styleProps = _getStyleProperties();
-// let setters: Map;
-// let cssSetters: Map;
-// let defaultNativeGetters: Map any>;
-
export function nativeView_recycling_test(createNew: () => View, createLayout?: () => LayoutBase, nativeGetters?: Map any>, customSetters?: Map) {
return;
diff --git a/tests/app/ui-test.ts b/tests/app/ui-test.ts
index b0108ebcb..3d3297536 100644
--- a/tests/app/ui-test.ts
+++ b/tests/app/ui-test.ts
@@ -1,8 +1,9 @@
-import { Page } from "tns-core-modules/ui/page";
-import { View } from "tns-core-modules/ui/core/view";
import * as trace from "tns-core-modules/trace";
-import * as navHelper from "./ui/helper";
-import * as TKUnit from "./TKUnit";
+import { View } from "tns-core-modules/ui/core/view";
+import { Page } from "tns-core-modules/ui/page";
+
+import * as TKUnit from "./tk-unit";
+import * as navHelper from "./ui-helper";
export class UITest implements trace.TraceWriter {
@@ -38,6 +39,7 @@ export class UITest implements trace.TraceWriter {
const pageFactory = () => {
const page = new Page();
this._testPage = page;
+
return page;
};
@@ -73,4 +75,4 @@ export class UITest implements trace.TraceWriter {
export function createTestCase(): UITest {
return null;
-}
\ No newline at end of file
+}
diff --git a/tests/app/ui/action-bar/action-bar-tests-common.ts b/tests/app/ui/action-bar/action-bar-tests-common.ts
index d7f2df017..fd88c9ae2 100644
--- a/tests/app/ui/action-bar/action-bar-tests-common.ts
+++ b/tests/app/ui/action-bar/action-bar-tests-common.ts
@@ -1,5 +1,5 @@
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import * as builder from "tns-core-modules/ui/builder";
import { Label } from "tns-core-modules/ui/label";
import { Button } from "tns-core-modules/ui/button";
@@ -32,6 +32,7 @@ export function test_actionItem_inherit_bindingContext() {
label = new Label();
label.text = "Text";
page.content = label;
+
return page;
};
@@ -46,7 +47,7 @@ export function test_actionBar_inherit_bindingContext_inXML() {
p.bindingContext = { myProp: "success" };
TKUnit.assertEqual(p.actionBar.title, "success", "actionBar.title");
-};
+}
export function test_actionItem_inherit_bindingContext_inXML() {
const p = builder.parse(
@@ -58,7 +59,7 @@ export function test_actionItem_inherit_bindingContext_inXML() {
const actionItem = p.actionBar.actionItems.getItemAt(0);
TKUnit.assertEqual(actionItem.text, "success", "actionItem.text");
-};
+}
export function test_actionItem_page_property_inXML() {
const p = builder.parse(
@@ -69,7 +70,7 @@ export function test_actionItem_page_property_inXML() {
const actionItem = p.actionBar.actionItems.getItemAt(0);
TKUnit.assertEqual(actionItem.page, p, "actionItem.page");
-};
+}
export function test_actionItem_actionView_inXML() {
const p = builder.parse(
@@ -79,7 +80,7 @@ export function test_actionItem_actionView_inXML() {
const label = p.actionBar.actionItems.getItemAt(0).actionView;
TKUnit.assert(label instanceof Label, "ActionItem.actionView not loaded correctly");
-};
+}
export function test_actionItem_actionView_inherit_bindingContext_inXML() {
const p = builder.parse(
@@ -91,7 +92,7 @@ export function test_actionItem_actionView_inherit_bindingContext_inXML() {
const label = p.actionBar.actionItems.getItemAt(0).actionView;
TKUnit.assert(label instanceof Label, "ActionItem.actionView not loaded correctly");
TKUnit.assertEqual(label.text, "success", "ActionItem.actionView");
-};
+}
export function test_ActionBar_is_not_empty_when_actionItem_actionView_is_set() {
const p = builder.parse(
@@ -100,7 +101,7 @@ export function test_ActionBar_is_not_empty_when_actionItem_actionView_is_set()
" ");
TKUnit.assertFalse(p.actionBar._isEmpty(), "ActionItem.actionView is set but ActionBar reports empty");
-};
+}
export function test_navigationButton_inherit_bindingContext_inXML() {
const p = builder.parse(
@@ -111,7 +112,7 @@ export function test_navigationButton_inherit_bindingContext_inXML() {
const navButton = p.actionBar.navigationButton;
TKUnit.assertEqual(navButton.text, "success", "actionItem.text");
-};
+}
export function test_titleView_inherit_bindingContext_inXML() {
const p = builder.parse(
@@ -123,7 +124,7 @@ export function test_titleView_inherit_bindingContext_inXML() {
const centerBtn = p.actionBar.titleView;
TKUnit.assert(centerBtn instanceof Button, "titleView not loaded correctly");
TKUnit.assertEqual(centerBtn.text, "success", "actionItem.text");
-};
+}
export function test_titleView_inXML() {
const p = builder.parse(
@@ -133,7 +134,7 @@ export function test_titleView_inXML() {
const centerBtn = p.actionBar.titleView;
TKUnit.assert(centerBtn instanceof Button, "titleView not loaded correctly");
-};
+}
export function test_titleView_inXML_short_definition() {
const p = builder.parse(
@@ -143,7 +144,7 @@ export function test_titleView_inXML_short_definition() {
const centerBtn = p.actionBar.titleView;
TKUnit.assert(centerBtn instanceof Button, "titleView not loaded correctly");
-};
+}
export function test_ActionBar_is_not_empty_when_titleView_is_set() {
const p = builder.parse(
@@ -152,7 +153,7 @@ export function test_ActionBar_is_not_empty_when_titleView_is_set() {
" ");
TKUnit.assertFalse(p.actionBar._isEmpty(), "titleView is set but ActionBar reports empty");
-};
+}
export function test_ActionBarItemBindingToEvent() {
const p = builder.parse("");
@@ -195,6 +196,7 @@ export function test_Setting_ActionItems_doesnt_thrown() {
label = new Label();
label.text = "Text";
page.content = label;
+
return page;
};
@@ -233,7 +235,7 @@ export function test_ActionBar_set_title_as_number_doesnt_thrown() {
}
TKUnit.assert(!gotException, "Expected: false, Actual: " + gotException);
-};
+}
export function test_CanDefineEverythingAsContentBetweenTheTwoTags() {
@@ -408,6 +410,7 @@ export function createPageAndNavigate() {
const label = new Label();
label.text = "Text";
page.content = label;
+
return page;
};
diff --git a/tests/app/ui/action-bar/action-bar-tests.android.ts b/tests/app/ui/action-bar/action-bar-tests.android.ts
index 1106182d0..6952b2f66 100644
--- a/tests/app/ui/action-bar/action-bar-tests.android.ts
+++ b/tests/app/ui/action-bar/action-bar-tests.android.ts
@@ -1,15 +1,15 @@
-import * as actionTestsCommon from "./action-bar-tests-common";
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
+import { createPageAndNavigate } from "./action-bar-tests-common";
import { ActionItem } from "tns-core-modules/ui/action-bar";
import { Visibility } from "tns-core-modules/ui/enums";
import { Button } from "tns-core-modules/ui/button";
-global.moduleMerge(actionTestsCommon, exports);
+export * from "./action-bar-tests-common";
export function test_actionItem_visibility() {
const actionItem = new ActionItem();
actionItem.text = "Test";
- const page = actionTestsCommon.createPageAndNavigate();
+ const page = createPageAndNavigate();
page.actionBar.actionItems.addItem(actionItem);
const toolbar = page.actionBar.nativeViewProtected;
const menu = toolbar.getMenu();
@@ -21,8 +21,8 @@ export function test_actionItem_visibility() {
export function test_navigationButton_visibility() {
const actionItem = new ActionItem();
- actionItem.icon = "~/small-image.png";
- const page = actionTestsCommon.createPageAndNavigate();
+ actionItem.icon = "~/assets/small-image.png";
+ const page = createPageAndNavigate();
page.actionBar.navigationButton = actionItem;
const toolbar = page.actionBar.nativeViewProtected;
@@ -34,10 +34,10 @@ export function test_navigationButton_visibility() {
export function test_navigationButton_contentDecription() {
const actionItem = new ActionItem();
- actionItem.icon = "~/small-image.png";
+ actionItem.icon = "~/assets/small-image.png";
const actionItemText = "NavButton with small-image";
actionItem.text = actionItemText;
- const page = actionTestsCommon.createPageAndNavigate();
+ const page = createPageAndNavigate();
page.actionBar.navigationButton = actionItem;
const toolbar = page.actionBar.nativeViewProtected;
@@ -50,7 +50,7 @@ export function test_set_actionView_to_attached_actionItem_propagates_context()
const actionButton = new Button();
actionItem.actionView = actionButton;
- const page = actionTestsCommon.createPageAndNavigate();
+ const page = createPageAndNavigate();
// sanity check
TKUnit.assertNotNull(page.content._context, "Page content context should not be null");
@@ -69,7 +69,7 @@ export function test_set_actionView_to_attached_actionItem_propagates_context()
export function test_add_actionItem_with_actionView_propagates_context() {
const actionItem = new ActionItem();
- const page = actionTestsCommon.createPageAndNavigate();
+ const page = createPageAndNavigate();
// sanity check
TKUnit.assertNotNull(page.content._context, "Page content context should not be null");
diff --git a/tests/app/ui/action-bar/action-bar-tests.ios.ts b/tests/app/ui/action-bar/action-bar-tests.ios.ts
index 64e7fea2f..e2addb787 100644
--- a/tests/app/ui/action-bar/action-bar-tests.ios.ts
+++ b/tests/app/ui/action-bar/action-bar-tests.ios.ts
@@ -1,13 +1,13 @@
-import * as actionTestsCommon from "./action-bar-tests-common";
+import { createPageAndNavigate } from "./action-bar-tests-common";
import * as PageModule from "tns-core-modules/ui/page";
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import * as LabelModule from "tns-core-modules/ui/label";
-import * as helper from "../helper";
+import * as helper from "../../ui-helper";
import * as view from "tns-core-modules/ui/core/view";
import * as actionBar from "tns-core-modules/ui/action-bar";
import { Visibility } from "tns-core-modules/ui/enums";
-global.moduleMerge(actionTestsCommon, exports);
+export * from "./action-bar-tests-common";
export function test_NavBar_isVisible_when_MenuItems_areSet() {
@@ -20,7 +20,7 @@ export function test_NavBar_isVisible_when_MenuItems_areSet() {
navBarIsVisible = !page.actionBar.nativeView.hidden;
console.log(navBarIsVisible);
console.log(page.actionBar.nativeView.hidden);
- }
+ };
var pageFactory = function (): PageModule.Page {
page = new PageModule.Page();
@@ -32,6 +32,7 @@ export function test_NavBar_isVisible_when_MenuItems_areSet() {
label = new LabelModule.Label();
label.text = "Text";
page.content = label;
+
return page;
};
@@ -56,7 +57,7 @@ export function test_NavBarItemsAreClearedFromNativeWhenClearedFromNativeScript(
for (i = menuItems.length - 1; i >= 0; i--) {
page.actionBar.actionItems.removeItem(menuItems[i]);
}
- }
+ };
var pageFactory = function (): PageModule.Page {
page = new PageModule.Page();
@@ -68,6 +69,7 @@ export function test_NavBarItemsAreClearedFromNativeWhenClearedFromNativeScript(
label = new LabelModule.Label();
label.text = "Text";
page.content = label;
+
return page;
};
@@ -87,7 +89,7 @@ export function test_actionItem_visibility() {
var actionItem = new actionBar.ActionItem();
actionItem.text = "Test";
actionItem.ios.position = "left";
- var page = actionTestsCommon.createPageAndNavigate();
+ var page = createPageAndNavigate();
page.actionBar.actionItems.addItem(actionItem);
@@ -111,7 +113,7 @@ export function test_actionItem_visibility() {
export function test_navigationButton_visibility() {
var actionItem = new actionBar.ActionItem();
actionItem.text = "Test";
- var page = actionTestsCommon.createPageAndNavigate();
+ var page = createPageAndNavigate();
page.actionBar.navigationButton = actionItem;
diff --git a/tests/app/ui/activity-indicator/activity-indicator-tests.ts b/tests/app/ui/activity-indicator/activity-indicator-tests.ts
index def58d71d..5cb3af052 100644
--- a/tests/app/ui/activity-indicator/activity-indicator-tests.ts
+++ b/tests/app/ui/activity-indicator/activity-indicator-tests.ts
@@ -1,5 +1,5 @@
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import * as viewModule from "tns-core-modules/ui/core/view";
import * as imageModule from "tns-core-modules/ui/image";
import * as platform from "tns-core-modules/platform";
@@ -29,7 +29,7 @@ export function test_default_native_values() {
function testAction(views: Array) {
TKUnit.assertEqual(getNativeBusy(indicator), false, "Default native indicator.busy");
- };
+ }
helper.buildUIAndRunTest(indicator, testAction);
}
@@ -43,7 +43,7 @@ export function test_set_TNS_value_updates_native_value() {
indicator.busy = true;
TKUnit.waitUntilReady(() => getNativeBusy(indicator) === true);
TKUnit.assertEqual(getNativeBusy(indicator), true, "Native value is different from TNS value.");
- };
+ }
helper.buildUIAndRunTest(indicator, testAction);
}
@@ -56,10 +56,10 @@ if (platform.device.os === platform.platformNames.ios) {
function testAction(views: Array) {
TKUnit.assertEqual(ai.color.ios.CGColor, ai.nativeViewProtected.color.CGColor, "ai.color");
- };
+ }
helper.buildUIAndRunTest(ai, testAction);
- }
+ };
}
// This method is only for the code snippet
diff --git a/tests/app/ui/animation/animation-tests.ts b/tests/app/ui/animation/animation-tests.ts
index 2652cfc8e..22f0e8c43 100644
--- a/tests/app/ui/animation/animation-tests.ts
+++ b/tests/app/ui/animation/animation-tests.ts
@@ -1,5 +1,5 @@
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import * as viewModule from "tns-core-modules/ui/core/view";
import { Label } from "tns-core-modules/ui/label";
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
@@ -28,6 +28,7 @@ function prepareTest(parentHeight?: number, parentWidth?: number): Label {
stackLayout.addChild(label);
mainPage.content = stackLayout;
TKUnit.waitUntilReady(() => label.isLoaded);
+
return label;
}
@@ -106,7 +107,7 @@ export function test_CancellingAnimation(done) {
if (!e) {
done(new Error("Cancel path did not have proper error"));
} else if (e.toString() === "Error: Animation cancelled.") {
- done()
+ done();
} else {
done(e);
}
@@ -133,7 +134,7 @@ export function test_CancellingAnimate(done) {
if (!e) {
done(new Error("Cancel path did not have proper error"));
} else if (e.toString() === "Error: Animation cancelled.") {
- done()
+ done();
} else {
done(e);
}
@@ -415,6 +416,7 @@ function animateExtentAndAssertExpected(along: "height" | "width", value: Percen
duration: 5,
[along]: value
};
+
return label.animate(props).then(() => {
const observedString: string = PercentLength.convertToString(label[along]);
const inputString: string = PercentLength.convertToString(value);
@@ -538,6 +540,7 @@ export function test_AnimateTranslateScaleAndRotateSequentially(done) {
TKUnit.assertEqual(label.translateX, 100, "label.translateX");
TKUnit.assertEqual(label.translateY, 200, "label.translateY");
assertIOSNativeTransformIsCorrect(label);
+
return label.animate({ scale: { x: 2, y: 3 }, duration: 5 });
})
.then(() => {
@@ -546,6 +549,7 @@ export function test_AnimateTranslateScaleAndRotateSequentially(done) {
TKUnit.assertEqual(label.scaleX, 2, "label.scaleX");
TKUnit.assertEqual(label.scaleY, 3, "label.scaleY");
assertIOSNativeTransformIsCorrect(label);
+
return label.animate({ rotate: 123, duration: 5 });
})
.then(() => {
@@ -571,7 +575,8 @@ export function test_AnimationsAreAlwaysPlayed(done) {
animation1.play()
.then(() => {
TKUnit.assert(label.opacity === 0, `Label opacity should be 0 after first animation, actual value is ${label.opacity}.`);
- return animation2.play()
+
+ return animation2.play();
})
.then(() => {
TKUnit.assert(label.opacity === 1, `Label opacity should be 1 after second animation, actual value is ${label.opacity}.`);
diff --git a/tests/app/ui/animation/css-animation-tests.ts b/tests/app/ui/animation/css-animation-tests.ts
index b9cd7d3be..bc3b02069 100644
--- a/tests/app/ui/animation/css-animation-tests.ts
+++ b/tests/app/ui/animation/css-animation-tests.ts
@@ -1,8 +1,8 @@
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import * as styleScope from "tns-core-modules/ui/styling/style-scope";
import * as keyframeAnimation from "tns-core-modules/ui/animation/keyframe-animation";
import * as enums from "tns-core-modules/ui/enums";
-import * as helper from "../../ui/helper";
+import * as helper from "../../ui-helper";
import * as stackModule from "tns-core-modules/ui/layouts/stack-layout";
import * as labelModule from "tns-core-modules/ui/label";
import * as color from "tns-core-modules/color";
@@ -19,13 +19,16 @@ function createAnimationFromCSS(css: string, name: string): keyframeAnimation.Ke
let selector = findSelectorInScope(scope, name);
if (selector !== undefined) {
let animation = scope.getAnimations(selector.ruleset)[0];
+
return animation;
}
+
return undefined;
}
function findSelectorInScope(scope: styleScope.StyleScope, cssClass: string): SelectorCore {
let selectors = scope.query({cssClasses: new Set([cssClass])});
+
return selectors[0];
}
@@ -144,7 +147,7 @@ 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 { scale, rotate } = getTransforms(animation.keyframes[0].declarations);
+ const { scale } = getTransforms(animation.keyframes[0].declarations);
TKUnit.assertEqual(scale.property, "scale");
TKUnit.assertAreClose(scale.value.x, -5, DELTA);
@@ -213,7 +216,7 @@ export function test_ReadTranslate() {
export function test_ReadTranslateSingle() {
const animation = createAnimationFromCSS(".test { animation-name: test; } @keyframes test { to { transform: translate(30); } }", "test");
- const { translate, rotate } = getTransforms(animation.keyframes[0].declarations);
+ const { translate } = getTransforms(animation.keyframes[0].declarations);
TKUnit.assertEqual(translate.property, "translate");
TKUnit.assertAreClose(translate.value.x, 30, DELTA);
@@ -314,7 +317,7 @@ export function test_ReadAnimationWithUnsortedKeyframes() {
}
export function test_ReadAnimationsWithCSSImport() {
- let css = "@import '~/ui/animation/test.css'; .test { animation-name: test; }";
+ let css = "@import 'ui/animation/test-page.css'; .test { animation-name: test; }";
let animation = createAnimationFromCSS(css, "test");
TKUnit.assertEqual(animation.keyframes.length, 3);
TKUnit.assertEqual(animation.keyframes[1].declarations[0].property, "backgroundColor");
@@ -351,7 +354,7 @@ export function test_LoadAnimationProgrammatically() {
export function test_ExecuteCSSAnimation() {
let mainPage = helper.getCurrentPage();
mainPage.css = null;
- let label = new labelModule.Label()
+ let label = new labelModule.Label();
label.text = "label";
let stackLayout = new stackModule.StackLayout();
stackLayout.addChild(label);
@@ -387,7 +390,7 @@ export function test_ExecuteCSSAnimation() {
// TKUnit.assertEqual(label.backgroundColor, undefined, "label.backgroundColor should be undefind");
-// label.className = "l";
+// label.className = "l";
// TKUnit.assertEqual(label.backgroundColor, undefined, "label.backgroundColor should be undefind");
// label.className = "l2";
@@ -429,5 +432,6 @@ function getTransformsValues(declarations) {
function getTransforms(declarations) {
const [ translate, rotate, scale ] = [...declarations];
+
return { translate, rotate, scale };
}
diff --git a/tests/app/ui/animation/test.css b/tests/app/ui/animation/test-page.css
similarity index 100%
rename from tests/app/ui/animation/test.css
rename to tests/app/ui/animation/test-page.css
diff --git a/tests/app/ui/border/border-tests.ts b/tests/app/ui/border/border-tests.ts
index c50b618ab..8989d8bc8 100644
--- a/tests/app/ui/border/border-tests.ts
+++ b/tests/app/ui/border/border-tests.ts
@@ -1,7 +1,7 @@
// >> border-require
import { Border } from "tns-core-modules/ui/border";
// << border-require
-import * as helper from "../helper";
+import * as helper from "../../ui-helper";
export function test_recycling() {
helper.nativeView_recycling_test(() => new Border());
diff --git a/tests/app/ui/bottom-navigation/bottom-navigation-navigation-tests.ts b/tests/app/ui/bottom-navigation/bottom-navigation-navigation-tests.ts
index b0b506f35..c1ed2b09c 100644
--- a/tests/app/ui/bottom-navigation/bottom-navigation-navigation-tests.ts
+++ b/tests/app/ui/bottom-navigation/bottom-navigation-navigation-tests.ts
@@ -1,10 +1,9 @@
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
-import { isIOS, isAndroid } from "tns-core-modules/platform";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import { Label } from "tns-core-modules/ui/label";
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
import * as frameModule from "tns-core-modules/ui/frame";
-import { Page, NavigatedData } from "tns-core-modules/ui/page";
+import { Page } from "tns-core-modules/ui/page";
import { ListView, ItemEventData } from "tns-core-modules/ui/list-view";
import { BottomNavigation, TabContentItem, TabStrip, TabStripItem } from "tns-core-modules/ui/bottom-navigation";
import { Button } from "tns-core-modules/ui/button";
@@ -14,6 +13,7 @@ var ASYNC = 2;
function _createBottomNavigation(): BottomNavigation {
var tabView = new BottomNavigation();
tabView.id = "BottomNavigation";
+
return tabView;
}
@@ -26,6 +26,7 @@ function _createContentItems(count: number): Array {
tabEntry.view = label;
items.push(tabEntry);
}
+
return items;
}
@@ -73,16 +74,18 @@ function _clickHandlerFactory(index: number) {
var detailsPage = new Page();
detailsPage.id = "details-page";
detailsPage.content = detailsLabel;
+
return detailsPage;
};
helper.navigateWithHistory(pageFactory);
- }
+ };
}
function _createFrameView(): frameModule.Frame {
const frame = new frameModule.Frame();
frame.navigate({ create: () => new Page() });
+
return frame;
}
@@ -114,7 +117,7 @@ export function testBackNavigationToTabViewWithNestedFramesShouldWork() {
tabViewPage.content = tabView;
return tabViewPage;
- }
+ };
helper.waitUntilNavigatedFrom(() => topFrame.navigate(pageFactory), topFrame);
@@ -134,12 +137,6 @@ export function testBackNavigationToTabViewWithNestedFramesShouldWork() {
export function testWhenNavigatingBackToANonCachedPageContainingATabViewWithAListViewTheListViewIsThere() {
var topFrame = frameModule.topmost();
- let oldChache;
- if (topFrame.android) {
- oldChache = topFrame.android.cachePagesOnNavigate;
- topFrame.android.cachePagesOnNavigate = true;
- }
-
let tabViewPage: Page;
let tabView: BottomNavigation;
@@ -169,7 +166,7 @@ export function testWhenNavigatingBackToANonCachedPageContainingATabViewWithALis
tabViewPage.content = tabView;
return tabViewPage;
- }
+ };
let rootPage = helper.getCurrentPage();
@@ -187,10 +184,6 @@ export function testWhenNavigatingBackToANonCachedPageContainingATabViewWithALis
TKUnit.waitUntilReady(() => topFrame.currentPage === rootPage);
- if (topFrame.android) {
- topFrame.android.cachePagesOnNavigate = oldChache;
- }
-
TKUnit.assert(tabView.items[0].view instanceof ListView, "ListView should be created when navigating back to the main page.");
}
@@ -229,13 +222,13 @@ export function testLoadedAndUnloadedAreFired_WhenNavigatingAwayAndBack() {
function createLoadedFor(tabIndex: number) {
return function () {
loadedEventsCount[tabIndex] = loadedEventsCount[tabIndex] + 1;
- }
+ };
}
function createUnloadedFor(tabIndex: number) {
return function () {
unloadedEventsCount[tabIndex] = unloadedEventsCount[tabIndex] + 1;
- }
+ };
}
tabView.items.forEach((item, i) => {
@@ -246,6 +239,7 @@ export function testLoadedAndUnloadedAreFired_WhenNavigatingAwayAndBack() {
const tabViewPage = new Page();
helper.navigateWithHistory(() => {
tabViewPage.content = tabView;
+
return tabViewPage;
});
TKUnit.waitUntilReady(() => tabViewIsFullyLoaded(tabView), ASYNC);
@@ -286,4 +280,4 @@ function _clickTheFirstButtonInTheListViewNatively(tabView: BottomNavigation) {
const btn = cell.contentView.subviews[0];
btn.sendActionsForControlEvents(UIControlEvents.TouchUpInside);
}
-}
\ No newline at end of file
+}
diff --git a/tests/app/ui/bottom-navigation/bottom-navigation-root-tests.ts b/tests/app/ui/bottom-navigation/bottom-navigation-root-tests.ts
index 9cce92bb5..39bccdb96 100644
--- a/tests/app/ui/bottom-navigation/bottom-navigation-root-tests.ts
+++ b/tests/app/ui/bottom-navigation/bottom-navigation-root-tests.ts
@@ -1,4 +1,4 @@
-import TKUnit = require("../../TKUnit");
+import * as TKUnit from "../../tk-unit";
import { isAndroid } from "tns-core-modules/platform";
import { _resetRootView } from "tns-core-modules/application/";
import { Frame, NavigationEntry, topmost } from "tns-core-modules/ui/frame";
diff --git a/tests/app/ui/bottom-navigation/bottom-navigation-tests-native.android.ts b/tests/app/ui/bottom-navigation/bottom-navigation-tests-native.android.ts
index 0f43ac234..1640c79de 100644
--- a/tests/app/ui/bottom-navigation/bottom-navigation-tests-native.android.ts
+++ b/tests/app/ui/bottom-navigation/bottom-navigation-tests-native.android.ts
@@ -1,4 +1,4 @@
-import { BottomNavigation } from "tns-core-modules/ui/bottom-navigation";
+import { BottomNavigation } from "tns-core-modules/ui/bottom-navigation";
export function getNativeTabCount(tabView: BottomNavigation): number {
// there is no native tab content view implementation for Android Bottom Navigation
@@ -24,7 +24,7 @@ export function getNativeFont(tabView: BottomNavigation): any {
return {
typeface: tv.getTypeface(),
size: tv.getTextSize()
- }
+ };
}
return null;
@@ -32,8 +32,9 @@ export function getNativeFont(tabView: BottomNavigation): any {
export function getOriginalFont(tabView: BottomNavigation): any {
const tv: android.widget.TextView = ((tabView)._bottomNavigationBar).getTextViewForItemAt(0);
+
return {
typeface: tv.getTypeface(),
size: tv.getTextSize()
- }
+ };
}
\ No newline at end of file
diff --git a/tests/app/ui/bottom-navigation/bottom-navigation-tests-native.ios.ts b/tests/app/ui/bottom-navigation/bottom-navigation-tests-native.ios.ts
index 47cea99ca..5d197bd12 100644
--- a/tests/app/ui/bottom-navigation/bottom-navigation-tests-native.ios.ts
+++ b/tests/app/ui/bottom-navigation/bottom-navigation-tests-native.ios.ts
@@ -1,6 +1,4 @@
import tabViewModule = require("tns-core-modules/ui/tab-view");
-import * as utils from "tns-core-modules/utils/utils";
-import getter = utils.ios.getter;
export function getNativeTabCount(tabView: tabViewModule.TabView): number {
if (!tabView.ios.viewControllers) {
@@ -33,4 +31,4 @@ export function getNativeFont(tabView: tabViewModule.TabView): UIFont {
export function getOriginalFont(tabView: tabViewModule.TabView): UIFont {
return tabView.style.fontInternal.getUIFont(UIFont.systemFontOfSize(10));
-}
\ No newline at end of file
+}
diff --git a/tests/app/ui/bottom-navigation/bottom-navigation-tests.ts b/tests/app/ui/bottom-navigation/bottom-navigation-tests.ts
index 9475c5be4..ef07c7feb 100644
--- a/tests/app/ui/bottom-navigation/bottom-navigation-tests.ts
+++ b/tests/app/ui/bottom-navigation/bottom-navigation-tests.ts
@@ -1,18 +1,17 @@
import { UITest } from "../../ui-test";
import { Label } from "tns-core-modules/ui/label";
-import { unsetValue } from "tns-core-modules/ui/core/view";
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import * as tabViewTestsNative from "./bottom-navigation-tests-native";
import { BottomNavigation, TabContentItem, TabStrip, TabStripItem, SelectedIndexChangedEventData } from "tns-core-modules/ui/bottom-navigation";
-import { constants } from "zlib";
export class BottomNavigationTest extends UITest {
public create(): BottomNavigation {
var tabView = new BottomNavigation();
tabView.id = "TabView";
+
return tabView;
}
@@ -31,6 +30,7 @@ export class BottomNavigationTest extends UITest {
tabEntry.view = label;
items.push(tabEntry);
}
+
return items;
}
@@ -78,11 +78,11 @@ export class BottomNavigationTest extends UITest {
public test_when_created_items_are_undefined = function () {
TKUnit.assertEqual(this.testView.items, undefined, "Items should be undefined initally.");
- }
+ };
public test_when_created_selected_index_is_undefined = function () {
TKUnit.assertEqual(this.testView.selectedIndex, -1, "selectedIndex should be undefined initally.");
- }
+ };
// TODO: Do we need this test?
public test_when_setting_items_to_non_empty_array_the_same_amount_of_native_tabs_is_created = function () {
@@ -93,7 +93,7 @@ export class BottomNavigationTest extends UITest {
let actualValue = tabViewTestsNative.getNativeTabCount(this.testView);
TKUnit.assertEqual(actualValue, expectedValue, "NativeItems not equal to JS items.");
- }
+ };
// TODO: Do we need this test?
public test_when_setting_items_to_empty_array_zero_native_tabs_are_created = function () {
@@ -105,7 +105,7 @@ export class BottomNavigationTest extends UITest {
var actualValue = tabViewTestsNative.getNativeTabCount(tabView);
TKUnit.assertEqual(actualValue, expectedValue, "Should have 0 native tabs.");
- }
+ };
public test_selected_index_becomes_zero_when_items_bound_to_non_empty_array = function () {
var tabView = this.testView;
@@ -136,7 +136,7 @@ export class BottomNavigationTest extends UITest {
var expectedValue = 0;
var actualValue = tabView.selectedIndex;
TKUnit.assertEqual(actualValue, expectedValue, "When bound selectedIndex should be 0.");
- }
+ };
public test_selected_index_becomes_undefined_when_items_bound_to_empty_array = function () {
var tabView = this.testView;
@@ -150,7 +150,7 @@ export class BottomNavigationTest extends UITest {
var expectedValue = -1;
var actualValue = tabView.selectedIndex;
TKUnit.assertEqual(actualValue, expectedValue, "selectedIndex should be undefined.");
- }
+ };
public test_selected_index_becomes_undefined_when_items_set_to_undefined = function () {
var tabView = this.testView;
@@ -164,7 +164,7 @@ export class BottomNavigationTest extends UITest {
var expectedValue = -1;
var actualValue = tabView.selectedIndex;
TKUnit.assertEqual(actualValue, expectedValue, "selectedIndex should be undefined.");
- }
+ };
public test_selected_index_becomes_undefined_when_items_set_to_null = function () {
var tabView = this.testView;
@@ -177,7 +177,7 @@ export class BottomNavigationTest extends UITest {
var expectedValue = -1;
var actualValue = tabView.selectedIndex;
TKUnit.assertEqual(actualValue, expectedValue, "selectedIndex should be undefined.");
- }
+ };
public test_items_is_resolved_correctly_if_set_before_view_is_loaded = function () {
var tabView = this.testView;
@@ -188,7 +188,7 @@ export class BottomNavigationTest extends UITest {
var actualValue = tabView.items.length;
TKUnit.assertEqual(actualValue, expectedValue, "items.length should be 5");
- }
+ };
public test_selected_index_is_resolved_correctly_if_set_before_view_is_loaded = function () {
var tabView = this.testView;
@@ -199,7 +199,7 @@ export class BottomNavigationTest extends UITest {
var actualValue = tabView.selectedIndex;
TKUnit.assertEqual(actualValue, expectedValue, "selectedIndex");
- }
+ };
public test_binding_to_tabitem_with_undefined_view_should_throw = function () {
var tabView = this.testView;
@@ -212,7 +212,7 @@ export class BottomNavigationTest extends UITest {
tabView.items = [item];
}, "Binding TabNavigation to a TabItem with undefined view should throw.");
- }
+ };
public test_binding_to_tabitem_with_null_view_should_throw = function () {
var tabView = this.testView;
@@ -225,7 +225,7 @@ export class BottomNavigationTest extends UITest {
tabView.items = [item];
}, "Binding TabNavigation to a TabItem with null view should throw.");
- }
+ };
public test_when_selecting_tab_natively_selectedIndex_is_updated_properly = function () {
var tabView = this.testView;
@@ -240,7 +240,7 @@ export class BottomNavigationTest extends UITest {
var actualValue = tabView.selectedIndex;
TKUnit.assertEqual(actualValue, expectedValue, "selectedIndex");
- }
+ };
public test_when_selecting_tab_natively_selectedIndexChangedEvent_is_raised = function () {
var tabView = this.testView;
@@ -269,7 +269,7 @@ export class BottomNavigationTest extends UITest {
TKUnit.assertEqual(actualOldIndex, expectedOldIndex, "expectedOldIndex");
TKUnit.assertEqual(actualNewIndex, expectedNewIndex, "expectedNewIndex");
- }
+ };
// TODO: Do we need this test?
public test_when_setting_selectedIndex_programatically_selectedIndexChangedEvent_is_raised = function () {
@@ -290,7 +290,7 @@ export class BottomNavigationTest extends UITest {
tabView.on(BottomNavigation.selectedIndexChangedEvent, (args: SelectedIndexChangedEventData) => {
actualOldIndex = args.oldIndex;
actualNewIndex = args.newIndex;
- TKUnit.assertEqual(args.object, tabView, "args.object should be TabView")
+ TKUnit.assertEqual(args.object, tabView, "args.object should be TabView");
});
tabView.selectedIndex = expectedNewIndex;
@@ -300,7 +300,7 @@ export class BottomNavigationTest extends UITest {
TKUnit.assertEqual(actualOldIndex, expectedOldIndex, "expectedOldIndex");
TKUnit.assertEqual(actualNewIndex, expectedNewIndex, "expectedNewIndex");
- }
+ };
// TODO: fonts are not yet supported
// public test_font_is_reapplied_when_tab_items_change = function () {
diff --git a/tests/app/ui/builder/builder-file-qualifiers-tests.ts b/tests/app/ui/builder/builder-file-qualifiers-tests.ts
new file mode 100644
index 000000000..1e572ab51
--- /dev/null
+++ b/tests/app/ui/builder/builder-file-qualifiers-tests.ts
@@ -0,0 +1,468 @@
+import { createViewFromEntry } from "tns-core-modules/ui/builder";
+import { assertEqual, assertNull, assertThrows, assertNotNull, assert } from "../../tk-unit";
+import { _setResolver, ModuleNameResolver, PlatformContext } from "tns-core-modules/module-name-resolver";
+import { Button } from "tns-core-modules/ui/button";
+import { navigate } from "../../ui-helper";
+import { Page, Color } from "tns-core-modules/ui/page";
+
+const testPrefix = "bundle-file-qualifiers-tests";
+let modulesToCleanup: string[] = [];
+function registerTestModule(name, loader: (name: string) => void) {
+ modulesToCleanup.push(name);
+ global.registerModule(name, loader);
+}
+
+export function setUp() {
+ _setResolver(new ModuleNameResolver({
+ width: 640,
+ height: 360,
+ os: "android",
+ deviceType: "phone"
+ }));
+}
+
+export function tearDown() {
+ modulesToCleanup.forEach(global._unregisterModule);
+ modulesToCleanup = [];
+ _setResolver(undefined);
+}
+
+function createViewFromEntryAndNavigate(): Page {
+ const page = createViewFromEntry({
+ moduleName: `${testPrefix}/test`
+ });
+
+ navigate(() => page);
+
+ return page;
+}
+
+function loadRightCss() {
+ return `.test-class { color: green }`;
+}
+
+function loadRightXml() {
+ return `
+
+
+ `;
+}
+
+let testEventCalled = false;
+function loadRightJS() {
+ return {
+ testEvent: () => {
+ testEventCalled = true;
+ }
+ };
+}
+
+function loadRightJS_CreatePage() {
+ return {
+ createPage: () => {
+ const page = new Page();
+ const btn = new Button();
+ btn.id = "test-id";
+ btn.className = "test-class";
+ btn.text = "right";
+ btn.on("tap", () => { testEventCalled = true; });
+ page.content = btn;
+
+ return page;
+ }
+ };
+}
+
+function loadWrongCss(name: string) {
+ throw new Error(`Loading wrong CSS module: ${name}`);
+}
+
+function loadWrongXml(name: string) {
+ throw new Error(`Loading wrong XML module: ${name}`);
+}
+
+function loadWrongJS(name: string) {
+ throw new Error(`Loading wrong JS module: ${name}`);
+}
+
+function assertXmlCss(btn: Button) {
+ assertNotNull(btn, "Test button not found");
+
+ assertEqual(btn.text, "right", "Wrong XML loaded");
+
+ assertNotNull(btn.style.color, "Wrong CSS loaded");
+ assertEqual(btn.style.color.hex, new Color("green").hex, "Wrong CSS loaded");
+}
+
+function assertXmlCssJs(btn: Button) {
+ assertXmlCss(btn);
+
+ testEventCalled = false;
+ btn._emit("tap");
+ assert(testEventCalled, "Wrong JS loaded");
+}
+
+export function testPageWithXmlCssJs_NoQualifiers() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadRightXml);
+ registerTestModule(`${testPrefix}/test.css`, loadRightCss);
+ registerTestModule(`${testPrefix}/test`, loadRightJS);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+export function testPageWithJsCss_NoXML_NoQualifiers() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test`, loadRightJS_CreatePage);
+ registerTestModule(`${testPrefix}/test.css`, loadRightCss);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+export function testPageWithXmlCss_NoJS_NoQualifiers() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadRightXml);
+ registerTestModule(`${testPrefix}/test.css`, loadRightCss);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCss(page.getViewById("test-id"));
+}
+
+export function testPageWithXmlCssJs_CssQualifier() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadRightXml);
+ registerTestModule(`${testPrefix}/test.css`, loadWrongCss);
+ registerTestModule(`${testPrefix}/test.land.css`, loadRightCss);
+ registerTestModule(`${testPrefix}/test`, loadRightJS);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+export function testPageWithXmlCssJs_XmlQualifier() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadWrongXml);
+ registerTestModule(`${testPrefix}/test.land.xml`, loadRightXml);
+ registerTestModule(`${testPrefix}/test.css`, loadRightCss);
+ registerTestModule(`${testPrefix}/test`, loadRightJS);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+export function testPageWithXmlCssJs_JsQualifier() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadRightXml);
+ registerTestModule(`${testPrefix}/test.css`, loadRightCss);
+ registerTestModule(`${testPrefix}/test`, loadWrongJS);
+ registerTestModule(`${testPrefix}/test.land`, loadRightJS);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+export function testPageWithXmlCssJs_XmlCssJsQualifiers() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadWrongXml);
+ registerTestModule(`${testPrefix}/test.land.xml`, loadRightXml);
+ registerTestModule(`${testPrefix}/test.css`, loadWrongCss);
+ registerTestModule(`${testPrefix}/test.land.css`, loadRightCss);
+ registerTestModule(`${testPrefix}/test`, loadWrongJS);
+ registerTestModule(`${testPrefix}/test.land`, loadRightJS);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+export function testPageWithXmlCss_NoJS_XmlQualifier() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadWrongXml);
+ registerTestModule(`${testPrefix}/test.land.xml`, loadRightXml);
+ registerTestModule(`${testPrefix}/test.css`, loadRightCss);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCss(page.getViewById("test-id"));
+}
+
+export function testPageWithJsCss_NoXML_JsQualifier() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test`, loadWrongJS);
+ registerTestModule(`${testPrefix}/test.land`, loadRightJS_CreatePage);
+ registerTestModule(`${testPrefix}/test.css`, loadRightCss);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+function loadPageXmlWithCssFile() {
+ return `
+
+
+ `;
+}
+
+export function testPageWithXmlCssJs_WithCssFile_NoQualifiers() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadPageXmlWithCssFile);
+ registerTestModule(`${testPrefix}/test.css`, loadWrongCss);
+ registerTestModule(`${testPrefix}/custom-test.css`, loadRightCss);
+ registerTestModule(`${testPrefix}/test`, loadRightJS);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+export function testPageWithXmlCssJs_WithCssFile_WithQualifiers() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadPageXmlWithCssFile);
+ registerTestModule(`${testPrefix}/test.css`, loadWrongCss);
+ registerTestModule(`${testPrefix}/custom-test.css`, loadWrongCss);
+ registerTestModule(`${testPrefix}/custom-test.land.css`, loadRightCss);
+ registerTestModule(`${testPrefix}/test`, loadRightJS);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+function loadPageXmlWithCodeFile() {
+ return `
+
+
+ `;
+}
+
+export function testPageWithXmlCssJs_WithCodeFile_NoQualifiers() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadPageXmlWithCodeFile);
+ registerTestModule(`${testPrefix}/test.css`, loadRightCss);
+ registerTestModule(`${testPrefix}/custom-test`, loadRightJS);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+export function testPageWithXmlCssJs_WithCodeFile_WithQualifiers() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadPageXmlWithCodeFile);
+ registerTestModule(`${testPrefix}/test.css`, loadRightCss);
+ registerTestModule(`${testPrefix}/custom-test`, loadWrongJS);
+ registerTestModule(`${testPrefix}/custom-test.land`, loadRightJS);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+// --------------------------------------------------------------
+// ----------------- Custom Component Tests ---------------------
+// --------------------------------------------------------------
+
+function loadPageXmlWithComponent() {
+ return `
+
+
+ `;
+}
+
+function loadRightComponentXml() {
+ return ``;
+}
+
+export function testCustomComponentWithXmlCssJs_NoQualifiers() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadPageXmlWithComponent);
+ registerTestModule(`${testPrefix}/component/MyComponent.xml`, loadRightComponentXml);
+ registerTestModule(`${testPrefix}/component/MyComponent.css`, loadRightCss);
+ registerTestModule(`${testPrefix}/component/MyComponent`, loadRightJS);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+export function testCustomComponentWithXmlCssJs_JsQualifiers() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadPageXmlWithComponent);
+ registerTestModule(`${testPrefix}/component/MyComponent.xml`, loadRightComponentXml);
+ registerTestModule(`${testPrefix}/component/MyComponent.css`, loadRightCss);
+ registerTestModule(`${testPrefix}/component/MyComponent`, loadWrongJS);
+ registerTestModule(`${testPrefix}/component/MyComponent.land`, loadRightJS);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+export function testCustomComponentWithXmlCssJs_CssQualifiers() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadPageXmlWithComponent);
+ registerTestModule(`${testPrefix}/component/MyComponent.xml`, loadRightComponentXml);
+ registerTestModule(`${testPrefix}/component/MyComponent.css`, loadWrongCss);
+ registerTestModule(`${testPrefix}/component/MyComponent.land.css`, loadRightCss);
+ registerTestModule(`${testPrefix}/component/MyComponent`, loadRightJS);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+export function testCustomComponentWithXmlCssJs_XmlQualifiers() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadPageXmlWithComponent);
+ registerTestModule(`${testPrefix}/component/MyComponent.xml`, loadWrongXml);
+ registerTestModule(`${testPrefix}/component/MyComponent.land.xml`, loadRightComponentXml);
+ registerTestModule(`${testPrefix}/component/MyComponent.css`, loadRightCss);
+ registerTestModule(`${testPrefix}/component/MyComponent`, loadRightJS);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+export function testCustomComponentWithXmlCssJs_XmlCssJsQualifiers() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadPageXmlWithComponent);
+ registerTestModule(`${testPrefix}/component/MyComponent.xml`, loadWrongXml);
+ registerTestModule(`${testPrefix}/component/MyComponent.css`, loadWrongCss);
+ registerTestModule(`${testPrefix}/component/MyComponent`, loadWrongJS);
+ registerTestModule(`${testPrefix}/component/MyComponent.land.xml`, loadRightComponentXml);
+ registerTestModule(`${testPrefix}/component/MyComponent.land.css`, loadRightCss);
+ registerTestModule(`${testPrefix}/component/MyComponent.land`, loadRightJS);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+function loadCodeCustomComponentJS() {
+ class MyComponent extends Button {
+ constructor() {
+ super();
+ this.id = "test-id";
+ this.className = "test-class";
+ this.text = "right";
+ this.on("tap", () => { testEventCalled = true; });
+ }
+ }
+
+ return { MyComponent };
+}
+
+export function testCustomComponentWithCode_NoQualifiers() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadPageXmlWithComponent);
+ registerTestModule(`${testPrefix}/component`, loadCodeCustomComponentJS);
+ registerTestModule(`${testPrefix}/component.css`, loadRightCss);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+export function testCustomComponentWithCode_JsCssQualifiers() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadPageXmlWithComponent);
+ registerTestModule(`${testPrefix}/component`, loadWrongJS);
+ registerTestModule(`${testPrefix}/component.land`, loadCodeCustomComponentJS);
+ registerTestModule(`${testPrefix}/component.css`, loadWrongCss);
+ registerTestModule(`${testPrefix}/component.land.css`, loadRightCss);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+function loadRightComponentXmlWithCodeFileAndCssFile() {
+ return ``;
+}
+
+export function testCustomComponent_WithCodeFileAndCssFile_NoQualifiers() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadPageXmlWithComponent);
+ registerTestModule(`${testPrefix}/component/MyComponent.xml`, loadRightComponentXmlWithCodeFileAndCssFile);
+
+ registerTestModule(`${testPrefix}/component/MyComponent.css`, loadWrongCss);
+ registerTestModule(`${testPrefix}/component/custom-code-component`, loadRightJS);
+ registerTestModule(`${testPrefix}/component/custom-code-component.css`, loadRightCss);
+
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
+
+export function testCustomComponent_WithCodeFileAndCssFile_WithQualifiers() {
+ // Arrange
+ registerTestModule(`${testPrefix}/test.xml`, loadPageXmlWithComponent);
+ registerTestModule(`${testPrefix}/component/MyComponent.xml`, loadRightComponentXmlWithCodeFileAndCssFile);
+
+ registerTestModule(`${testPrefix}/component/MyComponent.css`, loadWrongCss);
+ registerTestModule(`${testPrefix}/component/custom-code-component`, loadWrongJS);
+ registerTestModule(`${testPrefix}/component/custom-code-component.css`, loadWrongCss);
+
+ registerTestModule(`${testPrefix}/component/custom-code-component.land`, loadRightJS);
+ registerTestModule(`${testPrefix}/component/custom-code-component.land.css`, loadRightCss);
+ // Act
+ const page = createViewFromEntryAndNavigate();
+
+ // Assert
+ assertXmlCssJs(page.getViewById("test-id"));
+}
diff --git a/tests/app/ui/builder/builder-tests.ts b/tests/app/ui/builder/builder-tests.ts
index f9cb5885d..32cb83b95 100644
--- a/tests/app/ui/builder/builder-tests.ts
+++ b/tests/app/ui/builder/builder-tests.ts
@@ -1,16 +1,12 @@
-import { path } from "tns-core-modules/file-system";
-import { loadPage } from "tns-core-modules/ui/builder";
-import { assertEqual, assertNull, assertThrows } from "../../TKUnit";
+import { createViewFromEntry } from "tns-core-modules/ui/builder";
+import { assertEqual, assertNull, assertThrows, assertNotNull } from "../../tk-unit";
-const COMPONENT_MODULE = "component-module";
-const MISSING_MODULE = "missing-module";
-const LABEL = "label";
+const COMPONENT_MODULE = "ui/builder/component-module";
+const MISSING_MODULE = "ui/builder/missing-module";
+const labelId = "label";
-function getViewComponent(componentModule: string) {
- const moduleNamePath = path.join(__dirname, componentModule);
- const fileName = path.join(__dirname, `${componentModule}.xml`);
- const view = loadPage(moduleNamePath, fileName);
- return view;
+function getViewComponent(moduleName: string) {
+ return createViewFromEntry({ moduleName });
}
export function test_view_is_module_root_component() {
@@ -21,12 +17,22 @@ export function test_view_is_module_root_component() {
export function test_view_is_NOT_module_root_component() {
const view = getViewComponent(COMPONENT_MODULE);
- const nestedView = view.getViewById(`${LABEL}`);
+ const nestedView = view.getViewById(`${labelId}`);
const undefinedModule = nestedView._moduleName;
assertNull(undefinedModule, `View<${nestedView}> should NOT be a root component of a module.`);
}
-export function test_load_component_from_missing_module_throws() {
+export function test_create_view_from_entry_from_missing_module_throws() {
assertThrows(() => getViewComponent(MISSING_MODULE),
- "Loading component from a missing module SHOULD throw an error.")
+ "Loading component from a missing module SHOULD throw an error.");
}
+
+export function test_create_view_from_entry_with_path_with_slash() {
+ const view = getViewComponent("/" + COMPONENT_MODULE);
+ assertNotNull(view, `Module starting with "/" could not be loaded`);
+}
+
+export function test_create_view_from_entry_with_path_with_tilde() {
+ const view = getViewComponent("~/" + COMPONENT_MODULE);
+ assertNotNull(view, `Module starting with "~/" could not be loaded`);
+}
\ No newline at end of file
diff --git a/tests/app/ui/button/button-tests-native.android.ts b/tests/app/ui/button/button-tests-native.android.ts
index 1b709f4f9..d5f41db61 100644
--- a/tests/app/ui/button/button-tests-native.android.ts
+++ b/tests/app/ui/button/button-tests-native.android.ts
@@ -1,4 +1,4 @@
-import * as buttonModule from "tns-core-modules/ui/button";
+import * as buttonModule from "tns-core-modules/ui/button";
import * as colorModule from "tns-core-modules/color";
import * as utilsModule from "tns-core-modules/utils/utils";
import * as enums from "tns-core-modules/ui/enums";
@@ -13,6 +13,7 @@ export function getNativeTextWrap(button: buttonModule.Button): boolean {
export function getNativeFontSize(button: buttonModule.Button): number {
var density = utilsModule.layout.getDisplayDensity();
+
return button.android.getTextSize() / density;
}
@@ -26,7 +27,7 @@ export function getNativeBackgroundColor(button: buttonModule.Button): colorModu
return new colorModule.Color((bkg).getBackgroundColor());
}
else {
- return new colorModule.Color(bkg.backgroundColor)
+ return new colorModule.Color(bkg.backgroundColor);
}
}
diff --git a/tests/app/ui/button/button-tests-native.ios.ts b/tests/app/ui/button/button-tests-native.ios.ts
index 41f31545f..ced55b4c0 100644
--- a/tests/app/ui/button/button-tests-native.ios.ts
+++ b/tests/app/ui/button/button-tests-native.ios.ts
@@ -1,7 +1,7 @@
import * as buttonModule from "tns-core-modules/ui/button";
import * as colorModule from "tns-core-modules/color";
import * as enums from "tns-core-modules/ui/enums";
-import { getColor } from "../helper";
+import { getColor } from "../../ui-helper";
export function getNativeText(button: buttonModule.Button): string {
return button.ios.titleForState(UIControlState.Normal);
diff --git a/tests/app/ui/button/button-tests.ts b/tests/app/ui/button/button-tests.ts
index 1af31325d..a3119ca09 100644
--- a/tests/app/ui/button/button-tests.ts
+++ b/tests/app/ui/button/button-tests.ts
@@ -1,5 +1,5 @@
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import * as viewModule from "tns-core-modules/ui/core/view";
import * as pagesModule from "tns-core-modules/ui/page";
import * as buttonTestsNative from "./button-tests-native";
@@ -22,69 +22,70 @@ export function test_recycling() {
export var testSetText = function () {
helper.buildUIAndRunTest(_createButtonFunc(), _testSetText);
-}
+};
export var testOnClick = function () {
helper.buildUIAndRunTest(_createButtonFunc(), _testOnClick);
-}
+};
export var testBindTextDirectlyToModel = function () {
helper.buildUIAndRunTest(_createButtonFunc(), _testBindTextDirectlyToModel);
-}
+};
export var testBindTextToBindingContext = function () {
helper.buildUIAndRunTest(_createButtonFunc(), _testBindTextToBindingContext);
-}
+};
export var testLocalFontSizeFromCss = function () {
helper.buildUIAndRunTest(_createButtonFunc(), _testLocalFontSizeFromCss);
-}
+};
export var testNativeFontSizeFromCss = function () {
helper.buildUIAndRunTest(_createButtonFunc(), _testNativeFontSizeFromCss);
-}
+};
export var testNativeFontSizeFromLocal = function () {
helper.buildUIAndRunTest(_createButtonFunc(), _testNativeFontSizeFromLocal);
-}
+};
export var testLocalColorFromCss = function () {
helper.buildUIAndRunTest(_createButtonFunc(), _testLocalColorFromCss);
-}
+};
export var testNativeColorFromCss = function () {
helper.buildUIAndRunTest(_createButtonFunc(), _testNativeColorFromCss);
-}
+};
export var testNativeColorFromLocal = function () {
helper.buildUIAndRunTest(_createButtonFunc(), _testNativeColorFromLocal);
-}
+};
export var testLocalBackgroundColorFromCss = function () {
helper.buildUIAndRunTest(_createButtonFunc(), _testLocalBackgroundColorFromCss);
-}
+};
export var testNativeBackgroundColorFromCss = function () {
helper.buildUIAndRunTest(_createButtonFunc(), _testNativeBackgroundColorFromCss);
-}
+};
export var testNativeBackgroundColorFromLocal = function () {
helper.buildUIAndRunTest(_createButtonFunc(), _testNativeBackgroundColorFromLocal);
-}
+};
export var testMemoryLeak = function (done) {
helper.buildUIWithWeakRefAndInteract(_createButtonFunc, function (button) {
buttonTestsNative.performNativeClick(button);
}, done);
-}
+};
var _createButtonFunc = function (): buttonModule.Button {
// >>button-create
var button = new buttonModule.Button();
// << button-create
button.text = "Button";
+
return button;
-}
+};
var _testSetText = function (views: Array) {
var button = views[0];
@@ -96,7 +97,7 @@ var _testSetText = function (views: Array) {
var actualValue = buttonTestsNative.getNativeText(button);
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
-}
+};
var _testOnClick = function (views: Array) {
var button = views[0];
@@ -113,7 +114,7 @@ var _testOnClick = function (views: Array) {
buttonTestsNative.performNativeClick(button);
TKUnit.assertTrue(actualValue, "Actual: " + actualValue + "; Expected: " + true);
-}
+};
var _testBindTextDirectlyToModel = function (views: Array) {
var button = views[0];
@@ -124,7 +125,7 @@ var _testBindTextDirectlyToModel = function (views: Array) {
var options: bindable.BindingOptions = {
sourceProperty: "buttonTitle",
targetProperty: "text"
- }
+ };
button.bind(options, model);
// button.text is now "OK"
// >> (hide)
@@ -136,7 +137,7 @@ var _testBindTextDirectlyToModel = function (views: Array) {
TKUnit.assert(button.text === "Cancel", "Actual: " + button.text + "; Expected: " + "Cancel");
// << (hide)
// << button-bind
-}
+};
var _testBindTextToBindingContext = function (views: Array) {
var button = views[0];
@@ -149,13 +150,13 @@ var _testBindTextToBindingContext = function (views: Array) {
var options: bindable.BindingOptions = {
sourceProperty: "buttonTitle",
targetProperty: "text"
- }
+ };
button.bind(options);
TKUnit.assert(button.text === "OK", "Actual: " + button.text + "; Expected: " + "OK");
model.set("buttonTitle", "Cancel");
TKUnit.assert(button.text === "Cancel", "Actual: " + button.text + "; Expected: " + "Cancel");
-}
+};
var expectedFontSize = 42;
var _testLocalFontSizeFromCss = function (views: Array) {
@@ -165,7 +166,7 @@ var _testLocalFontSizeFromCss = function (views: Array) {
page.css = "button { font-size: " + expectedFontSize + "; }";
var actualResult = button.style.fontSize;
TKUnit.assert(actualResult === expectedFontSize, "Actual: " + actualResult + "; Expected: " + 33);
-}
+};
var _testNativeFontSizeFromCss = function (views: Array) {
var button = views[0];
@@ -174,7 +175,7 @@ var _testNativeFontSizeFromCss = function (views: Array) {
var actualResult = buttonTestsNative.getNativeFontSize(button);
helper.assertAreClose(actualResult, expectedFontSize, "FontSizeFromCss");
-}
+};
var _testNativeFontSizeFromLocal = function (views: Array) {
var button = views[0];
@@ -182,10 +183,10 @@ var _testNativeFontSizeFromLocal = function (views: Array) {
var actualResult = buttonTestsNative.getNativeFontSize(button);
helper.assertAreClose(actualResult, expectedFontSize, "FontSizeFromLocal");
-}
+};
var actualColorHex = "#ffff0000";
-var expectedNormalizedColorHex = "#FF0000"
+var expectedNormalizedColorHex = "#FF0000";
var _testLocalColorFromCss = function (views: Array) {
var button = views[0];
var page = views[1];
@@ -193,7 +194,7 @@ var _testLocalColorFromCss = function (views: Array) {
var actualResult = button.style.color.hex;
TKUnit.assert(actualResult === expectedNormalizedColorHex, "Actual: " + actualResult + "; Expected: " + expectedNormalizedColorHex);
-}
+};
var _testNativeColorFromCss = function (views: Array) {
var button = views[0];
@@ -202,7 +203,7 @@ var _testNativeColorFromCss = function (views: Array) {
var actualResult = buttonTestsNative.getNativeColor(button).hex;
TKUnit.assert(actualResult === expectedNormalizedColorHex, "Actual: " + actualResult + "; Expected: " + expectedNormalizedColorHex);
-}
+};
var _testNativeColorFromLocal = function (views: Array) {
var button = views[0];
@@ -210,7 +211,7 @@ var _testNativeColorFromLocal = function (views: Array) {
var actualResult = buttonTestsNative.getNativeColor(button).hex;
TKUnit.assert(actualResult === expectedNormalizedColorHex, "Actual: " + actualResult + "; Expected: " + expectedNormalizedColorHex);
-}
+};
var actualBackgroundColorHex = "#FF00FF00";
var expectedNormalizedBackgroundColorHex = "#00FF00";
@@ -221,7 +222,7 @@ var _testLocalBackgroundColorFromCss = function (views: Array)
var actualResult = button.style.backgroundColor.hex;
TKUnit.assert(actualResult === expectedNormalizedBackgroundColorHex, "Actual: " + actualResult + "; Expected: " + expectedNormalizedBackgroundColorHex);
-}
+};
var _testNativeBackgroundColorFromCss = function (views: Array) {
var button = views[0];
@@ -232,7 +233,7 @@ var _testNativeBackgroundColorFromCss = function (views: Array)
var actualResult = buttonTestsNative.getNativeBackgroundColor(button).hex;
TKUnit.assert(actualResult === expectedNormalizedBackgroundColorHex, "Actual: " + actualResult + "; Expected: " + expectedNormalizedBackgroundColorHex);
-}
+};
var _testNativeBackgroundColorFromLocal = function (views: Array) {
var button = views[0];
@@ -242,7 +243,7 @@ var _testNativeBackgroundColorFromLocal = function (views: Array) {
@@ -265,7 +266,7 @@ export var testNativeTextAlignmentFromCss = function () {
var actualResult = buttonTestsNative.getNativeTextAlignment(view);
TKUnit.assert(actualResult === expectedTextAlignment, "Actual: " + actualResult + "; Expected: " + expectedTextAlignment);
});
-}
+};
export var test_StateHighlighted_also_fires_pressedState = function () {
helper.buildUIAndRunTest(_createButtonFunc(), function (views: Array) {
@@ -282,7 +283,7 @@ export var test_StateHighlighted_also_fires_pressedState = function () {
var actualResult = buttonTestsNative.getNativeBackgroundColor(view);
TKUnit.assert(actualResult.hex === expectedNormalizedColor, "Actual: " + actualResult.hex + "; Expected: " + expectedNormalizedColor);
});
-}
+};
export var test_StateHighlighted_also_fires_activeState = function () {
helper.buildUIAndRunTest(_createButtonFunc(), function (views: Array) {
@@ -299,7 +300,7 @@ export var test_StateHighlighted_also_fires_activeState = function () {
var actualResult = buttonTestsNative.getNativeBackgroundColor(view);
TKUnit.assert(actualResult.hex === expectedNormalizedColor, "Actual: " + actualResult.hex + "; Expected: " + expectedNormalizedColor);
});
-}
+};
export var test_applying_disabled_visual_State_when_button_is_disable = function () {
helper.buildUIAndRunTest(_createButtonFunc(), function (views: Array) {
@@ -316,7 +317,7 @@ export var test_applying_disabled_visual_State_when_button_is_disable = function
var actualResult = buttonTestsNative.getNativeBackgroundColor(view);
TKUnit.assert(actualResult.hex === expectedNormalizedColor, "Actual: " + actualResult.hex + "; Expected: " + expectedNormalizedColor);
});
-}
+};
export var testNativeTextAlignmentFromLocal = function () {
helper.buildUIAndRunTest(_createButtonFunc(), function (views: Array) {
@@ -326,7 +327,7 @@ export var testNativeTextAlignmentFromLocal = function () {
var actualResult = buttonTestsNative.getNativeTextAlignment(view);
TKUnit.assert(actualResult === expectedTextAlignment, "Actual: " + actualResult + "; Expected: " + expectedTextAlignment);
});
-}
+};
export var test_WhenFormattedTextPropertyChanges_TextIsUpdated_Button = function () {
var firstSpan = new spanModule.Span();
@@ -360,7 +361,7 @@ export var test_WhenFormattedTextPropertyChanges_TextIsUpdated_Button = function
view.formattedText = null;
TKUnit.assertEqual(view.text, "");
});
-}
+};
export function test_IntegrationTest_Transform_Decoration_Spacing_WithoutFormattedText_DoesNotCrash() {
let view = new buttonModule.Button();
diff --git a/tests/app/ui/core/bindable/bindable-tests.ts b/tests/app/ui/core/bindable/bindable-tests.ts
index aca39c5d5..80d913e52 100644
--- a/tests/app/ui/core/bindable/bindable-tests.ts
+++ b/tests/app/ui/core/bindable/bindable-tests.ts
@@ -1,9 +1,9 @@
import { Observable, fromObject, fromObjectRecursive } from "tns-core-modules/data/observable";
import { ViewBase } from "tns-core-modules/ui/core/view-base";
import { BindingOptions } from "tns-core-modules/ui/core/bindable";
-import * as TKUnit from "../../../TKUnit";
+import * as TKUnit from "../../../tk-unit";
import * as types from "tns-core-modules/utils/types";
-import * as helper from "../../helper";
+import * as helper from "../../../ui-helper";
import * as utils from "tns-core-modules/utils/utils";
import * as bindingBuilder from "tns-core-modules/ui/builder/binding-builder";
import * as appModule from "tns-core-modules/application";
@@ -16,18 +16,18 @@ import { Label } from "tns-core-modules/ui/label";
import { TextField } from "tns-core-modules/ui/text-field";
//
-// For information and examples how to use bindings please refer to special [**Data binding**](../../../../bindings.md) topic.
+// For information and examples how to use bindings please refer to special [**Data binding**](../../../../bindings.md) topic.
//
//
-// For information and example how to use weak event listeners please refer to special [**Events**](../../../../events.md) topic which has a dedicated part about weak event listeners.
+// For information and example how to use weak event listeners please refer to special [**Events**](../../../../events.md) topic which has a dedicated part about weak event listeners.
//
export function test_Bindable_Members() {
const obj = new Label();
TKUnit.assert(types.isDefined(obj.bind), "Bindable.bind not defined");
TKUnit.assert(types.isDefined(obj.unbind), "Bindable.unbind not defined");
-};
+}
export function test_Binding_to_bindingContext_of_View() {
const target = new Button();
@@ -36,7 +36,7 @@ export function test_Binding_to_bindingContext_of_View() {
target.bind({ targetProperty: "bindingContext", sourceProperty: "text" }, source);
source.text = "a";
TKUnit.assertEqual(target.bindingContext, "a");
-};
+}
export function test_Bindable_Bind_ToTarget_OneWay() {
const model = new Observable();
@@ -55,7 +55,7 @@ export function test_Bindable_Bind_ToTarget_OneWay() {
model.set("name", "Changed");
TKUnit.assert(obj.get("text") === "Changed", "Expected result after binding is [test value] === 'Changed'");
-};
+}
export function test_Bindable_Bind_ToTarget_TwoWay() {
const model = new Observable();
@@ -76,7 +76,7 @@ export function test_Bindable_Bind_ToTarget_TwoWay() {
model.set("name", "John");
TKUnit.assertEqual(obj.get("text"), "John", "Two-way binding not updating the target when source is changed.");
-};
+}
export function test_Bindable_Bind_ToBindingContext_OneWay() {
const model = new Observable();
@@ -93,7 +93,7 @@ export function test_Bindable_Bind_ToBindingContext_OneWay() {
obj.bindingContext = model;
TKUnit.assert(obj.get("text") === "John", "Binding to a context does not update the target property.");
-};
+}
export function test_Bindable_Bind_ToBindingContext_TwoWay() {
const model = new Observable();
@@ -116,7 +116,7 @@ export function test_Bindable_Bind_ToBindingContext_TwoWay() {
obj.set("text", "local");
TKUnit.assertEqual(model.get("name"), "local", "Two-way binding to a context does not update the source property.");
-};
+}
export function test_Bindable_Unbind() {
const model = new Observable();
@@ -137,7 +137,7 @@ export function test_Bindable_Unbind() {
model.set("name", "Changed");
TKUnit.assert(obj.get("text") === "John", "Unbind does not remove binding.");
-};
+}
export function test_bind_NoSource_WillUse_BindingContext() {
const model = new Observable();
@@ -155,7 +155,7 @@ export function test_bind_NoSource_WillUse_BindingContext() {
};
helper.do_PageTest_WithButton(test);
-};
+}
export function test_bindingContext_ValueSource_IsInherited() {
const test = function (views: Array) {
@@ -165,7 +165,7 @@ export function test_bindingContext_ValueSource_IsInherited() {
};
helper.do_PageTest_WithButton(test);
-};
+}
export function test_bindingContext_Change_IsReflected_Properly() {
const model = new Observable();
@@ -189,7 +189,7 @@ export function test_bindingContext_Change_IsReflected_Properly() {
};
helper.do_PageTest_WithButton(test);
-};
+}
export function test_WhenBindingIsSetToAnElement_AndElementIsRemoved_ShouldBeCollectedByGC(done) {
let testFinished = false;
@@ -211,6 +211,7 @@ export function test_WhenBindingIsSetToAnElement_AndElementIsRemoved_ShouldBeCol
sourceProperty: sourcePropertyName,
targetProperty: targetPropertyName
}, bindContext);
+
return new WeakRef(button);
}
@@ -218,12 +219,19 @@ export function test_WhenBindingIsSetToAnElement_AndElementIsRemoved_ShouldBeCol
try {
stack.addChild(weakRef.get());
+ TKUnit.waitUntilReady(() => weakRef.get().isLoaded);
+
TKUnit.assertEqual(weakRef.get().text, expectedValue, "Binding is not working properly!");
stack.removeChild(weakRef.get());
TKUnit.waitUntilReady(() => !weakRef.get().isLoaded);
+
utils.GC();
- TKUnit.assert(!weakRef.get(), "UIElement is still alive!");
- testFinished = true;
+ // Give time for the GC to kick in
+ setTimeout(() => {
+ utils.GC();
+ TKUnit.assert(!weakRef.get(), "UIElement is still alive!");
+ testFinished = true;
+ }, 100);
}
catch (e) {
done(e);
@@ -278,7 +286,7 @@ export function test_MoreThanOneBindables_BindToASameSourceAndProperty() {
TKUnit.assertEqual(obj1.get("targetProperty"), "testValue", "Binding does not updates target property for first object.");
TKUnit.assertEqual(obj2.get("targetProperty"), "testValue", "Binding does not updates target property for second object.");
-};
+}
class TestClass extends ViewBase {
private _value: string;
@@ -291,7 +299,7 @@ class TestClass extends ViewBase {
}
this._value = v;
}
-};
+}
export function test_WhenBindingSetsInvalidValue_NoExceptionIsThrown() {
const model = new Observable();
@@ -335,7 +343,7 @@ export function test_binding_bindingContext_setRootContextFirst() {
};
helper.do_PageTest_WithStackLayout_AndButton(test);
-};
+}
export function test_binding_bindingContext_setBindingFirst() {
const test = function (views: Array) {
@@ -362,17 +370,17 @@ export function test_binding_bindingContext_setBindingFirst() {
};
helper.do_PageTest_WithStackLayout_AndButton(test);
-};
+}
export function test_Bindable_BindingContext_Number_DoesNotThrow() {
const obj = new Label();
obj.bindingContext = 42;
-};
+}
export function test_Bindable_BindingContext_Boolean_DoesNotThrow() {
const obj = new Label();
obj.bindingContext = true;
-};
+}
export function test_Bindable_BindingContext_String_DoesNotThrow() {
const options: BindingOptions = {
@@ -386,7 +394,7 @@ export function test_Bindable_BindingContext_String_DoesNotThrow() {
obj.bindingContext = "string";
TKUnit.assert(obj.get("text") === 6, "Expected: 6; Actual: " + obj.get("text"));
-};
+}
export function test_getBindableOptionsFromStringFullFormat() {
const bindingExpression = "bindProperty, bindProperty * 2, false";
@@ -396,7 +404,7 @@ export function test_getBindableOptionsFromStringFullFormat() {
TKUnit.assert(bindOptions.targetProperty === "targetBindProperty", "Expected: targetBindProperty, Actual: " + bindOptions.targetProperty);
TKUnit.assert(bindOptions.expression === "bindProperty * 2", "Expected: bindProperty * 2, Actual:" + bindOptions.expression);
TKUnit.assert(bindOptions.twoWay === false, "Expected: false, Actual: " + bindOptions.twoWay);
-};
+}
export function test_getBindableOptionsFromStringShortFormatExpression() {
const bindingExpression = "bindProperty * 2";
@@ -406,7 +414,7 @@ export function test_getBindableOptionsFromStringShortFormatExpression() {
TKUnit.assert(bindOptions.targetProperty === "targetBindProperty", "Expected: targetBindProperty, Actual: " + bindOptions.targetProperty);
TKUnit.assert(bindOptions.expression === "bindProperty * 2", "Expected: bindProperty * 2, Actual: " + bindOptions.expression);
TKUnit.assert(bindOptions.twoWay === true, "Expected: true, Actual: " + bindOptions.twoWay);
-};
+}
export function test_getBindableOptionsFromStringShortFormatProperty() {
const bindingExpression = "bindProperty";
@@ -416,7 +424,7 @@ export function test_getBindableOptionsFromStringShortFormatProperty() {
TKUnit.assert(bindOptions.targetProperty === "targetBindProperty", "Expected: targetBindProperty, Actual: " + bindOptions.targetProperty);
TKUnit.assert(bindOptions.expression === undefined, "Expected: null, Actual: " + bindOptions.expression);
TKUnit.assert(bindOptions.twoWay === true, "Expected: true, Actual: " + bindOptions.twoWay);
-};
+}
export function test_getBindableOptionsFromStringTwoParamsFormat() {
const bindingExpression = "bindProperty, bindProperty * 2";
@@ -426,7 +434,7 @@ export function test_getBindableOptionsFromStringTwoParamsFormat() {
TKUnit.assert(bindOptions.targetProperty === "targetBindProperty", "Expected: targetBindProperty, Actual: " + bindOptions.targetProperty);
TKUnit.assert(bindOptions.expression === "bindProperty * 2", "Expected: bindProperty * 2, Actual:" + bindOptions.expression);
TKUnit.assert(bindOptions.twoWay === true, "Expected: true, Actual: " + bindOptions.twoWay);
-};
+}
export function test_getBindableOptionsFromStringFullNamedFormat() {
const bindingExpression = "bindProperty, expression = bindProperty * 2, twoWay = false";
@@ -436,7 +444,7 @@ export function test_getBindableOptionsFromStringFullNamedFormat() {
TKUnit.assert(bindOptions.targetProperty === "targetBindProperty", "Expected: targetBindProperty, Actual: " + bindOptions.targetProperty);
TKUnit.assert(bindOptions.expression === "bindProperty * 2", "Expected: bindProperty * 2, Actual:" + bindOptions.expression);
TKUnit.assert(bindOptions.twoWay === false, "Expected: false, Actual: " + bindOptions.twoWay);
-};
+}
export function test_getBindableOptionsFromStringShortNamedFormatExpression() {
const bindingExpression = "sourceProperty = bindProperty, expression = bindProperty * 2";
@@ -446,7 +454,7 @@ export function test_getBindableOptionsFromStringShortNamedFormatExpression() {
TKUnit.assert(bindOptions.targetProperty === "targetBindProperty", "Expected: targetBindProperty, Actual: " + bindOptions.targetProperty);
TKUnit.assert(bindOptions.expression === "bindProperty * 2", "Expected: bindProperty * 2, Actual: " + bindOptions.expression);
TKUnit.assert(bindOptions.twoWay === true, "Expected: true, Actual: " + bindOptions.twoWay);
-};
+}
export function test_getBindableOptionsFromStringShortNamedFormatProperty() {
const bindingExpression = "sourceProperty = bindProperty";
@@ -455,7 +463,7 @@ export function test_getBindableOptionsFromStringShortNamedFormatProperty() {
TKUnit.assert(bindOptions.targetProperty === "targetBindProperty", "Expected: targetBindProperty, Actual: " + bindOptions.targetProperty);
TKUnit.assert(bindOptions.expression === undefined, "Expected: null, Actual: " + bindOptions.expression);
TKUnit.assert(bindOptions.twoWay === true, "Expected: true, Actual: " + bindOptions.twoWay);
-};
+}
export function test_getBindableOptionsFromStringTwoParamsNamedFormat() {
const bindingExpression = "bindProperty, expression = bindProperty * 2";
@@ -465,7 +473,7 @@ export function test_getBindableOptionsFromStringTwoParamsNamedFormat() {
TKUnit.assert(bindOptions.targetProperty === "targetBindProperty", "Expected: targetBindProperty, Actual: " + bindOptions.targetProperty);
TKUnit.assert(bindOptions.expression === "bindProperty * 2", "Expected: bindProperty * 2, Actual:" + bindOptions.expression);
TKUnit.assert(bindOptions.twoWay === true, "Expected: true, Actual: " + bindOptions.twoWay);
-};
+}
export function test_getBindingOptionsFromStringWithFunctionWitnMoreParams() {
const bindingExpression = "bindProperty, converter(bindProperty, param1)";
@@ -475,7 +483,7 @@ export function test_getBindingOptionsFromStringWithFunctionWitnMoreParams() {
TKUnit.assertEqual(bindOptions.targetProperty, "targetBindProperty");
TKUnit.assertEqual(bindOptions.expression, "converter(bindProperty, param1)");
TKUnit.assertEqual(bindOptions.twoWay, true);
-};
+}
export function test_getBindingOptionsFromStringWithFunctionArrayParams() {
const bindingExpression = "bindProperty, converter(bindProperty, [param1, param2])";
@@ -485,7 +493,7 @@ export function test_getBindingOptionsFromStringWithFunctionArrayParams() {
TKUnit.assertEqual(bindOptions.targetProperty, "targetBindProperty");
TKUnit.assertEqual(bindOptions.expression, "converter(bindProperty, [param1, param2])");
TKUnit.assertEqual(bindOptions.twoWay, true);
-};
+}
export function test_bindingToNestedPropertyWithValueSyntax() {
const bindingSource = new Observable();
@@ -499,7 +507,7 @@ export function test_bindingToNestedPropertyWithValueSyntax() {
TKUnit.assertEqual(testElement.get("targetPropertyName"), "testValue");
TKUnit.assertTrue(bindingSource["$value"] === undefined, "We should not add $value to bindingSource.");
-};
+}
export function test_TwoElementsBindingToSameBindingContext() {
const testFunc = function (page: Page) {
@@ -511,7 +519,7 @@ export function test_TwoElementsBindingToSameBindingContext() {
TKUnit.assertEqual(upperStackLabel.text, label2.text, "label2");
};
helper.navigateToModuleAndRunTest(("ui/core/bindable/bindingContext_testPage"), null, testFunc);
-};
+}
export function test_BindingContext_NavigatingForwardAndBack() {
const expectedValue = "Tralala";
@@ -526,11 +534,12 @@ export function test_BindingContext_NavigatingForwardAndBack() {
};
helper.navigateToModuleAndRunTest(("ui/core/bindable/bindingContext_testPage1"), null, testFunc);
-};
+}
export function test_BindingToSource_FailsAfterBindingContextChange() {
const createLabel = function () {
const label = new Label();
+
return label;
};
const labelViewModel = new Observable();
@@ -548,13 +557,14 @@ export function test_BindingToSource_FailsAfterBindingContextChange() {
};
helper.buildUIAndRunTest(createLabel(), testFunc);
-};
+}
export function test_BindingToParentView_ShouldNotLeaveGarbageInViewModel() {
const createStack = function () {
const stack = new StackLayout();
const label = new Label();
stack.addChild(label);
+
return stack;
};
const stackViewModel = new Observable();
@@ -574,13 +584,14 @@ export function test_BindingToParentView_ShouldNotLeaveGarbageInViewModel() {
};
helper.buildUIAndRunTest(createStack(), testFunc);
-};
+}
export function test_BindingToParentsView_ShouldNotLeaveGarbageInViewModel() {
const createStack = function () {
const stack = new StackLayout();
const label = new Label();
stack.addChild(label);
+
return stack;
};
const stackViewModel = new Observable();
@@ -600,11 +611,12 @@ export function test_BindingToParentsView_ShouldNotLeaveGarbageInViewModel() {
};
helper.buildUIAndRunTest(createStack(), testFunc);
-};
+}
export function test_BindingToDictionaryAtAppLevel() {
const createLabel = function () {
const label = new Label();
+
return label;
};
const pageViewModel = new Observable();
@@ -632,6 +644,7 @@ export function test_BindingToDictionaryAtAppLevel() {
export function test_BindingConverterCalledEvenWithNullValue() {
const createLabel = function () {
const label = new Label();
+
return label;
};
const pageViewModel = new Observable();
@@ -1015,6 +1028,7 @@ export function test_BindingHitsGetterTooManyTimes() {
public get dummyProperty(): string {
counter++;
+
return this._dummyProperty;
}
@@ -1034,7 +1048,7 @@ export function test_BindingHitsGetterTooManyTimes() {
bindableObj.bind({ sourceProperty: "dummyProperty", targetProperty: "dummyTarget" }, model);
TKUnit.assertEqual(counter, 1, "Property getter should be hit only once!");
-};
+}
export function test_SupportFunctionsInExpressions() {
const model = fromObject({
@@ -1228,6 +1242,7 @@ class RelatedPropsClass extends Observable {
public get prop2(): string {
this.prop1 = !this._prop1;
this.notifyPropertyChange("prop2", this._prop2);
+
return this._prop2;
}
diff --git a/tests/app/ui/core/bindable/binding-expressions-tests.ts b/tests/app/ui/core/bindable/binding-expressions-tests.ts
index aaaaf2a1f..6892825e2 100644
--- a/tests/app/ui/core/bindable/binding-expressions-tests.ts
+++ b/tests/app/ui/core/bindable/binding-expressions-tests.ts
@@ -1,19 +1,19 @@
-import * as frameModule from "tns-core-modules/ui/frame";
+import * as frameModule from "tns-core-modules/ui/frame";
import * as textFieldModule from "tns-core-modules/ui/text-field";
-import * as helper from "../../helper";
+import * as helper from "../../../ui-helper";
export var test_BindingExpressions_ArrayAccess = function () {
navigateToPage("bindingExpressions_arrayAccess_testPage");
assertElementString("textField1", "bindings");
assertElementString("textField2", "1");
-}
+};
export var test_BindingExpressions_LogicalOperators = function () {
navigateToPage("bindingExpressions_logicalOperators_testPage");
assertElementString("textField1", "true");
assertElementString("textField2", "false");
assertElementString("textField3", "true");
-}
+};
export var test_BindingExpressions_UnaryOperators = function () {
navigateToPage("bindingExpressions_unaryOperators_testPage");
@@ -25,7 +25,7 @@ export var test_BindingExpressions_UnaryOperators = function () {
assertElementString("textField6", "-1");
assertElementValueIsNaN("textField7");
assertElementValueIsNaN("textField8");
-}
+};
export var test_BindingExpressions_BinaryOperators = function () {
navigateToPage("bindingExpressions_binaryOperators_testPage");
@@ -36,7 +36,7 @@ export var test_BindingExpressions_BinaryOperators = function () {
assertElementString("textField5", "Infinity");
assertElementString("textField6", "0");
assertElementValueIsNaN("textField7");
-}
+};
export var test_BindingExpressions_ComparisonOperators = function () {
navigateToPage("bindingExpressions_comparisonOperators_testPage");
@@ -48,32 +48,32 @@ export var test_BindingExpressions_ComparisonOperators = function () {
assertElementString("textField6", "true");
assertElementString("textField7", "false");
assertElementString("textField8", "true");
-}
+};
export var test_BindingExpressions_LogicalComparisonOperators = function () {
navigateToPage("bindingExpressions_logicalComparisonOperators_testPage");
assertElementString("textField1", "false");
assertElementString("textField2", "true");
assertElementString("textField3", "Text");
-}
+};
export var test_BindingExpressions_TernaryOperator = function () {
navigateToPage("bindingExpressions_ternaryOperator_testPage");
assertElementString("textField1", "by Pratchett");
-}
+};
export var test_BindingExpressions_GroupingParenthesis = function () {
navigateToPage("bindingExpressions_groupingParenthesis_testPage");
assertElementString("textField1", "21");
assertElementString("textField2", "8");
-}
+};
export var assertElementString = function (elementId: string, value: any) {
var element: textFieldModule.TextField = (frameModule.topmost().currentPage.getViewById(elementId));
if (element.text.toString() !== value) {
throw new Error(" Actual: " + element.text.toString() + " Expected: " + value);
}
-}
+};
export var assertElementValueIsNaN = function (elementId: string) {
var element: textFieldModule.TextField = (frameModule.topmost().currentPage.getViewById(elementId));
@@ -81,8 +81,8 @@ export var assertElementValueIsNaN = function (elementId: string) {
if (isNaN(value) !== true) {
throw new Error(" Actual: " + value + " is not NaN");
}
-}
+};
export var navigateToPage = function (pageName: string) {
- helper.navigateToModule("/ui/test-pages/" + pageName);
-}
+ helper.navigateToModule("ui/test-pages/" + pageName);
+};
diff --git a/tests/app/ui/core/weak-event-listener/weak-event-listener-tests.ts b/tests/app/ui/core/weak-event-listener/weak-event-listener-tests.ts
index f59f147df..885e6f202 100644
--- a/tests/app/ui/core/weak-event-listener/weak-event-listener-tests.ts
+++ b/tests/app/ui/core/weak-event-listener/weak-event-listener-tests.ts
@@ -1,7 +1,7 @@
-import * as TKUnit from "../../../TKUnit";
+import * as TKUnit from "../../../tk-unit";
import { Observable, EventData } from "tns-core-modules/data/observable";
import { addWeakEventListener, removeWeakEventListener } from "tns-core-modules/ui/core/weak-event-listener";
-import { forceGC } from "../../helper";
+import { forceGC } from "../../../ui-helper";
class Target {
public counter: number = 0;
@@ -68,7 +68,7 @@ export function test_removeWeakEventListener_StopsListeningForEvent() {
const target = new Target();
addWeakEventListener(source, Observable.propertyChangeEvent, target.onEvent, target);
- removeWeakEventListener(source, Observable.propertyChangeEvent, target.onEvent, target)
+ removeWeakEventListener(source, Observable.propertyChangeEvent, target.onEvent, target);
source.set("testProp", "some value");
TKUnit.assertEqual(target.counter, 0, "Handler should not be called.");
@@ -81,7 +81,7 @@ export function test_handlerIsCalled_WithTargetAsThis() {
const handler = function (args: EventData) {
TKUnit.assertEqual(this, target, "this should be the target");
callbackCalled = true;
- }
+ };
addWeakEventListener(source, Observable.propertyChangeEvent, handler, target);
@@ -146,8 +146,8 @@ export function test_handlerIsDetached_WhenAllListenersAreRemoved() {
addWeakEventListener(source, Observable.propertyChangeEvent, target1.onEvent, target1);
addWeakEventListener(source, Observable.propertyChangeEvent, target2.onEvent, target2);
- removeWeakEventListener(source, Observable.propertyChangeEvent, target1.onEvent, target1)
- removeWeakEventListener(source, Observable.propertyChangeEvent, target2.onEvent, target2)
+ removeWeakEventListener(source, Observable.propertyChangeEvent, target1.onEvent, target1);
+ removeWeakEventListener(source, Observable.propertyChangeEvent, target2.onEvent, target2);
TKUnit.assert(!source.hasListeners(Observable.propertyChangeEvent), "All events should be detached");
}
diff --git a/tests/app/ui/date-picker/date-picker-tests.ts b/tests/app/ui/date-picker/date-picker-tests.ts
index eaa9e40b7..54cf29f05 100644
--- a/tests/app/ui/date-picker/date-picker-tests.ts
+++ b/tests/app/ui/date-picker/date-picker-tests.ts
@@ -1,4 +1,4 @@
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import * as testModule from "../../ui-test";
import * as datePickerTestsNative from "./date-picker-tests-native";
import * as color from "tns-core-modules/color";
@@ -8,7 +8,7 @@ import * as platform from "tns-core-modules/platform";
import * as datePickerModule from "tns-core-modules/ui/date-picker";
// << date-picker-require
-import * as helper from "../helper";
+import * as helper from "../../ui-helper";
export function test_recycling() {
helper.nativeView_recycling_test(() => new datePickerModule.DatePicker());
@@ -46,6 +46,7 @@ export class DatePickerTest extends testModule.UITest
-// # DependencyObservable
-// DependencyObservable is a fundamental building block in the NativeScript visual tree (DOM).
-// It provides enhanced property system allowing for various value modifiers on a per property basis.
-// This enables cascading values - e.g. default vs. inherited vs. local.
-// Load the module using the following code:
-// ``` JavaScript
-import * as dependencyObservableModule from "tns-core-modules/ui/core/dependency-observable";
-// ```
-//
-
-import * as TKUnit from "../TKUnit";
-import * as types from "tns-core-modules/utils/types";
-import * as observableModule from "tns-core-modules/data/observable";
-
-var currentChangeData: dependencyObservableModule.PropertyChangeData;
-var propertyNameCount = 0;
-
-function generatePropertyName() {
- var name = "test" + propertyNameCount++;
- return name;
-}
-
-function onTestPropertyChanged(data: dependencyObservableModule.PropertyChangeData) {
- currentChangeData = data;
-}
-
-function validateDOChangeData(obj: TestDO, property: dependencyObservableModule.Property, oldValue: any, newValue: any) {
- TKUnit.assert(types.isDefined(currentChangeData), "metadata.onValueChanged function not called.");
- TKUnit.assert(currentChangeData.object === obj, "metadata.onValueChanged function called with wrong object member.");
- TKUnit.assert(currentChangeData.property === property, "metadata.onValueChanged method called with wrong property member");
- TKUnit.assert(currentChangeData.newValue === newValue, "metadata.onValueChanged method called with wrong newValue member");
- TKUnit.assert(currentChangeData.oldValue === oldValue, "metadata.onValueChanged method called with wrong oldValue member");
- TKUnit.assert(currentChangeData.eventName === observableModule.Observable.propertyChangeEvent, "metadata.onValueChanged method called with wrong eventName member");
-}
-
-function validateChangeData(data: observableModule.PropertyChangeData, obj: observableModule.Observable, propertyName: string, newValue: any) {
- TKUnit.assert(types.isDefined(data), "DependencyObservable.on for propertyChange not called.");
- TKUnit.assert(data.object === obj, "DependencyObservable.on called with wrong object member.");
- TKUnit.assert(data.propertyName === propertyName, "DependencyObservable.on called with wrong propertyName member");
- TKUnit.assert(data.value === newValue, "DependencyObservable.on called with wrong value member");
- TKUnit.assert(data.eventName === observableModule.Observable.propertyChangeEvent, "DependencyObservable.on method called with wrong eventName member");
-}
-
-//
-// ### Creating a Property
-// The property backing mechanism in each DependencyObservable instance is implemented via the Property class.
-// Basically you create a new Property for a class (type):
-// ``` JavaScript
-var testProperty = new dependencyObservableModule.Property(
- "test",
- "TestDO",
- new dependencyObservableModule.PropertyMetadata(
- false,
- dependencyObservableModule.PropertyMetadataSettings.None /*0*/,
- onTestPropertyChanged
- )
- );
-// ```
-//
-
-var testProperty1 = new dependencyObservableModule.Property(
- "test1",
- "TestDO",
- new dependencyObservableModule.PropertyMetadata(
- 0,
- dependencyObservableModule.PropertyMetadataSettings.None /*0*/,
- onTestPropertyChanged
- )
- );
-
-function validateProperty(value: any): boolean {
- return types.isNumber(value) && value >= 0;
-}
-var testPropertyWithValidation = new dependencyObservableModule.Property(
- "testWithValidation",
- "TestDO",
- new dependencyObservableModule.PropertyMetadata(
- 0,
- dependencyObservableModule.PropertyMetadataSettings.None /*0*/,
- onTestPropertyChanged,
- validateProperty
- )
- );
-
-class TestDO extends dependencyObservableModule.DependencyObservable {
- get test(): boolean {
- return this._getValue(testProperty);
- }
- set test(value: boolean) {
- this._setValue(testProperty, value);
- }
-
- get test1(): number {
- return this._getValue(testProperty1);
- }
- set test1(value: number) {
- this._setValue(testProperty1, value);
- }
-
- get testWithValidation(): number {
- return this._getValue(testPropertyWithValidation);
- }
- set testWithValidation(value: number) {
- this._setValue(testPropertyWithValidation, value);
- }
-
- public _onPropertyChanged(property: dependencyObservableModule.Property, oldValue: any, newValue: any) {
- super._onPropertyChanged(property, oldValue, newValue);
- }
-}
-
-export function test_DO_Members_AreDefined() {
- var obj = new dependencyObservableModule.DependencyObservable();
- TKUnit.assert(types.isDefined(obj._setValue), "DependencyObservable._setValue is undefined.");
- TKUnit.assert(types.isDefined(obj._getValue), "DependencyObservable._getValue is undefined.");
- TKUnit.assert(types.isDefined(obj._getValueSource), "DependencyObservable._getValueSource is undefined.");
- TKUnit.assert(types.isDefined(obj._resetValue), "DependencyObservable._resetValue is undefined.");
- TKUnit.assert(types.isDefined(obj._onPropertyChanged), "DependencyObservable._resetValue is undefined.");
- TKUnit.assert(types.isDefined(obj._eachSetProperty), "DependencyObservable._resetValue is undefined.");
-}
-
-export function test_NewProperty_WillThrow_If_Name_IsInvalid() {
- var thrown = false;
- try {
- /* tslint:disable:no-unused-variable */
- var p = new dependencyObservableModule.Property("", "", undefined);
- /* tslint:enable:no-unused-variable */
- }
- catch (e) {
- thrown = true;
- TKUnit.assert(e.message === "Name should not be null or empty string.", "Invalid error message");
- }
-
- TKUnit.assert(thrown, "Should not create a Property with invalid name.");
-}
-
-export function test_NewProperty_WillThrow_If_OwnerType_IsInvalid() {
- var thrown = false;
- try {
- /* tslint:disable:no-unused-variable */
- var p = new dependencyObservableModule.Property(generatePropertyName(), "", undefined);
- /* tslint:enable:no-unused-variable */
- }
- catch (e) {
- thrown = true;
- TKUnit.assert(e.message === "OwnerType should not be null or empty string.", "Invalid error message");
- }
-
- TKUnit.assert(thrown, "Should not create a Property with invalid owner type.");
-}
-
-export function test_NewProperty_WillThrow_If_Metadata_IsInvalid() {
- var thrown = false;
- var p;
-
- try {
- // check for undefined
- p = new dependencyObservableModule.Property(generatePropertyName(), "testOwner", undefined);
- }
- catch (e) {
- thrown = true;
- TKUnit.assert(e.message === "Expected valid PropertyMetadata instance.", "Invalid error message");
- }
-
- TKUnit.assert(thrown, "Should not create a Property with undefined metadata.");
-
- thrown = false;
- try {
- // check for invalid type
- var metadata: any = {};
- p = new dependencyObservableModule.Property(generatePropertyName(), "testOwner", metadata);
- }
- catch (e) {
- thrown = true;
- TKUnit.assert(e.message === "Expected valid PropertyMetadata instance.", "Invalid error message");
- }
-
- TKUnit.assert(thrown, "Should not create a Property with invalid metadata type.");
-}
-
-export function test_NewProperty_WillThrow_If_Key_AlreadyRegistered() {
- var thrown = false;
- try {
- /* tslint:disable:no-unused-variable */
- var p = new dependencyObservableModule.Property("test", "testOwner", new dependencyObservableModule.PropertyMetadata(0));
- var p1 = new dependencyObservableModule.Property("test", "testOwner", new dependencyObservableModule.PropertyMetadata(0));
- /* tslint:enable:no-unused-variable */
- }
- catch (e) {
- thrown = true;
- TKUnit.assert(e.message === "Property test already registered for type testOwner.", "Invalid error message");
- }
-
- TKUnit.assert(thrown, "Should not create a Property with invalid name.");
-}
-
-export function test_Property_Id_IsUnique() {
- var p = new dependencyObservableModule.Property(generatePropertyName(), "testOwner", new dependencyObservableModule.PropertyMetadata(0));
- var p1 = new dependencyObservableModule.Property(generatePropertyName(), "testOwner", new dependencyObservableModule.PropertyMetadata(0));
-
- TKUnit.assert(p.id !== p1.id, "Property.id should be unique.");
-}
-
-export function test_PropertyMetadataSettings_HasValid_Memberes() {
- TKUnit.assert(dependencyObservableModule.PropertyMetadataSettings.None === 0, "PropertyMetadataSettings.None not defined correctly.");
- TKUnit.assert(dependencyObservableModule.PropertyMetadataSettings.AffectsLayout === 1, "PropertyMetadataSettings.AffectsLayout not defined correctly.");
- TKUnit.assert(dependencyObservableModule.PropertyMetadataSettings.AffectsStyle === 2, "PropertyMetadataSettings.AffectsStyle not defined correctly.");
- TKUnit.assert(dependencyObservableModule.PropertyMetadataSettings.Inheritable === 4, "PropertyMetadataSettings.Inheritable not defined correctly.");
-}
-
-export function test_ValueSource_HasValid_Memberes() {
- TKUnit.assert(dependencyObservableModule.ValueSource.Default === 0, "ValueSource.None not defined correctly.");
- TKUnit.assert(dependencyObservableModule.ValueSource.Inherited === 1, "ValueSource.Inherited not defined correctly.");
- TKUnit.assert(dependencyObservableModule.ValueSource.Css === 2, "ValueSource.Css not defined correctly.");
- TKUnit.assert(dependencyObservableModule.ValueSource.Local === 3, "ValueSource.Local not defined correctly.");
- TKUnit.assert(dependencyObservableModule.ValueSource.VisualState === 4, "ValueSource.VisualState not defined correctly.");
-}
-
-export function test_PropertyMetadata_Options() {
- var options =
- dependencyObservableModule.PropertyMetadataSettings.AffectsLayout |
- dependencyObservableModule.PropertyMetadataSettings.AffectsStyle |
- dependencyObservableModule.PropertyMetadataSettings.Inheritable;
-
- var p = new dependencyObservableModule.Property(generatePropertyName(), "testOwner", new dependencyObservableModule.PropertyMetadata(0, options));
-
- TKUnit.assert(p.affectsLayout === true, "Property.affectsLayout not working as expected.");
- TKUnit.assert(p.affectsStyle === true, "Property.affectsStyle not working as expected.");
- TKUnit.assert(p.inheritable === true, "Property.inheritable not working as expected.");
- TKUnit.assert(p.metadata.options === options, "PropertyMetadata.options not properly set.");
-}
-
-export function test_PropertyEntry_effectiveValue() {
- var entry = new dependencyObservableModule.PropertyEntry();
-
- // default value
- TKUnit.assertEqual(entry.effectiveValue, undefined, "effectiveValue should be undefined.");
- TKUnit.assertEqual(entry.valueSource, dependencyObservableModule.ValueSource.Default, "ValueSource.Default not working as expected.");
-
- // local value
- entry.localValue = 10;
- entry.resetValue();
-
- // default value
- TKUnit.assertEqual(entry.effectiveValue, undefined, "ValueSource.Default not working as expected.");
- TKUnit.assertEqual(entry.valueSource, dependencyObservableModule.ValueSource.Default, "ValueSource.Default not working as expected.");
-}
-
-export function test_DependencyObservable_get_set_AreOverriden() {
- var dO = new TestDO();
-
- dO.test = true;
- TKUnit.assert(dO.get("test") === true, "DependencyObservable should override Observable.get");
-
- dO.set("test", false);
- TKUnit.assert(dO.test === false, "DependencyObservable should override Observable.set");
-}
-
-export function test_DependencyObservable_getValue_setValue() {
- var dO = new TestDO();
-
- // implicitly use ValueSource.Local when not specified
- dO._setValue(testProperty1, 5);
- TKUnit.assertEqual(dO.test1, 5, "expected true after _setValue.");
- TKUnit.assertEqual(dO._getValueSource(testProperty1), dependencyObservableModule.ValueSource.Local, "_setValue without third parameter should use ValueSource.Local");
-
- dO._setValue(testProperty1, 10, dependencyObservableModule.ValueSource.Inherited);
- TKUnit.assertEqual(dO.test1, 5, "ValueSource.Local should have higher priority than Inherited.");
-
- // revert to default value
- dO._resetValue(testProperty1);
- TKUnit.assertEqual(dO.test1, 10, "_resetValue should revert to inheritedValue");
-
- // test the ValueSource parameter
- dO._setValue(testProperty1, 10, dependencyObservableModule.ValueSource.Inherited);
- TKUnit.assertEqual(dO.test1, 10, "_setValue with three parameters not working as expected.");
- TKUnit.assertEqual(dO._getValueSource(testProperty1), dependencyObservableModule.ValueSource.Inherited, "expected ValueSource.Inherited");
-
- dO._setValue(testProperty1, 20, dependencyObservableModule.ValueSource.Local);
- TKUnit.assertEqual(dO.test1, 20, "_setValue with three parameters not working as expected.");
- TKUnit.assertEqual(dO._getValueSource(testProperty1), dependencyObservableModule.ValueSource.Local, "expected ValueSource.Local");
-
- // reset the Local value and verify the effectiveValue will be reverted to the Inherited one.
- dO._resetValue(testProperty1, dependencyObservableModule.ValueSource.Local);
- TKUnit.assertEqual(dO.test1, 10, "_resetValue for ValueSource not working as expected.");
- TKUnit.assertEqual(dO._getValueSource(testProperty1), dependencyObservableModule.ValueSource.Inherited, "expected ValueSource.Inherited");
-}
-
-export function test_PropertyMetadata_onValueChanged_Callback_IsInvoked() {
- currentChangeData = undefined;
-
- var dO = new TestDO();
- dO.test = true;
-
- validateDOChangeData(dO, testProperty, false, true);
-
- currentChangeData = undefined;
- var dO1 = new TestDO();
- dO1.test1 = 10;
-
- validateDOChangeData(dO1, testProperty1, 0, 10);
-
- // reset value
- currentChangeData = undefined;
- dO1._resetValue(testProperty1);
- validateDOChangeData(dO1, testProperty1, 10, 0);
-
- currentChangeData = undefined;
- dO1._setValue(testProperty1, 10, dependencyObservableModule.ValueSource.Inherited);
- validateDOChangeData(dO1, testProperty1, 0, 10);
-
- currentChangeData = undefined;
- dO1._setValue(testProperty1, 20, dependencyObservableModule.ValueSource.Local);
- validateDOChangeData(dO1, testProperty1, 10, 20);
-
- currentChangeData = undefined;
- dO1._resetValue(testProperty1, dependencyObservableModule.ValueSource.Local);
- validateDOChangeData(dO1, testProperty1, 20, 10);
-}
-
-export function test_Observable_on_propertyChange_IsRaised() {
- var dO1 = new TestDO();
-
- var changeData: observableModule.PropertyChangeData;
- dO1.on(observableModule.Observable.propertyChangeEvent, function (data: observableModule.PropertyChangeData) {
- changeData = data;
- });
-
- dO1.test1 = 10;
- validateChangeData(changeData, dO1, "test1", 10);
-
- // reset value
- changeData = undefined;
- dO1._resetValue(testProperty1);
- validateChangeData(changeData, dO1, "test1", 0);
-
- changeData = undefined;
- dO1._setValue(testProperty1, 10, dependencyObservableModule.ValueSource.Inherited);
- validateChangeData(changeData, dO1, "test1", 10);
-
- changeData = undefined;
- dO1._setValue(testProperty1, 20, dependencyObservableModule.ValueSource.Local);
- validateChangeData(changeData, dO1, "test1", 20);
-
- changeData = undefined;
- dO1._resetValue(testProperty1, dependencyObservableModule.ValueSource.Local);
- validateChangeData(changeData, dO1, "test1", 10);
-}
-
-export function test_setValue_WillThrow_If_ValueIsInvalid() {
- var dO = new TestDO();
-
- TKUnit.assertThrows(
- () => {
- dO.testWithValidation = -1;
- },
- "Set invalid value should throw",
- "Invalid value -1 for property testWithValidation");
-
-}
-
-export function test_setValue_WillNotThrow_If_ValueIsValid() {
- var dO = new TestDO();
- // This should not throw.
- dO.testWithValidation = 1;
-}
diff --git a/tests/app/ui/dialogs/dialog-tests.ts b/tests/app/ui/dialogs/dialog-tests.ts
index ae650acc0..ce750b0b2 100644
--- a/tests/app/ui/dialogs/dialog-tests.ts
+++ b/tests/app/ui/dialogs/dialog-tests.ts
@@ -1,4 +1,4 @@
-// >> dialog-require
+// >> dialog-require
import * as dialogs from "tns-core-modules/ui/dialogs";
// << dialog-require
@@ -10,7 +10,7 @@ export function test_DummyTestForSnippetOnly0() {
cancelButtonText: "Cancel",
actions: ["Human", "Elf", "Dwarf", "Orc"]
};
- dialogs.action(options).then((result) => {
+ dialogs.action(options).then((result) => {
console.log(result);
});
// << dialog-action
@@ -67,7 +67,7 @@ export function test_DummyTestForSnippetOnly4() {
defaultText: "Enter your name",
inputType: dialogs.inputType.text
};
- dialogs.prompt(options).then((result: dialogs.PromptResult) => {
+ dialogs.prompt(options).then((result: dialogs.PromptResult) => {
console.log("Hello, " + result.text);
});
// << dialog-prompt
diff --git a/tests/app/ui/frame/frame-tests-common.ts b/tests/app/ui/frame/frame-tests-common.ts
index 81953412a..777cc034b 100644
--- a/tests/app/ui/frame/frame-tests-common.ts
+++ b/tests/app/ui/frame/frame-tests-common.ts
@@ -1,12 +1,10 @@
-// >> frame-require
+// >> frame-require
import { Frame, getFrameById, topmost, NavigationEntry } from "tns-core-modules/ui/frame";
// << frame-require
-import { getRootView } from "tns-core-modules/application";
import { Label } from "tns-core-modules/ui/label";
import { Page } from "tns-core-modules/ui/page";
-import * as helper from "../helper";
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
const NAV_WAIT = 15;
function emptyNavigationQueue(frame: Frame) {
@@ -27,6 +25,7 @@ export function ignore_test_DummyTestForSnippetOnly1() {
label.text = "Hello, world!";
const page = new Page();
page.content = label;
+
return page;
};
const frame = topmost();
@@ -163,6 +162,7 @@ export function test_page_parent_when_backstackVisible_is_false() {
const create = () => {
const page = new Page();
pages.push(page);
+
return page;
};
@@ -188,6 +188,7 @@ export function test_page_parent_when_navigate_with_clear_history() {
const create = () => {
const page = new Page();
pages.push(page);
+
return page;
};
@@ -214,6 +215,7 @@ export function test_page_parent_when_navigate_back() {
const create = () => {
const page = new Page();
pages.push(page);
+
return page;
};
@@ -233,8 +235,6 @@ export function test_page_parent_when_navigate_back() {
}
export function test_frame_retrieval_API_when_navigating() {
- const rootView = getRootView();
-
const initialFrame = new Frame();
initialFrame.id = "initialFrame";
initialFrame.navigate(() => new Page());
@@ -266,4 +266,4 @@ export function test_frame_retrieval_API_when_navigating() {
// clean up the frame stack
initialFrame._removeFromFrameStack();
newFrame._removeFromFrameStack();
-}
\ No newline at end of file
+}
diff --git a/tests/app/ui/frame/frame-tests.android.ts b/tests/app/ui/frame/frame-tests.android.ts
index 5e0ac94a2..e04d6ad18 100644
--- a/tests/app/ui/frame/frame-tests.android.ts
+++ b/tests/app/ui/frame/frame-tests.android.ts
@@ -1,5 +1,5 @@
import * as frameModule from "tns-core-modules/ui/frame";
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import { unsetValue, PercentLength } from "tns-core-modules/ui/core/view";
export * from "./frame-tests-common";
@@ -45,7 +45,7 @@ export function test_percent_margin_set_to_page_support() {
let topFrameHeight = topFrame.getMeasuredHeight();
let currentPageWidth = currentPage.getMeasuredWidth();
- let currentPageHeight = currentPage.getMeasuredHeight()
+ let currentPageHeight = currentPage.getMeasuredHeight();
let marginLeft = topFrameWidth * 0.1;
let marginTop = topFrameHeight * 0.1;
diff --git a/tests/app/ui/gestures/gestures-tests.ts b/tests/app/ui/gestures/gestures-tests.ts
index 8fa897518..5ed7d5cc5 100644
--- a/tests/app/ui/gestures/gestures-tests.ts
+++ b/tests/app/ui/gestures/gestures-tests.ts
@@ -1,4 +1,4 @@
-/* tslint:disable:no-unused-variable */
+/* tslint:disable:no-unused-variable */
// >> gestures-require
import * as gestures from "tns-core-modules/ui/gestures";
// << gestures-require
@@ -7,11 +7,11 @@ import * as labelModule from "tns-core-modules/ui/label";
export var test_DummyTestForSnippetOnly0 = function () {
// >> gestures-double-tap
var label = new labelModule.Label();
- var observer = label.on(gestures.GestureTypes.doubleTap, function (args: gestures.GestureEventData) {
+ var observer = label.on(gestures.GestureTypes.doubleTap, function (args: gestures.GestureEventData) {
console.log("Double Tap");
});
// << gestures-double-tap
-}
+};
export var test_DummyTestForSnippetOnly01 = function () {
// >> gestures-double-tap-alt
@@ -20,7 +20,7 @@ export var test_DummyTestForSnippetOnly01 = function () {
console.log("Double Tap");
});
// << gestures-double-tap-alt
-}
+};
export var test_DummyTestForSnippetOnly1 = function () {
// >> gestures-long-press
@@ -29,7 +29,7 @@ export var test_DummyTestForSnippetOnly1 = function () {
console.log("Long Press");
});
// << gestures-long-press
-}
+};
export var test_DummyTestForSnippetOnly11 = function () {
// >> gestures-long-press-alt
@@ -38,7 +38,7 @@ export var test_DummyTestForSnippetOnly11 = function () {
console.log("Long Press");
});
// << gestures-long-press-alt
-}
+};
export var test_DummyTestForSnippetOnly2 = function () {
// >> gestures-pan
@@ -47,7 +47,7 @@ export var test_DummyTestForSnippetOnly2 = function () {
console.log("Pan deltaX:" + args.deltaX + "; deltaY:" + args.deltaY + ";");
});
// << gestures-pan
-}
+};
export var test_DummyTestForSnippetOnly22 = function () {
// >> gestures-pan-alt
@@ -56,7 +56,7 @@ export var test_DummyTestForSnippetOnly22 = function () {
console.log("Pan deltaX:" + args.deltaX + "; deltaY:" + args.deltaY + ";");
});
// << gestures-pan-alt
-}
+};
export var test_DummyTestForSnippetOnly3 = function () {
// >> gestures-pan-pinch
@@ -65,7 +65,7 @@ export var test_DummyTestForSnippetOnly3 = function () {
console.log("Pinch scale: " + args.scale);
});
// << gestures-pan-pinch
-}
+};
export var test_DummyTestForSnippetOnly33 = function () {
// >> gestures-pan-pinch-alt
@@ -74,7 +74,7 @@ export var test_DummyTestForSnippetOnly33 = function () {
console.log("Pinch scale: " + args.scale);
});
// << gestures-pan-pinch-alt
-}
+};
export var test_DummyTestForSnippetOnly4 = function () {
// >> gestures-rotation
@@ -83,7 +83,7 @@ export var test_DummyTestForSnippetOnly4 = function () {
console.log("Rotation: " + args.rotation);
});
// << gestures-rotation
-}
+};
export var test_DummyTestForSnippetOnly44 = function () {
// >> gestures-rotation-alt
@@ -92,7 +92,7 @@ export var test_DummyTestForSnippetOnly44 = function () {
console.log("Rotation: " + args.rotation);
});
// << gestures-rotation-alt
-}
+};
export var test_DummyTestForSnippetOnly5 = function () {
// >> gestures-swipe
@@ -101,7 +101,7 @@ export var test_DummyTestForSnippetOnly5 = function () {
console.log("Swipe direction: " + args.direction);
});
// << gestures-swipe
-}
+};
export var test_DummyTestForSnippetOnly55 = function () {
// >> gestures-swipe-alt
@@ -110,7 +110,7 @@ export var test_DummyTestForSnippetOnly55 = function () {
console.log("Swipe direction: " + args.direction);
});
// << gestures-swipe-alt
-}
+};
export var test_DummyTestForSnippetOnly6 = function () {
// >> gestures-tap
@@ -119,7 +119,7 @@ export var test_DummyTestForSnippetOnly6 = function () {
console.log("Tap");
});
// << gestures-tap
-}
+};
export var test_DummyTestForSnippetOnly66 = function () {
// >> gestures-tap-alt
@@ -128,7 +128,7 @@ export var test_DummyTestForSnippetOnly66 = function () {
console.log("Tap");
});
// << gestures-tap-alt
-}
+};
export var test_DummyTestForSnippetOnly7 = function () {
// >> gestures-stop-observe
@@ -138,7 +138,7 @@ export var test_DummyTestForSnippetOnly7 = function () {
});
observer.disconnect();
// << gestures-stop-observe
-}
+};
export var test_DummyTestForSnippetOnly8 = function () {
// >> gestures-multiple
@@ -147,7 +147,7 @@ export var test_DummyTestForSnippetOnly8 = function () {
console.log("Event: " + args.eventName);
});
// << gestures-multiple
-}
+};
export var test_DummyTestForSnippetOnly88 = function () {
// >> gestures-string
@@ -156,7 +156,7 @@ export var test_DummyTestForSnippetOnly88 = function () {
console.log("Event: " + args.eventName);
});
// << gestures-string
-}
+};
export var test_DummyTestForSnippetOnly9 = function () {
// >> gestures-events-string
@@ -165,4 +165,4 @@ export var test_DummyTestForSnippetOnly9 = function () {
console.log("Event: " + args.eventName);
});
// << gestures-events-string
-}
+};
diff --git a/tests/app/ui/html-view/html-view-tests.ts b/tests/app/ui/html-view/html-view-tests.ts
index 924df1a82..9078aa2a8 100644
--- a/tests/app/ui/html-view/html-view-tests.ts
+++ b/tests/app/ui/html-view/html-view-tests.ts
@@ -1,5 +1,5 @@
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import * as types from "tns-core-modules/utils/types";
// >> htmlview-require
@@ -13,9 +13,10 @@ export function test_recycling() {
var _createHtmlViewFunc = function (): htmlViewModule.HtmlView {
// >> htmlview-create
var htmlView = new htmlViewModule.HtmlView();
+
// << htmlview-create
return htmlView;
-}
+};
export var testLoadHTMLString = function () {
let page = helper.getCurrentPage();
@@ -31,4 +32,4 @@ export var testLoadHTMLString = function () {
} else if (htmlView.android) {
TKUnit.assert(htmlView.android.getText(), "HTML string not loaded properly. Actual: " + htmlView.android.getText());
}
-}
+};
diff --git a/tests/app/ui/image-cache/image-cache-tests.ts b/tests/app/ui/image-cache/image-cache-tests.ts
index 946cf426b..c5c66b69d 100644
--- a/tests/app/ui/image-cache/image-cache-tests.ts
+++ b/tests/app/ui/image-cache/image-cache-tests.ts
@@ -1,10 +1,10 @@
-import * as imageCacheModule from "tns-core-modules/ui/image-cache";
+import * as imageCacheModule from "tns-core-modules/ui/image-cache";
import * as imageSource from "tns-core-modules/image-source";
import * as types from "tns-core-modules/utils/types";
import { device } from "tns-core-modules/platform";
import lazy from "tns-core-modules/utils/lazy";
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
const sdkVersion = lazy(() => parseInt(device.sdkVersion));
@@ -44,7 +44,7 @@ export const test_ImageCache_ValidUrl = function() {
TKUnit.waitUntilReady(() => types.isDefined(validKey), 8);
TKUnit.assertEqual(validKey, url, "Key should equal the provided url");
-}
+};
export const test_ImageCache_NothingAtProvidedUrl = function() {
const cache = new imageCacheModule.Cache();
@@ -81,4 +81,4 @@ export const test_ImageCache_NothingAtProvidedUrl = function() {
TKUnit.waitUntilReady(() => errorCaught);
TKUnit.assertEqual(`No image for key: ${url}`, errorMessage);
-}
+};
diff --git a/tests/app/ui/image/image-tests.ts b/tests/app/ui/image/image-tests.ts
index 693ae5670..f906debaf 100644
--- a/tests/app/ui/image/image-tests.ts
+++ b/tests/app/ui/image/image-tests.ts
@@ -1,11 +1,11 @@
-import { Image } from "tns-core-modules/ui/image";
+import { Image } from "tns-core-modules/ui/image";
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout";
import { isIOS, isAndroid } from "tns-core-modules/platform";
import { PropertyChangeData } from "tns-core-modules/data/observable";
import * as utils from "tns-core-modules/utils/utils";
-import * as TKUnit from "../../TKUnit";
-import { getColor } from "../helper";
+import * as TKUnit from "../../tk-unit";
+import { getColor } from "../../ui-helper";
// >> img-require
import * as ImageModule from "tns-core-modules/ui/image";
@@ -14,12 +14,12 @@ import * as ImageModule from "tns-core-modules/ui/image";
import * as types from "tns-core-modules/utils/types";
import * as ImageSourceModule from "tns-core-modules/image-source";
import * as ViewModule from "tns-core-modules/ui/core/view";
-import * as helper from "../helper";
+import * as helper from "../../ui-helper";
import * as ObservableModule from "tns-core-modules/data/observable";
import * as color from "tns-core-modules/color";
import * as backgroundModule from "tns-core-modules/ui/styling/background";
import { android as androidApp } from "tns-core-modules/application";
-const imagePath = "~/logo.png";
+const imagePath = "~/assets/logo.png";
export function test_recycling() {
helper.nativeView_recycling_test(() => new Image());
@@ -49,10 +49,10 @@ export const test_setting_src_to_resource = function () {
TKUnit.assert(width > 0, "Width should be greater than 0.");
TKUnit.assert(height > 0, "Height should be greater than 0.");
- }
+ };
helper.buildUIAndRunTest(image, testFunc);
-}
+};
const IMAGE_LOADED_EVENT = "isLoadingChange";
@@ -107,7 +107,7 @@ export const test_SettingImageSrcToURL_async = function (done) {
export const test_SettingImageSrcToFileWithinApp_sync = function () {
// >> img-create-local
const image = new ImageModule.Image();
- image.src = "~/logo.png";
+ image.src = "~/assets/logo.png";
// << img-create-local
runImageTestSync(image, image.src);
@@ -116,7 +116,7 @@ export const test_SettingImageSrcToFileWithinApp_sync = function () {
export const test_SettingImageSrcToFileWithinApp_async = function (done) {
const image = new ImageModule.Image();
(image).useCache = false;
- image.src = "~/logo.png";
+ image.src = "~/assets/logo.png";
runImageTestAsync(image, image.src, done);
};
@@ -164,9 +164,9 @@ export const __test_SettingImageSrcTwiceMustNotMismatch = function (done) {
}
});
image.loadMode = "async";
- image.src = "~/logo.png";
+ image.src = "~/assets/logo.png";
image.src = null;
- // At somepoint image.imageSource was set to "~/logo.png";
+ // At somepoint image.imageSource was set to "~/assets/logo.png";
};
export const test_SettingStretch_AspectFit = function () {
@@ -267,7 +267,7 @@ export const test_SettingImageSourceWhenSizedToParentDoesNotRequestLayout = ios(
let called = false;
image.requestLayout = () => called = true;
- image.src = "~/logo.png";
+ image.src = "~/assets/logo.png";
TKUnit.assertFalse(called, "image.requestLayout should not be called.");
});
@@ -285,7 +285,7 @@ export const test_SettingImageSourceWhenFixedWidthAndHeightDoesNotRequestLayout
let called = false;
image.requestLayout = () => called = true;
- image.src = "~/logo.png";
+ image.src = "~/assets/logo.png";
TKUnit.assertFalse(called, "image.requestLayout should not be called.");
});
@@ -301,7 +301,7 @@ export const test_SettingImageSourceWhenSizedToContentShouldInvalidate = ios(()
let called = false;
image.requestLayout = () => called = true;
- image.src = "~/logo.png";
+ image.src = "~/assets/logo.png";
TKUnit.assertTrue(called, "image.requestLayout should be called.");
});
diff --git a/tests/app/ui/image/image.md b/tests/app/ui/image/image.md
index 2796098b9..06c243969 100644
--- a/tests/app/ui/image/image.md
+++ b/tests/app/ui/image/image.md
@@ -76,7 +76,7 @@ The sample above, demonstrates, how to load an image source while providing URL
``` XML
- {%raw%}{%endraw%}
+ {%raw%}{%endraw%}
```
diff --git a/tests/app/ui/label/label-tests-native.android.ts b/tests/app/ui/label/label-tests-native.android.ts
index 183242306..bf194422f 100644
--- a/tests/app/ui/label/label-tests-native.android.ts
+++ b/tests/app/ui/label/label-tests-native.android.ts
@@ -1,4 +1,4 @@
-import * as labelModule from "tns-core-modules/ui/label";
+import * as labelModule from "tns-core-modules/ui/label";
import * as enums from "tns-core-modules/ui/enums";
import * as colorModule from "tns-core-modules/color";
@@ -26,6 +26,6 @@ export function getNativeBackgroundColor(label: labelModule.Label): colorModule.
return new colorModule.Color((bkg).getBackgroundColor());
}
else {
- return new colorModule.Color(bkg.backgroundColor)
+ return new colorModule.Color(bkg.backgroundColor);
}
}
diff --git a/tests/app/ui/label/label-tests-native.ios.ts b/tests/app/ui/label/label-tests-native.ios.ts
index f08e98a76..2cabc7fca 100644
--- a/tests/app/ui/label/label-tests-native.ios.ts
+++ b/tests/app/ui/label/label-tests-native.ios.ts
@@ -1,7 +1,7 @@
-import * as labelModule from "tns-core-modules/ui/label";
+import * as labelModule from "tns-core-modules/ui/label";
import * as enums from "tns-core-modules/ui/enums";
import * as colorModule from "tns-core-modules/color";
-import { getColor } from "../helper";
+import { getColor } from "../../ui-helper";
export function getNativeTextAlignment(label: labelModule.Label): string {
switch (label.ios.textAlignment) {
@@ -22,5 +22,6 @@ export function getNativeBackgroundColor(label: labelModule.Label): colorModule.
return undefined;
}
var uiColor = UIColor.colorWithCGColor(layer.backgroundColor);
+
return getColor(uiColor);
}
diff --git a/tests/app/ui/label/label-tests.css b/tests/app/ui/label/label-tests-page.css
similarity index 100%
rename from tests/app/ui/label/label-tests.css
rename to tests/app/ui/label/label-tests-page.css
diff --git a/tests/app/ui/label/label-tests-wrong.css b/tests/app/ui/label/label-tests-wrong-page.css
similarity index 100%
rename from tests/app/ui/label/label-tests-wrong.css
rename to tests/app/ui/label/label-tests-wrong-page.css
diff --git a/tests/app/ui/label/label-tests.ts b/tests/app/ui/label/label-tests.ts
index 6e4f416af..bb3b2850d 100644
--- a/tests/app/ui/label/label-tests.ts
+++ b/tests/app/ui/label/label-tests.ts
@@ -1,4 +1,4 @@
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import * as testModule from "../../ui-test";
//>> label-require
@@ -19,14 +19,17 @@ import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout";
import { isIOS, isAndroid } from "tns-core-modules/platform";
import { Label } from "tns-core-modules/ui/label";
import { LayoutBase } from "tns-core-modules/ui/layouts/layout-base";
-import * as helper from "../helper";
+import * as helper from "../../ui-helper";
import { Span, FormattedString } from "tns-core-modules/text/formatted-string";
+const testDir = "ui/label";
+
export class LabelTest extends testModule.UITest {
public create(): LabelModule.Label {
const label = new LabelModule.Label();
label.text = "Label";
+
return label;
}
@@ -525,7 +528,7 @@ export class LabelTest extends testModule.UITest {
view.id = "testLabel";
page.addCss("#testLabel { text-align: " + this.expectedTextAlignment + "; }");
- page.addCssFile(fs.path.join(__dirname, "label-tests.css"));
+ page.addCssFile(fs.path.join(testDir, "label-tests-page.css"));
const actualResult = view.style.textAlignment;
// actual result is taken from #testLabel tag, because it has a greater priority (id vs type).
@@ -559,7 +562,7 @@ export class LabelTest extends testModule.UITest {
this.waitUntilTestElementIsLoaded();
view.id = "testLabel";
- page.addCssFile(fs.path.join(__dirname, "label-tests-wrong.css"));
+ page.addCssFile(fs.path.join(testDir, "label-tests-wrong-page.css"));
TKUnit.assertNotEqual(this.errorMessage, undefined);
}
@@ -646,6 +649,7 @@ export class LabelTest extends testModule.UITest {
let host = new GridLayout();
host.width = 100;
host.height = 100;
+
return host;
});
}
@@ -656,6 +660,7 @@ export class LabelTest extends testModule.UITest {
let host = new GridLayout();
host.width = 100;
host.height = 100;
+
return host;
});
}
@@ -666,9 +671,10 @@ export class LabelTest extends testModule.UITest {
let host = new StackLayout();
label.width = 100;
label.height = 100;
+
return host;
});
- };
+ }
public test_ChangingTextWhenFixedWidthAndHeightDoesNotRequestLayout() {
this.requestLayoutFixture(false, "Hello World", label => {
@@ -676,33 +682,37 @@ export class LabelTest extends testModule.UITest {
let host = new StackLayout();
label.width = 100;
label.height = 100;
+
return host;
});
- };
+ }
public test_SettingTextWhenSizedToContentShouldInvalidate() {
this.requestLayoutFixture(true, "", label => {
label.textWrap = false;
let host = new StackLayout();
host.orientation = "horizontal";
+
return host;
});
- };
+ }
public test_ChangingTextWhenSizedToContentShouldInvalidate() {
this.requestLayoutFixture(true, "Hello World", label => {
label.textWrap = false;
let host = new StackLayout();
host.orientation = "horizontal";
+
return host;
});
- };
+ }
public test_SettingTextOnSingleLineTextWhenWidthIsSizedToParentAndHeightIsSizedToContentShouldRequestLayout() {
this.requestLayoutFixture(true, "", label => {
label.textWrap = false;
let host = new StackLayout();
host.width = 100;
+
return host;
});
}
@@ -712,6 +722,7 @@ export class LabelTest extends testModule.UITest {
label.textWrap = false;
let host = new StackLayout();
host.width = 100;
+
return host;
});
}
@@ -721,6 +732,7 @@ export class LabelTest extends testModule.UITest {
label.textWrap = true;
let host = new StackLayout();
host.width = 100;
+
return host;
});
}
@@ -730,6 +742,7 @@ export class LabelTest extends testModule.UITest {
label.textWrap = true;
let host = new StackLayout();
host.width = 100;
+
return host;
});
}
@@ -747,7 +760,7 @@ export class LabelTest extends testModule.UITest {
label._addChildFromBuilder("FormattedString", formattedString);
label._removeView(formattedString);
- };
+ }
}
export function createTestCase(): LabelTest {
diff --git a/tests/app/ui/layouts/absolute-layout-tests.ts b/tests/app/ui/layouts/absolute-layout-tests.ts
index be4bc45a8..5855392a4 100644
--- a/tests/app/ui/layouts/absolute-layout-tests.ts
+++ b/tests/app/ui/layouts/absolute-layout-tests.ts
@@ -1,10 +1,10 @@
import * as testModule from "../../ui-test";
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import * as labelModule from "tns-core-modules/ui/label";
import * as colorModule from "tns-core-modules/color";
import * as layoutHelper from "./layout-helper";
import * as commonTests from "./common-layout-tests";
-import * as helper from "../helper";
+import * as helper from "../../ui-helper";
// >> absolute-layout-require
import * as absoluteLayoutModule from "tns-core-modules/ui/layouts/absolute-layout";
diff --git a/tests/app/ui/layouts/common-layout-tests.ts b/tests/app/ui/layouts/common-layout-tests.ts
index 91a94d0a4..f54d199e4 100644
--- a/tests/app/ui/layouts/common-layout-tests.ts
+++ b/tests/app/ui/layouts/common-layout-tests.ts
@@ -1,4 +1,4 @@
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import * as layoutHelper from "./layout-helper";
import * as testModule from "../../ui-test";
import { LayoutBase, unsetValue, PercentLength } from "tns-core-modules/ui/layouts/layout-base";
diff --git a/tests/app/ui/layouts/dock-layout-tests.ts b/tests/app/ui/layouts/dock-layout-tests.ts
index 93a97d4cc..df95c733f 100644
--- a/tests/app/ui/layouts/dock-layout-tests.ts
+++ b/tests/app/ui/layouts/dock-layout-tests.ts
@@ -1,10 +1,10 @@
-import * as button from "tns-core-modules/ui/button";
+import * as button from "tns-core-modules/ui/button";
import { DockLayout } from "tns-core-modules/ui/layouts/dock-layout";
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import * as helper from "./layout-helper";
import * as testModule from "../../ui-test";
import * as commonTests from "./common-layout-tests";
-import * as testHelper from "../helper";
+import * as testHelper from "../../ui-helper";
// >> dock-layout-require
import * as dockModule from "tns-core-modules/ui/layouts/dock-layout";
@@ -20,6 +20,7 @@ export class DockLayoutTest extends testModule.UITest {
let rootLayout = new DockLayout();
rootLayout.height = { value: 300, unit: "px" };
rootLayout.width = { value: 300, unit: "px" };
+
return rootLayout;
}
@@ -51,7 +52,7 @@ export class DockLayoutTest extends testModule.UITest {
public test_dock_left() {
var testBtn = new helper.MyButton();
- testBtn.width = { value: 20, unit: "px" }
+ testBtn.width = { value: 20, unit: "px" };
this.testView.stretchLastChild = false;
this.testView.addChild(testBtn);
@@ -116,12 +117,12 @@ export class DockLayoutTest extends testModule.UITest {
this.testView.addChild(testBtnTop);
var testBtnRight = new helper.MyButton();
- testBtnRight.width = { value: 20, unit: "px" }
+ testBtnRight.width = { value: 20, unit: "px" };
dockModule.DockLayout.setDock(testBtnRight, "right");
this.testView.addChild(testBtnRight);
var testBtnBottom = new helper.MyButton();
- testBtnBottom.height = { value: 20, unit: "px" }
+ testBtnBottom.height = { value: 20, unit: "px" };
dockModule.DockLayout.setDock(testBtnBottom, "bottom");
this.testView.addChild(testBtnBottom);
diff --git a/tests/app/ui/layouts/flexbox-layout-tests.ts b/tests/app/ui/layouts/flexbox-layout-tests.ts
index 86ef59e54..98ff8d72d 100644
--- a/tests/app/ui/layouts/flexbox-layout-tests.ts
+++ b/tests/app/ui/layouts/flexbox-layout-tests.ts
@@ -53,8 +53,8 @@ export namespace AlignSelf {
import { View, unsetValue, Length, PercentLength } from "tns-core-modules/ui/core/view";
import { Label } from "tns-core-modules/ui/label";
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import { parse } from "tns-core-modules/ui/builder";
import { dipToDp, left, top, right, bottom, height, width,
paddingLeft, paddingTop, paddingRight, paddingBottom,
@@ -101,11 +101,12 @@ function test(ui: () => U, setup: (ui: U) => void, tes
waitUntilTestElementLayoutIsValid(i.root);
test(i);
});
- }
-};
+ };
+}
let getViews = (template: string) => {
let root = parse(template);
+
return {
root,
flexbox: root.getViewById("flexbox") as FlexboxLayout,
@@ -627,7 +628,7 @@ export const testJustifyContent_spaceBetween_flexDirection_column_withPadding =
export const testJustifyContent_spaceAround_flexDirection_column = test(
activity_justify_content_test,
({ flexbox }) => {
- flexbox.justifyContent = JustifyContent.SPACE_AROUND
+ flexbox.justifyContent = JustifyContent.SPACE_AROUND;
flexbox.flexDirection = FlexDirection.COLUMN;
},
({ root, flexbox, text1, text2, text3 }) => {
@@ -654,7 +655,7 @@ export const testJustifyContent_spaceAround_flexDirection_column_withPadding = t
({ root, flexbox, text1, text2, text3 }) => {
let space = height(flexbox) - height(text1) - height(text2) - height(text3) - dipToDp(padding) * 2;
space = space / 6; // Divide by the number of children * 2
-
+
closeEnough(top(text1), paddingTop(flexbox) + space);
closeEnough(bottom(text1) + 2 * space, top(text2));
closeEnough(bottom(text2) + 2 * space, top(text3));
@@ -849,7 +850,7 @@ export const testAlignContent_spaceBetween_withPadding = test(
isBottomAlignedWith(text3, flexbox);
isLeftAlignedWith(text3, flexbox);
}
-);
+);
export const testAlignContent_spaceAround = test(
activity_align_content_test,
@@ -1292,7 +1293,7 @@ export const testAlignItems_flexEnd_flexDirection_column = test(
isRightWith(text1, flexbox, flexLineSize);
isRightWith(text2, flexbox, flexLineSize);
}
-)
+);
export const testAlignItems_center_flexDirection_column = test(
activity_align_items_test,
@@ -1406,7 +1407,7 @@ let activity_flex_wrap_test = () => getViews(
`
-)
+);
export const testFlexDirection_row_reverse = test(
activity_flex_wrap_test,
@@ -1523,8 +1524,8 @@ export const testMinWidth_initial_width_less_than_minWidth = test(
noop,
({ root, flexbox, text1, text2, text3 }) => {
let minWidth = 100;
- closeEnough(width(text1), dipToDp(100));
- closeEnough(width(text2), width(flexbox) - dipToDp(100));
+ closeEnough(width(text1), dipToDp(minWidth));
+ closeEnough(width(text2), width(flexbox) - dipToDp(minWidth));
}
);
@@ -1680,7 +1681,7 @@ export const testWrapBefore2 = test(
isBelow(text3, text2);
equal(height(flexbox), height(text1) + height(text3));
}
-)
+);
export const testWrapBefore_nowrap = test(
activity_wrap_before_test,
@@ -1702,7 +1703,7 @@ let activity_wrap_parent_padding_horizontal_test = () => getViews(
`
-
+
`
);
@@ -1740,7 +1741,7 @@ let activity_wrap_child_margin_horizontal_test = () => getViews(
`
-)
+);
export const testWrap_childMargin_horizontal = test(
activity_wrap_child_margin_horizontal_test,
@@ -1780,7 +1781,7 @@ let activity_first_item_large_vertical_test = () => getViews(
`
-)
+);
export const testFirstItemLarge_vertical = test(
activity_first_item_large_vertical_test,
diff --git a/tests/app/ui/layouts/grid-layout-tests.ts b/tests/app/ui/layouts/grid-layout-tests.ts
index 6d80c7925..a57a243a9 100644
--- a/tests/app/ui/layouts/grid-layout-tests.ts
+++ b/tests/app/ui/layouts/grid-layout-tests.ts
@@ -1,7 +1,7 @@
-import { Page } from "tns-core-modules/ui/page";
+import { Page } from "tns-core-modules/ui/page";
import { GridLayout, ItemSpec } from "tns-core-modules/ui/layouts/grid-layout";
import { Button } from "tns-core-modules/ui/button";
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import * as view from "tns-core-modules/ui/core/view";
import { unsetValue } from "tns-core-modules/ui/core/view";
import * as builder from "tns-core-modules/ui/builder";
@@ -9,7 +9,7 @@ import * as testModule from "../../ui-test";
import * as layoutHelper from "./layout-helper";
import * as platform from "tns-core-modules/platform";
import * as commonTests from "./common-layout-tests";
-import * as helper from "../helper";
+import * as helper from "../../ui-helper";
var DELTA = 1;
class RemovalTrackingGridLayout extends GridLayout {
@@ -158,7 +158,7 @@ export class GridLayoutTest extends testModule.UITest
public test_setColumn_shouldThrow_onNullValues() {
TKUnit.assertThrows(() => {
GridLayout.setColumn(null, 1);
- }, "setColumn called with null should throw exception")
+ }, "setColumn called with null should throw exception");
}
public test_setColumnSpan_shouldThrow_onNullValues() {
@@ -746,7 +746,7 @@ export class GridLayoutTest extends testModule.UITest
gridLayout.addRow(firstRow);
gridLayout.addRow(secondRow);
// << grid-layout-add-rowscols
- }
+ };
public test_percent_support_nativeLayoutParams_are_correct() {
commonTests.percent_support_nativeLayoutParams_are_correct(this);
diff --git a/tests/app/ui/layouts/layout-helper.android.ts b/tests/app/ui/layouts/layout-helper.android.ts
index 7120b019d..bd99021b2 100644
--- a/tests/app/ui/layouts/layout-helper.android.ts
+++ b/tests/app/ui/layouts/layout-helper.android.ts
@@ -1,9 +1,9 @@
-import { Button } from "tns-core-modules/ui/button";
+import { Button } from "tns-core-modules/ui/button";
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout";
import * as utils from "tns-core-modules/utils/utils";
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import * as def from "./layout-helper";
var DELTA = 0.1;
@@ -11,6 +11,7 @@ var DELTA = 0.1;
class NativeButton extends android.widget.Button {
constructor(context: android.content.Context, public owner: def.MeasuredView) {
super(context);
+
return global.__native(this);
}
@@ -30,6 +31,7 @@ class NativeButton extends android.widget.Button {
class NativeStackLayout extends org.nativescript.widgets.StackLayout {
constructor(context: android.content.Context, public owner: def.MeasuredView) {
super(context);
+
return global.__native(this);
}
@@ -49,6 +51,7 @@ class NativeStackLayout extends org.nativescript.widgets.StackLayout {
class NativeGridLayout extends org.nativescript.widgets.GridLayout {
constructor(context: android.content.Context, public owner: def.MeasuredView) {
super(context);
+
return global.__native(this);
}
diff --git a/tests/app/ui/layouts/layout-helper.ios.ts b/tests/app/ui/layouts/layout-helper.ios.ts
index fafa0a7ba..a94b98c49 100644
--- a/tests/app/ui/layouts/layout-helper.ios.ts
+++ b/tests/app/ui/layouts/layout-helper.ios.ts
@@ -1,8 +1,8 @@
-import { Button } from "tns-core-modules/ui/button";
+import { Button } from "tns-core-modules/ui/button";
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout";
import * as utils from "tns-core-modules/utils/utils";
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import * as def from "./layout-helper";
var DELTA = 0.1;
@@ -44,21 +44,25 @@ export class MyGridLayout extends GridLayout implements def.MyGridLayout {
get layoutWidth(): number {
let bounds = this._getCurrentLayoutBounds();
+
return bounds.right - bounds.left;
}
get layoutHeight(): number {
let bounds = this._getCurrentLayoutBounds();
+
return bounds.bottom - bounds.top;
}
get layoutLeft(): number {
let bounds = this._getCurrentLayoutBounds();
+
return bounds.left;
}
get layoutTop(): number {
let bounds = this._getCurrentLayoutBounds();
+
return bounds.top;
}
}
@@ -100,21 +104,25 @@ export class MyStackLayout extends StackLayout implements def.MyStackLayout {
get layoutWidth(): number {
let bounds = this._getCurrentLayoutBounds();
+
return bounds.right - bounds.left;
}
get layoutHeight(): number {
let bounds = this._getCurrentLayoutBounds();
+
return bounds.bottom - bounds.top;
}
get layoutLeft(): number {
let bounds = this._getCurrentLayoutBounds();
+
return bounds.left;
}
get layoutTop(): number {
let bounds = this._getCurrentLayoutBounds();
+
return bounds.top;
}
}
@@ -156,21 +164,25 @@ export class MyButton extends Button implements def.MyButton {
get layoutWidth(): number {
let bounds = this._getCurrentLayoutBounds();
+
return bounds.right - bounds.left;
}
get layoutHeight(): number {
let bounds = this._getCurrentLayoutBounds();
+
return bounds.bottom - bounds.top;
}
get layoutLeft(): number {
let bounds = this._getCurrentLayoutBounds();
+
return bounds.left;
}
get layoutTop(): number {
let bounds = this._getCurrentLayoutBounds();
+
return bounds.top;
}
}
diff --git a/tests/app/ui/layouts/layout-tests-helper.ts b/tests/app/ui/layouts/layout-tests-helper.ts
index cacd342ec..9a6e093f6 100644
--- a/tests/app/ui/layouts/layout-tests-helper.ts
+++ b/tests/app/ui/layouts/layout-tests-helper.ts
@@ -1,5 +1,5 @@
import { View, Length } from "tns-core-modules/ui/core/view";
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import { layout } from "tns-core-modules/utils/utils";
import round = layout.round;
@@ -20,10 +20,10 @@ export function width(view: View): number {
return round(dipToDp(view.getActualSize().width));
}
-export function paddingLeft(view: View): number { return Length.toDevicePixels(view.style.paddingLeft, 0) + Length.toDevicePixels(view.parent.style.paddingLeft, 0) + (view.parent).getSafeAreaInsets().left; };
-export function paddingTop(view: View): number { return top(view) + Length.toDevicePixels(view.style.paddingTop, 0) };
-export function paddingRight(view: View): number { return right(view) - Length.toDevicePixels(view.style.paddingRight, 0) };
-export function paddingBottom(view: View): number { return bottom(view) - Length.toDevicePixels(view.style.paddingBottom, 0) };
+export function paddingLeft(view: View): number { return Length.toDevicePixels(view.style.paddingLeft, 0) + Length.toDevicePixels(view.parent.style.paddingLeft, 0) + (view.parent).getSafeAreaInsets().left; }
+export function paddingTop(view: View): number { return top(view) + Length.toDevicePixels(view.style.paddingTop, 0); }
+export function paddingRight(view: View): number { return right(view) - Length.toDevicePixels(view.style.paddingRight, 0); }
+export function paddingBottom(view: View): number { return bottom(view) - Length.toDevicePixels(view.style.paddingBottom, 0); }
export function equal(a: T, b: T, message?: string) {
message ? TKUnit.assertEqual(a, b, message) : TKUnit.assertEqual(a, b);
diff --git a/tests/app/ui/layouts/safe-area-tests.ts b/tests/app/ui/layouts/safe-area-tests.ts
index 965d89b07..8813bb342 100644
--- a/tests/app/ui/layouts/safe-area-tests.ts
+++ b/tests/app/ui/layouts/safe-area-tests.ts
@@ -1,15 +1,15 @@
import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout";
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import * as view from "tns-core-modules/ui/core/view";
import * as testModule from "../../ui-test";
import * as platform from "tns-core-modules/platform";
-import * as helper from "../helper";
+import * as helper from "../../ui-helper";
import { parse } from "tns-core-modules/ui/builder";
import { Page } from "tns-core-modules/ui/page";
import { Label } from "tns-core-modules/ui/label";
import {
dipToDp, left, top, right, bottom, height, width,
- equal, closeEnough, lessOrCloseEnough, greaterOrCloseEnough, check,
+ equal, closeEnough, lessOrCloseEnough, greaterOrCloseEnough,
isLeftAlignedWith, isRightAlignedWith, isTopAlignedWith, isBottomAlignedWith,
isLeftWith, isAboveWith, isRightWith, isBelowWith
} from "./layout-tests-helper";
@@ -32,11 +32,11 @@ export class SafeAreaTests extends testModule.UITest {
waitUntilTestElementLayoutIsValid(ui.root);
test(ui);
}, pageOptions);
- };
+ }
private noop() {
// no operation
- };
+ }
public test_layout_changed_event_count() {
const page = parse(`
@@ -59,19 +59,20 @@ export class SafeAreaTests extends testModule.UITest {
helper.navigate(() => page);
label.height = 100;
TKUnit.waitUntilReady(() => labelLayoutChangedCounter === 2);
- TKUnit.assert(gridLayoutChangedCounter === 1, `${grid} layoutChanged event count - actual:${gridLayoutChangedCounter}; expected: 1`)
+ TKUnit.assert(gridLayoutChangedCounter === 1, `${grid} layoutChanged event count - actual:${gridLayoutChangedCounter}; expected: 1`);
}
// Common
private getViews(template: string) {
let root = parse(template);
+
return {
root,
child0: root.getViewById("child0") as view.View,
child1: root.getViewById("child1") as view.View,
child2: root.getViewById("child2") as view.View
};
- };
+ }
private layout_insets_top_action_bar_test(layout: view.View) {
const app = UIApplication.sharedApplication;
@@ -80,7 +81,7 @@ export class SafeAreaTests extends testModule.UITest {
const topInset = statusBarHeight + actionBarHeight;
const insets = layout.getSafeAreaInsets();
- equal(insets.top, topInset, `${layout}.topInset - actual:${insets.top}; expected: ${topInset}`)
+ equal(insets.top, topInset, `${layout}.topInset - actual:${insets.top}; expected: ${topInset}`);
}
private layout_insets_top_action_bar_hidden_test(layout: view.View) {
@@ -89,7 +90,7 @@ export class SafeAreaTests extends testModule.UITest {
const topInset = statusBarHeight;
const insets = layout.getSafeAreaInsets();
- equal(insets.top, topInset, `${layout}.topInset - actual:${insets.top}; expected: ${topInset}`)
+ equal(insets.top, topInset, `${layout}.topInset - actual:${insets.top}; expected: ${topInset}`);
}
private layout_in_full_screen_test(layout: view.View, pageOptions?: helper.PageOptions) {
@@ -112,7 +113,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_in_full_screen_test(root, pageOptions);
},
pageOptions
@@ -147,7 +148,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_test(root);
},
{ actionBar: true }
@@ -162,7 +163,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_hidden_test(root);
},
{ actionBarHidden: true }
@@ -177,7 +178,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_test(root);
},
{ actionBarFlat: true }
@@ -192,7 +193,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_hidden_test(root);
},
{ tabBar: true }
@@ -207,7 +208,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_test(root);
},
{ actionBar: true, tabBar: true }
@@ -292,6 +293,7 @@ export class SafeAreaTests extends testModule.UITest {
// Dock
private getDockViews(template: string) {
let root = parse(template);
+
return {
root,
childLeft: root.getViewById("childLeft") as view.View,
@@ -300,7 +302,7 @@ export class SafeAreaTests extends testModule.UITest {
childBottom: root.getViewById("childBottom") as view.View,
childFill: root.getViewById("childFill") as view.View,
};
- };
+ }
private dock_in_full_screen(pageOptions?: helper.PageOptions) {
const snippet = `
@@ -310,7 +312,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getDockViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_in_full_screen_test(root, pageOptions);
},
pageOptions
@@ -345,7 +347,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_test(root);
},
{ actionBar: true }
@@ -360,7 +362,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_hidden_test(root);
},
{ actionBarHidden: true }
@@ -375,7 +377,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_test(root);
},
{ actionBarFlat: true }
@@ -390,7 +392,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_hidden_test(root);
},
{ tabBar: true }
@@ -405,7 +407,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_test(root);
},
{ actionBar: true, tabBar: true }
@@ -500,7 +502,7 @@ export class SafeAreaTests extends testModule.UITest {
const sumOfNestedDockHeights = height(childTop) + height(childFill) + height(childBottom);
equal(height(root), sumOfNestedDockHeights, `dock height<${height(root)}> sum of nested docks height <${sumOfNestedDockHeights}>`);
- const sumOfNestedDockWidths = width(childLeft) + width(childFill) + width(childRight)
+ const sumOfNestedDockWidths = width(childLeft) + width(childFill) + width(childRight);
equal(width(root), sumOfNestedDockWidths, `dock width<${width(root)}> sum of nested docks width <${sumOfNestedDockWidths}>`);
},
pageOptions
@@ -563,7 +565,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_test(root);
},
{ actionBar: true }
@@ -578,7 +580,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_hidden_test(root);
},
{ actionBarHidden: true }
@@ -593,7 +595,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_test(root);
},
{ actionBarFlat: true }
@@ -608,7 +610,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_hidden_test(root);
},
{ tabBar: true }
@@ -623,7 +625,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_test(root);
},
{ actionBar: true, tabBar: true }
@@ -803,6 +805,7 @@ export class SafeAreaTests extends testModule.UITest {
// Grid
private getGridViews(template: string) {
let root = parse(template);
+
return {
root,
grid: root.getViewById("grid") as GridLayout,
@@ -812,7 +815,7 @@ export class SafeAreaTests extends testModule.UITest {
[root.getViewById("cell20") as view.View, root.getViewById("cell21") as view.View, root.getViewById("cell22") as view.View]
]
};
- };
+ }
private grid_layout_in_full_screen(pageOptions?: helper.PageOptions) {
const snippet = `
@@ -857,7 +860,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_test(root);
},
{ actionBar: true }
@@ -872,7 +875,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_hidden_test(root);
},
{ actionBarHidden: true }
@@ -887,7 +890,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_test(root);
},
{ actionBarFlat: true }
@@ -902,7 +905,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_hidden_test(root);
},
{ tabBar: true }
@@ -917,7 +920,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_test(root);
},
{ actionBar: true, tabBar: true }
@@ -1031,7 +1034,7 @@ export class SafeAreaTests extends testModule.UITest {
greaterOrCloseEnough(width(cells[1][0]), width(cells[1][1]), `cell10 width<${width(cells[1][0])}> not greater or close enough cell11 width<${width(cells[1][1])}>`);
lessOrCloseEnough(width(cells[1][1]), width(cells[1][2]), `cell11 width<${width(cells[1][1])}> not less or close enough cell12 width<${width(cells[1][2])}>`);
- const sumOfNestedGridWidths = width(cells[1][0]) + width(cells[1][1]) + width(cells[1][2])
+ const sumOfNestedGridWidths = width(cells[1][0]) + width(cells[1][1]) + width(cells[1][2]);
equal(width(grid), sumOfNestedGridWidths, `grid width<${width(grid)}> sum of nested grids width <${sumOfNestedGridWidths}>`);
},
pageOptions
@@ -1094,7 +1097,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_test(root);
},
{ actionBar: true }
@@ -1109,7 +1112,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_hidden_test(root);
},
{ actionBarHidden: true }
@@ -1124,7 +1127,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_test(root);
},
{ actionBarFlat: true }
@@ -1139,7 +1142,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_hidden_test(root);
},
{ tabBar: true }
@@ -1154,7 +1157,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_test(root);
},
{ actionBar: true, tabBar: true }
@@ -1308,7 +1311,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_test(root);
},
{ actionBar: true }
@@ -1323,7 +1326,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_hidden_test(root);
},
{ actionBarHidden: true }
@@ -1338,7 +1341,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_test(root);
},
{ actionBarFlat: true }
@@ -1353,7 +1356,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_hidden_test(root);
},
{ tabBar: true }
@@ -1368,7 +1371,7 @@ export class SafeAreaTests extends testModule.UITest {
this.executeSnippet(
this.getViews(snippet),
this.noop,
- ({ root }) => {
+ ({ root }) => {
this.layout_insets_top_action_bar_test(root);
},
{ actionBar: true, tabBar: true }
diff --git a/tests/app/ui/layouts/stack-layout-tests.ts b/tests/app/ui/layouts/stack-layout-tests.ts
index 75e06e63b..81871a4c0 100644
--- a/tests/app/ui/layouts/stack-layout-tests.ts
+++ b/tests/app/ui/layouts/stack-layout-tests.ts
@@ -1,7 +1,7 @@
-import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
+import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
import { Button } from "tns-core-modules/ui/button";
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import * as enums from "tns-core-modules/ui/enums";
import * as utils from "tns-core-modules/utils/utils";
import * as testModule from "../../ui-test";
@@ -22,6 +22,7 @@ export class StackLayoutTest extends testModule.UITest {
this.btn2 = new layoutHelper.MyButton();
this.btn2.text = "btn2";
this.rootLayout.addChild(this.btn2);
+
return this.rootLayout;
}
@@ -169,7 +170,7 @@ export class StackLayoutTest extends testModule.UITest {
// var StackLayout = require("ui/layouts/stack-layout").StackLayout;
// << stack-layout-require
- // >> stack-layout-new
+ // >> stack-layout-new
// >> (hide)
// var Button = require("ui/button").Button;
// << (hide)
@@ -205,6 +206,7 @@ export class StackLayoutTest extends testModule.UITest {
btn.margin = "10%";
btn.text = "1";
layout.addChild(btn);
+
return btn;
}
diff --git a/tests/app/ui/layouts/wrap-layout-tests.ts b/tests/app/ui/layouts/wrap-layout-tests.ts
index 0e0c7fb0e..c0fbb42b5 100644
--- a/tests/app/ui/layouts/wrap-layout-tests.ts
+++ b/tests/app/ui/layouts/wrap-layout-tests.ts
@@ -1,9 +1,9 @@
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import { Label } from "tns-core-modules/ui/label";
import * as layoutHelper from "./layout-helper";
import * as testModule from "../../ui-test";
import * as commonTests from "./common-layout-tests";
-import * as helper from "../helper";
+import * as helper from "../../ui-helper";
// >> wrap-layout-require
import * as wrapLayoutModule from "tns-core-modules/ui/layouts/wrap-layout";
@@ -231,7 +231,7 @@ export class WrapLayoutTest extends testModule.UITest
-
+
diff --git a/tests/app/ui/list-picker/list-picker-tests.ts b/tests/app/ui/list-picker/list-picker-tests.ts
index 2dedf070d..b62dd4547 100644
--- a/tests/app/ui/list-picker/list-picker-tests.ts
+++ b/tests/app/ui/list-picker/list-picker-tests.ts
@@ -1,5 +1,5 @@
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import * as viewModule from "tns-core-modules/ui/core/view";
import * as listPickerTestsNative from "./list-picker-tests-native";
import * as application from "tns-core-modules/application";
@@ -13,6 +13,7 @@ function _createListPicker(): listPickerModule.ListPicker {
var listPicker = new listPickerModule.ListPicker();
// << article-create-listpicker
listPicker.id = "ListPicker";
+
return listPicker;
}
@@ -21,6 +22,7 @@ function _createItems(count: number): Array {
for (var i = 0; i < count; i++) {
items.push(i);
}
+
return items;
}
@@ -35,7 +37,7 @@ export var testWhenlistPickerIsCreatedItemsAreUndefined = function () {
var actualValue = listPicker.items;
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testWhenlistPickerIsCreatedSelectedIndexIsUndefined = function () {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array) {
@@ -44,7 +46,7 @@ export var testWhenlistPickerIsCreatedSelectedIndexIsUndefined = function () {
var actualValue = listPicker.selectedIndex;
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testWhenSettingItemsToNonEmptyArrayTheSameAmountOfNativeItemsIsCreated = function () {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array) {
@@ -54,7 +56,7 @@ export var testWhenSettingItemsToNonEmptyArrayTheSameAmountOfNativeItemsIsCreate
var actualValue = listPickerTestsNative.getNativeItemsCount(listPicker);
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testWhenSettingItemsToEmptyArrayZeroNativeItemsAreCreated = function () {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array) {
@@ -64,7 +66,7 @@ export var testWhenSettingItemsToEmptyArrayZeroNativeItemsAreCreated = function
var actualValue = listPickerTestsNative.getNativeItemsCount(listPicker);
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testSelectedIndexBecomesZeroWhenItemsBoundToNonEmptyArray = function () {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array) {
@@ -76,7 +78,7 @@ export var testSelectedIndexBecomesZeroWhenItemsBoundToNonEmptyArray = function
var actualValue = listPicker.selectedIndex;
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testSelectedIndexBecomesUndefinedWhenItemsBoundToEmptyArray = function () {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array) {
@@ -90,7 +92,7 @@ export var testSelectedIndexBecomesUndefinedWhenItemsBoundToEmptyArray = functio
var actualValue = listPicker.selectedIndex;
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testSelectedIndexBecomesUndefinedWhenItemsBoundToUndefined = function () {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array) {
@@ -102,7 +104,7 @@ export var testSelectedIndexBecomesUndefinedWhenItemsBoundToUndefined = function
var actualValue = listPicker.selectedIndex;
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testSelectedIndexBecomesUndefinedWhenItemsBoundToNull = function () {
helper.buildUIAndRunTest(_createListPicker(), function (views: Array) {
@@ -114,7 +116,7 @@ export var testSelectedIndexBecomesUndefinedWhenItemsBoundToNull = function () {
var actualValue = listPicker.selectedIndex;
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testItemsIsResolvedCorrectlyIfSetBeforeViewIsLoaded = function () {
var listPicker = _createListPicker();
@@ -126,7 +128,7 @@ export var testItemsIsResolvedCorrectlyIfSetBeforeViewIsLoaded = function () {
var actualValue = listPicker.items.length;
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testSelectedIndexIsResolvedCorrectlyIfSetBeforeViewIsLoaded = function () {
var listPicker = _createListPicker();
@@ -138,7 +140,7 @@ export var testSelectedIndexIsResolvedCorrectlyIfSetBeforeViewIsLoaded = functio
var actualValue = listPicker.selectedIndex;
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
// export var testSettingNegativeSelectedIndexShouldThrow = function () {
// var listPicker = _createListPicker();
@@ -175,7 +177,7 @@ export var testWhenSelectingAnItemNativelySelectedIndexIsUpdatedProperly = funct
let actualValue = listPicker.selectedIndex;
TKUnit.assertEqual(actualValue, expectedValue);
-}
+};
export var test_Android_MaxValueIsOneLessThanItemsCount = function () {
if (!application.android) {
@@ -189,7 +191,7 @@ export var test_Android_MaxValueIsOneLessThanItemsCount = function () {
var actualValue = listPicker.nativeViewProtected.getMaxValue();
TKUnit.assertEqual(actualValue, expectedValue);
});
-}
+};
export var test_Android_WhenItemsAreEmptyNativeControlDoesNotShowZero = function () {
if (!application.android) {
@@ -202,7 +204,7 @@ export var test_Android_WhenItemsAreEmptyNativeControlDoesNotShowZero = function
var actualValue = listPicker.nativeViewProtected.editText.getText().toString();
TKUnit.assertEqual(actualValue, expectedValue);
});
-}
+};
export var test_Android_WhenBoundToSingleElementArrayEditTextIsUpdatedProperly = function () {
if (!application.android) {
@@ -216,7 +218,7 @@ export var test_Android_WhenBoundToSingleElementArrayEditTextIsUpdatedProperly =
var actualValue = listPicker.nativeViewProtected.editText.getText().toString();
TKUnit.assertEqual(actualValue, expectedValue);
});
-}
+};
export var test_Android_WhenSelectedIndexChangesEditTextIsUpdatedProperly = function () {
if (!application.android) {
@@ -231,4 +233,4 @@ export var test_Android_WhenSelectedIndexChangesEditTextIsUpdatedProperly = func
var actualValue = listPicker.nativeViewProtected.editText.getText().toString();
TKUnit.assertEqual(actualValue, expectedValue);
});
-}
\ No newline at end of file
+};
\ No newline at end of file
diff --git a/tests/app/ui/list-view/list-view-safe-area-tests.ts b/tests/app/ui/list-view/list-view-safe-area-tests.ts
index 0e33c5841..5ef3884a5 100644
--- a/tests/app/ui/list-view/list-view-safe-area-tests.ts
+++ b/tests/app/ui/list-view/list-view-safe-area-tests.ts
@@ -1,15 +1,14 @@
-import * as helper from "../helper";
-import * as TKUnit from "../../TKUnit";
+import * as helper from "../../ui-helper";
+import * as TKUnit from "../../tk-unit";
import { parse } from "tns-core-modules/ui/builder";
import * as view from "tns-core-modules/ui/core/view";
import * as platform from "tns-core-modules/platform";
import { ListView } from "tns-core-modules/ui/list-view";
-import { ios as iosUtils } from "tns-core-modules/utils/utils";
import { ViewModel } from "./list-view-view-model";
import { UITest } from "../../ui-test";
import {
- dipToDp, left, top, right, bottom, height, width,
- equal, check, lessOrCloseEnough, greaterOrCloseEnough,
+ left, top, right, bottom, height, width,
+ equal, lessOrCloseEnough, greaterOrCloseEnough,
isLeftAlignedWith, isRightAlignedWith, isTopAlignedWith
} from "../layouts/layout-tests-helper";
@@ -27,14 +26,15 @@ export class ListViewSafeAreaTest extends UITest {
waitUntilTestElementLayoutIsValid(ui.root);
test(ui);
}, pageOptions);
- };
+ }
private noop() {
// no operation
- };
+ }
private getViews(template: string) {
let root = parse(template);
+
return {
root,
list: root.getViewById("list") as ListView,
@@ -44,7 +44,7 @@ export class ListViewSafeAreaTest extends UITest {
[root.getViewById("cell20") as ListView, root.getViewById("cell21") as ListView, root.getViewById("cell22") as ListView]
]
};
- };
+ }
private list_view_in_full_screen(listView: ListView, pageOptions?: helper.PageOptions) {
const l = left(listView);
@@ -183,7 +183,7 @@ export class ListViewSafeAreaTest extends UITest {
greaterOrCloseEnough(width(cells[1][0]), width(cells[1][1]), `cell10 width<${width(cells[1][0])}> not greater or close enough cell11 width<${width(cells[1][1])}>`);
lessOrCloseEnough(width(cells[1][1]), width(cells[1][2]), `cell11 width<${width(cells[1][1])}> not less or close enough cell12 width<${width(cells[1][2])}>`);
- const sumOfNestedListViewWidths = width(cells[1][0]) + width(cells[1][1]) + width(cells[1][2])
+ const sumOfNestedListViewWidths = width(cells[1][0]) + width(cells[1][1]) + width(cells[1][2]);
equal(width(root), sumOfNestedListViewWidths, `grid width<${width(root)}> sum of nested list views width <${sumOfNestedListViewWidths}>`);
},
pageOptions
@@ -211,7 +211,7 @@ function setBindingContext(list: ListView) {
return function () {
const page = list.page;
page.bindingContext = new ViewModel();
- }
+ };
}
export function createTestCase(): ListViewSafeAreaTest {
diff --git a/tests/app/ui/list-view/list-view-tests.ts b/tests/app/ui/list-view/list-view-tests.ts
index 9478134a1..1a899c583 100644
--- a/tests/app/ui/list-view/list-view-tests.ts
+++ b/tests/app/ui/list-view/list-view-tests.ts
@@ -1,5 +1,5 @@
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import { UITest } from "../../ui-test";
import { getResources as appGetResources } from "tns-core-modules/application";
import { Observable, EventData } from "tns-core-modules/data/observable";
@@ -356,7 +356,7 @@ export class ListViewTest extends UITest {
this.waitUntilListViewReady();
TKUnit.assertEqual(this.getNativeViewCount(listView), 3, "getNativeViewCount");
- // Remove the first 2 elements and add
+ // Remove the first 2 elements and add
data.splice(0, 2, "d", "e", "f");
this.waitUntilListViewReady();
TKUnit.assertEqual(this.getNativeViewCount(listView), 4, "getNativeViewCount");
@@ -465,6 +465,7 @@ export class ListViewTest extends UITest {
var month = value.getMonth() + 1;
result = result.replace("MM", month < 10 ? "0" + month : month);
result = result.replace("YYYY", value.getFullYear());
+
return result;
};
@@ -505,8 +506,9 @@ export class ListViewTest extends UITest {
var label = new Label();
label.id = "testLabel";
label.bind({ sourceProperty: "$value", targetProperty: "text", twoWay: false });
+
return label;
- }
+ };
listView.items = [1, 2, 3];
this.waitUntilListViewReady();
@@ -586,8 +588,9 @@ export class ListViewTest extends UITest {
var testConverter = function (value) {
converterCalledCounter++;
+
return value;
- }
+ };
appGetResources()["testConverter"] = testConverter;
@@ -609,8 +612,9 @@ export class ListViewTest extends UITest {
var testConverter = function (value) {
converterCalledCounter++;
+
return value;
- }
+ };
appGetResources()["testConverter"] = testConverter;
@@ -644,7 +648,7 @@ export class ListViewTest extends UITest {
}
public test_no_memory_leak_when_items_is_observable_array() {
- // Keep the reference to the observable array to test the weakEventListener
+ // Keep the reference to the observable array to test the weakEventListener
var colors = new ObservableArray(["red", "green", "blue"]);
let weakRef = new WeakRef(this.testView);
@@ -736,7 +740,7 @@ export class ListViewTest extends UITest {
let array = new ArrayBuffer(4 * 1024 * 1024);
if (!array) {
///
- };
+ }
}
GC();
@@ -767,7 +771,7 @@ export class ListViewTest extends UITest {
TKUnit.wait(0.1);
var lastNativeElementVisible = this.checkItemVisibleAtIndex(listView, MANY_ITEMS.length - 1);
- TKUnit.assertEqual(lastNativeElementVisible, true, "last element is visible");
+ TKUnit.assertEqual(lastNativeElementVisible, true, "last element is visible");
}
public test_scrollToIndex_should_not_throw_if_items_not_set() {
@@ -789,6 +793,7 @@ export class ListViewTest extends UITest {
new ArrayBuffer(4 * 1024 * 1024);
}
GC();
+
return !weakRef.get();
});
@@ -808,6 +813,7 @@ export class ListViewTest extends UITest {
if (nativeElement instanceof android.view.ViewGroup) {
return (((nativeElement).getChildAt(0))).getText() + "";
}
+
return (nativeElement).getText() + "";
}
else if (listView.ios) {
@@ -998,6 +1004,7 @@ export class ListViewTest extends UITest {
}
});
}
+
return items;
}
}
diff --git a/tests/app/ui/page/modal-page.ts b/tests/app/ui/page/modal-page.ts
index b1c4ec910..78433bf98 100644
--- a/tests/app/ui/page/modal-page.ts
+++ b/tests/app/ui/page/modal-page.ts
@@ -1,5 +1,5 @@
import { topmost } from "tns-core-modules/ui/frame";
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import { Page, ShownModallyData } from "tns-core-modules/ui/page";
export var modalPage: Page;
diff --git a/tests/app/ui/page/modal-tab-page.ts b/tests/app/ui/page/modal-tab-page.ts
index 9585789bf..f4334f44d 100644
--- a/tests/app/ui/page/modal-tab-page.ts
+++ b/tests/app/ui/page/modal-tab-page.ts
@@ -1,11 +1,11 @@
import { NavigatedData } from "tns-core-modules/ui/page";
import { View } from "tns-core-modules/ui/core/view";
-import * as TKUnit from "../../TKUnit";
-import { stack } from "tns-core-modules/ui/frame";
+import * as TKUnit from "../../tk-unit";
+import { _stack } from "tns-core-modules/ui/frame";
import { isAndroid } from "tns-core-modules/platform";
export function onNavigatedTo(args: NavigatedData) {
- TKUnit.assertEqual(stack().length, 2, "Host and tab modal frame should be instantiated at this point!");
+ TKUnit.assertEqual(_stack().length, 2, "Host and tab modal frame should be instantiated at this point!");
// shownModally raised after page.NavigatedTo on iOS so we close modal there
if (isAndroid) {
(args.object as View).closeModal();
diff --git a/tests/app/ui/page/modal-tab-root.ts b/tests/app/ui/page/modal-tab-root.ts
index 20b26a0ef..608ea7c6a 100644
--- a/tests/app/ui/page/modal-tab-root.ts
+++ b/tests/app/ui/page/modal-tab-root.ts
@@ -1,8 +1,8 @@
import { ShownModallyData } from "tns-core-modules/ui/core/view";
import { TabView } from "tns-core-modules/ui/tab-view/tab-view";
-import * as TKUnit from "../../TKUnit";
-import { stack } from "tns-core-modules/ui/frame";
-import { isIOS } from "tns-core-modules/platform"
+import * as TKUnit from "../../tk-unit";
+import { _stack } from "tns-core-modules/ui/frame";
+import { isIOS } from "tns-core-modules/platform";
export function onShownModally(args: ShownModallyData) {
const tabView = args.object;
@@ -11,7 +11,7 @@ export function onShownModally(args: ShownModallyData) {
args.context.shownModally = true;
}
- const hostFrame = stack()[0];
+ const hostFrame = _stack()[0];
TKUnit.assertNotNull(hostFrame, "Host frame should not be null");
TKUnit.assertEqual(hostFrame.currentPage.modal, tabView, "hostFrame.currentPage.modal should be equal to the tabView instance on tabView.shownModally event handler.");
@@ -19,4 +19,4 @@ export function onShownModally(args: ShownModallyData) {
if (isIOS) {
args.closeCallback("return value");
}
-}
\ No newline at end of file
+}
diff --git a/tests/app/ui/page/page-tests-common.ts b/tests/app/ui/page/page-tests-common.ts
index 8f9f2da17..02e1286d5 100644
--- a/tests/app/ui/page/page-tests-common.ts
+++ b/tests/app/ui/page/page-tests-common.ts
@@ -14,11 +14,11 @@ function pageLoaded(args) {
}
exports.pageLoaded = pageLoaded;
// << article-set-bindingcontext
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
import { View, PercentLength, unsetValue, EventData, isIOS } from "tns-core-modules/ui/core/view";
-import { Frame, stack } from "tns-core-modules/ui/frame";
+import { Frame, _stack } from "tns-core-modules/ui/frame";
import { Label } from "tns-core-modules/ui/label";
import { Color } from "tns-core-modules/color";
import { TabView, TabViewItem } from "tns-core-modules/ui/tab-view/tab-view";
@@ -49,6 +49,7 @@ export function test_AfterPageLoaded_is_called_NativeInstance_is_created() {
label = new Label();
label.text = "Text";
page.content = label;
+
return page;
};
@@ -66,12 +67,13 @@ export function test_PageLoaded_is_called_once() {
let loaded = 0;
const handler = function (data) {
loaded++;
- }
+ };
const pageFactory = function (): Page {
page1 = new Page();
page1.id = `page1_test_PageLoaded_is_called_once`;
addLabelToPage(page1, "Page 1");
+
return page1;
};
@@ -83,6 +85,7 @@ export function test_PageLoaded_is_called_once() {
page2.id = `page2_test_PageLoaded_is_called_once`;
addLabelToPage(page2, "Page 2");
page2.on(Label.loadedEvent, handler);
+
return page2;
};
@@ -96,7 +99,6 @@ export function test_NavigateToNewPage() {
// >> article-create-navigate-to-page
const topFrame = topmost();
- const currentPage = topFrame.currentPage;
let testPage: Page;
const pageFactory = function (): Page {
@@ -104,6 +106,7 @@ export function test_NavigateToNewPage() {
const label = new Label();
label.text = "The quick brown fox jumps over the lazy dog.";
testPage.content = label;
+
return testPage;
};
@@ -187,7 +190,7 @@ function _test_PageNavigation_EventSequence(withTransition: boolean) {
name: "slide",
duration: 10,
} : undefined
- }
+ };
helper.navigateWithEntry(navigationEntry);
helper.goBack();
@@ -197,7 +200,6 @@ function _test_PageNavigation_EventSequence(withTransition: boolean) {
}
export function test_NavigateTo_WithContext() {
- const currentPage = topmost().currentPage;
// >> article-pass-data
let testPage: Page;
const pageFactory = function (): Page {
@@ -205,6 +207,7 @@ export function test_NavigateTo_WithContext() {
testPage.on(Page.navigatedToEvent, function () {
//console.log(JSON.stringify(context));
});
+
return testPage;
};
@@ -228,7 +231,6 @@ export function test_NavigateTo_WithContext() {
//https://github.com/NativeScript/NativeScript/issues/731
export function test_NavigateTo_WithBindingContext() {
- const currentPage = topmost().currentPage;
let testPage: Page;
let bindingContext;
const pageFactory = function (): Page {
@@ -236,6 +238,7 @@ export function test_NavigateTo_WithBindingContext() {
testPage.on(Page.navigatingToEvent, function (args: NavigatedData) {
bindingContext = (args.object).bindingContext;
});
+
return testPage;
};
@@ -260,6 +263,7 @@ export function test_FrameBackStack_WhenNavigatingForwardAndBack() {
testPage = new Page();
testPage.id = "testPage_test_FrameBackStack_WhenNavigatingForwardAndBack";
addLabelToPage(testPage);
+
return testPage;
};
@@ -286,9 +290,10 @@ export function test_LoadPageFromModule() {
export function test_LoadPageFromDeclarativeWithCSS() {
const topFrame = topmost();
- helper.navigateToModule("ui/page/test-page-declarative-css");
+ helper.navigateToModule("ui/page/test-declarative-css-page");
TKUnit.assert(topFrame.currentPage.content instanceof Label, "Content of the test page should be a Label created within test-page-module-css.");
+
const testLabel = topFrame.currentPage.content;
TKUnit.assertEqual(testLabel.text, "Label created within a page declarative file with css.");
TKUnit.assertEqual(testLabel.style.backgroundColor.hex, "#00FF00");
@@ -296,9 +301,11 @@ export function test_LoadPageFromDeclarativeWithCSS() {
export function test_LoadPageFromModuleWithCSS() {
const topFrame = topmost();
- helper.navigateToModule("ui/page/test-page-module-css");
+
+ helper.navigateToModule("ui/page/test-module-css-page");
TKUnit.assert(topFrame.currentPage.content instanceof Label, "Content of the test page should be a Label created within test-page-module-css.");
+
const testLabel = topFrame.currentPage.content;
TKUnit.assertEqual(testLabel.text, "Label created within a page module css.");
TKUnit.assertEqual(testLabel.style.backgroundColor.hex, "#00FF00");
@@ -311,6 +318,7 @@ export function test_NavigateToPageCreatedWithNavigationEntry() {
testPage = new Page();
testPage.id = "testPage_test_NavigateToPageCreatedWithNavigationEntry";
addLabelToPage(testPage, expectedText);
+
return testPage;
};
@@ -385,7 +393,7 @@ export function test_WhenPageIsLoadedFrameCurrentPageIsNotYetTheSameAsThePage()
let page: Page;
const loadedEventHandler = function (args) {
TKUnit.assertNotEqual(topmost().currentPage, args.object, "When a page is loaded it should not yet be the current page.");
- }
+ };
const pageFactory = function (): Page {
page = new Page();
@@ -394,6 +402,7 @@ export function test_WhenPageIsLoadedFrameCurrentPageIsNotYetTheSameAsThePage()
const label = new Label();
label.text = "Text";
page.content = label;
+
return page;
};
@@ -405,7 +414,7 @@ export function test_WhenPageIsNavigatedToFrameCurrentPageIsNowTheSameAsThePage(
let page: Page;
const navigatedEventHandler = function (args) {
TKUnit.assertEqual(topmost().currentPage, args.object, `frame.topmost().currentPage should be equal to args.object page instance in the page.navigatedTo event handler. Expected: ${args.object.id}; Actual: ${topmost().currentPage.id};`);
- }
+ };
const pageFactory = function (): Page {
page = new Page();
@@ -414,6 +423,7 @@ export function test_WhenPageIsNavigatedToFrameCurrentPageIsNowTheSameAsThePage(
const label = new Label();
label.text = "Text";
page.content = label;
+
return page;
};
@@ -425,6 +435,7 @@ export function test_WhenInnerViewCallsCloseModal_WithArguments_ShouldPassResult
_test_WhenInnerViewCallsCloseModal((args: ShownModallyData) => {
const page = args.object;
const button = page.content;
+
return button.closeModal.bind(button);
}, "return value");
}
@@ -433,6 +444,7 @@ export function test_WhenInnerViewCallsCloseModal_WithoutArguments_ShouldWork()
_test_WhenInnerViewCallsCloseModal((args: ShownModallyData) => {
const page = args.object;
const button = page.content;
+
return button.closeModal.bind(button);
});
}
@@ -454,14 +466,14 @@ function _test_WhenInnerViewCallsCloseModal(closeModalGetter: (ShownModallyData)
const modalCloseCallback = function (returnValue: any) {
modalClosedWithResult = returnValue === result;
- }
+ };
const modalPageShownModallyEventHandler = function (args: ShownModallyData) {
const page = args.object;
page.off(View.shownModallyEvent, modalPageShownModallyEventHandler);
closeModalGetter(args)(result);
- }
+ };
const hostNavigatedToEventHandler = function (args: NavigatedData) {
const page = args.object;
@@ -475,13 +487,13 @@ function _test_WhenInnerViewCallsCloseModal(closeModalGetter: (ShownModallyData)
button.text = "CLOSE MODAL";
modalPage.content = button;
- (page.content).showModal(modalPage, {}, modalCloseCallback);
- }
+ (page.content).showModal(modalPage, { context: {}, closeCallback: modalCloseCallback });
+ };
const masterPageFactory = function (): Page {
const masterPage = new Page();
masterPage.id = "masterPage_test_WhenInnerViewCallsCloseModal_WithArguments_ShouldPassResult";
- masterPage.on(Page.navigatedToEvent, hostNavigatedToEventHandler)
+ masterPage.on(Page.navigatedToEvent, hostNavigatedToEventHandler);
const button = new Button();
button.text = "TAP";
@@ -505,7 +517,7 @@ export function test_WhenViewBaseCallsShowModal_WithArguments_ShouldOpenModal()
const modalCloseCallback = function (returnValue: any) {
modalClosed = true;
- }
+ };
const createTabItems = function (count: number) {
var items = new Array();
@@ -521,13 +533,13 @@ export function test_WhenViewBaseCallsShowModal_WithArguments_ShouldOpenModal()
}
return items;
- }
+ };
const modalPageShownModallyEventHandler = function (args: ShownModallyData) {
const page = args.object;
page.off(View.shownModallyEvent, modalPageShownModallyEventHandler);
args.closeCallback();
- }
+ };
const hostNavigatedToEventHandler = function (args) {
const page = args.object;
@@ -537,13 +549,18 @@ export function test_WhenViewBaseCallsShowModal_WithArguments_ShouldOpenModal()
modalPage.id = "modalPage_test_WhenViewBaseCallsShowModal_WithArguments_ShouldOpenModal";
modalPage.on(View.shownModallyEvent, modalPageShownModallyEventHandler);
const tabViewItem = (page.content).items[0];
- tabViewItem.showModal(modalPage, {}, modalCloseCallback, false, false);
- }
+ tabViewItem.showModal(modalPage, {
+ context: {},
+ closeCallback: modalCloseCallback,
+ fullscreen: false,
+ animated: false
+ });
+ };
const masterPageFactory = function (): Page {
const masterPage = new Page();
masterPage.id = "masterPage_test_WhenViewBaseCallsShowModal_WithArguments_ShouldOpenModal";
- masterPage.on(Page.navigatedToEvent, hostNavigatedToEventHandler)
+ masterPage.on(Page.navigatedToEvent, hostNavigatedToEventHandler);
const tabView = new TabView();
tabView.items = createTabItems(2);
@@ -567,7 +584,7 @@ export function test_WhenViewBaseCallsShowModal_WithShowModalOptionsArguments_Sh
const modalCloseCallback = function (returnValue: any) {
modalClosed = true;
- }
+ };
const createTabItems = function (count: number) {
var items = new Array();
@@ -583,13 +600,13 @@ export function test_WhenViewBaseCallsShowModal_WithShowModalOptionsArguments_Sh
}
return items;
- }
+ };
const modalPageShownModallyEventHandler = function (args: ShownModallyData) {
const page = args.object;
page.off(View.shownModallyEvent, modalPageShownModallyEventHandler);
args.closeCallback();
- }
+ };
const hostNavigatedToEventHandler = function (args) {
const page = args.object;
@@ -605,12 +622,12 @@ export function test_WhenViewBaseCallsShowModal_WithShowModalOptionsArguments_Sh
fullscreen: false,
animated: false
});
- }
+ };
const masterPageFactory = function (): Page {
const masterPage = new Page();
masterPage.id = "masterPage_test_WhenViewBaseCallsShowModal_WithShowModalOptionsArguments_ShouldOpenModal";
- masterPage.on(Page.navigatedToEvent, hostNavigatedToEventHandler)
+ masterPage.on(Page.navigatedToEvent, hostNavigatedToEventHandler);
const tabView = new TabView();
tabView.items = createTabItems(2);
@@ -642,27 +659,26 @@ export function test_WhenViewBaseCallsShowModal_WithoutArguments_ShouldThrow() {
}
return items;
- }
+ };
const hostNavigatedToEventHandler = function (args) {
const page = args.object;
page.off(Page.navigatedToEvent, hostNavigatedToEventHandler);
- const hostPage = args.object;
const tabViewItem = (page.content).items[0];
try {
- tabViewItem.showModal();
+ (tabViewItem).showModal();
} catch (e) {
modalThrows = true;
}
navigatedTo = true;
- }
+ };
const masterPageFactory = function (): Page {
const masterPage = new Page();
masterPage.id = "masterPage_test_WhenViewBaseCallsShowModal_WithoutArguments_ShouldThrow";
- masterPage.on(Page.navigatedToEvent, hostNavigatedToEventHandler)
+ masterPage.on(Page.navigatedToEvent, hostNavigatedToEventHandler);
const tabView = new TabView();
tabView.items = createTabItems(2);
@@ -689,12 +705,13 @@ export function test_WhenNavigatingForwardAndBack_IsBackNavigationIsCorrect() {
} else {
forwardCounter++;
}
- }
+ };
const pageFactory1 = function (): Page {
page1 = new Page();
page1.id = "page1_test_WhenNavigatingForwardAndBack_IsBackNavigationIsCorrect";
page1.on(Page.navigatedToEvent, navigatedEventHandler);
+
return page1;
};
@@ -702,6 +719,7 @@ export function test_WhenNavigatingForwardAndBack_IsBackNavigationIsCorrect() {
page2 = new Page();
page2.id = "page2_test_WhenNavigatingForwardAndBack_IsBackNavigationIsCorrect";
page2.on(Page.navigatedToEvent, navigatedEventHandler);
+
return page2;
};
@@ -723,7 +741,7 @@ export function test_WhenRootTabViewShownModallyItCanCloseModal() {
const modalCloseCallback = function (returnValue: any) {
modalClosed = true;
- }
+ };
const createTabItems = function (count: number) {
var items = new Array();
@@ -739,11 +757,11 @@ export function test_WhenRootTabViewShownModallyItCanCloseModal() {
}
return items;
- }
+ };
const tabViewShownModallyEventHandler = function (args: ShownModallyData) {
args.closeCallback("return value");
- }
+ };
const hostNavigatedToEventHandler = function (args) {
const page = args.object;
@@ -753,8 +771,13 @@ export function test_WhenRootTabViewShownModallyItCanCloseModal() {
tabView.items = createTabItems(2);
tabView.on(View.shownModallyEvent, tabViewShownModallyEventHandler);
- page.showModal(tabView, {}, modalCloseCallback, false, false);
- }
+ page.showModal(tabView, {
+ context: {},
+ closeCallback: modalCloseCallback,
+ fullscreen: false,
+ animated: false
+ });
+ };
const masterPageFactory = function (): Page {
const masterPage = new Page();
@@ -764,6 +787,7 @@ export function test_WhenRootTabViewShownModallyItCanCloseModal() {
const label = new Label();
label.text = "Text";
masterPage.content = label;
+
return masterPage;
};
@@ -797,7 +821,7 @@ export function test_WhenPageIsNavigatedToItCanShowAnotherPageAsModal() {
TKUnit.assertEqual(returnValue, "return value", "Modal-page must return value!");
modalClosed = true;
TKUnit.assertNull(masterPage.modal, "currentPage.modal should be undefined when no modal page is shown!");
- }
+ };
let modalPage: Page;
let shownModally = 0;
@@ -805,19 +829,19 @@ export function test_WhenPageIsNavigatedToItCanShowAnotherPageAsModal() {
const onShownModal = function (args: ShownModallyData) {
shownModally++;
modalPage.off(Page.shownModallyEvent, onShownModal);
- }
+ };
let modalLoaded = 0;
const onModalLoaded = function (args: EventData) {
modalLoaded++;
modalPage.off(Page.loadedEvent, onModalLoaded);
- }
+ };
let modalUnloaded = 0;
const onModalUnloaded = function (args: EventData) {
modalUnloaded++;
modalPage.off(Page.unloadedEvent, onModalUnloaded);
- }
+ };
const navigatedToEventHandler = function (args) {
const page = args.object;
@@ -832,7 +856,13 @@ export function test_WhenPageIsNavigatedToItCanShowAnotherPageAsModal() {
modalPage.on(Page.loadedEvent, onModalLoaded);
modalPage.on(Page.unloadedEvent, onModalUnloaded);
- page.showModal(modalPage, ctx, modalCloseCallback, false, false);
+ page.showModal(modalPage, {
+ context: ctx,
+ closeCallback: modalCloseCallback,
+ fullscreen: false,
+ animated: false
+ });
+
TKUnit.assertTrue((modalPage).showingModally, "showingModally");
};
@@ -843,6 +873,7 @@ export function test_WhenPageIsNavigatedToItCanShowAnotherPageAsModal() {
const label = new Label();
label.text = "Text";
masterPage.content = label;
+
return masterPage;
};
@@ -870,9 +901,9 @@ export function test_WhenModalPageShownHostPageNavigationEventsShouldNotBeRaised
let ready = false;
const modalCloseCallback = function (returnValue: any) {
- TKUnit.assertEqual(stack().length, 1, "Single frame should be instantiated at this point!");
+ TKUnit.assertEqual(_stack().length, 1, "Single frame should be instantiated at this point!");
ready = true;
- }
+ };
const hostNavigatingToEventHandler = function () {
hostNavigatingToCount++;
@@ -891,8 +922,8 @@ export function test_WhenModalPageShownHostPageNavigationEventsShouldNotBeRaised
};
const modalPageShownModallyEventHandler = function () {
- TKUnit.assertEqual(stack().length, 1, "Single frame should be instantiated at this point!");
- }
+ TKUnit.assertEqual(_stack().length, 1, "Single frame should be instantiated at this point!");
+ };
const hostNavigatedToEventHandler2 = function (args: NavigatedData) {
const page = args.object;
@@ -903,13 +934,18 @@ export function test_WhenModalPageShownHostPageNavigationEventsShouldNotBeRaised
moduleName: basePath + "modal-page"
};
- TKUnit.assertEqual(stack().length, 1, "Single frame should be instantiated at this point!");
+ TKUnit.assertEqual(_stack().length, 1, "Single frame should be instantiated at this point!");
const modalPage = createViewFromEntry(entry) as Page;
modalPage.on(Frame.shownModallyEvent, modalPageShownModallyEventHandler);
- page.showModal(modalPage, {}, modalCloseCallback, false, false);
- }
+ page.showModal(modalPage, {
+ context: {},
+ closeCallback: modalCloseCallback,
+ fullscreen: false,
+ animated: false
+ });
+ };
const masterPageFactory = function (): Page {
const masterPage = new Page();
@@ -923,6 +959,7 @@ export function test_WhenModalPageShownHostPageNavigationEventsShouldNotBeRaised
const label = new Label();
label.text = "Text";
masterPage.content = label;
+
return masterPage;
};
@@ -953,7 +990,7 @@ export function test_WhenModalPageShownModalNavigationToEventsShouldBeRaised() {
const modalCloseCallback = function (returnValue: any) {
ready = true;
- }
+ };
const modalNavigatingToEventHandler = function () {
modalNavigatingToCount++;
@@ -986,7 +1023,7 @@ export function test_WhenModalPageShownModalNavigationToEventsShouldBeRaised() {
modalPage.on(Page.navigatedFromEvent, modalNavigatedFromEventHandler);
(args.object as Frame).navigate(() => modalPage);
- }
+ };
let modalFrame;
@@ -997,8 +1034,13 @@ export function test_WhenModalPageShownModalNavigationToEventsShouldBeRaised() {
modalFrame = new Frame();
modalFrame.on(Frame.shownModallyEvent, modalFrameShownModallyEventHandler);
- page.showModal(modalFrame, {}, modalCloseCallback, false, false);
- }
+ page.showModal(modalFrame, {
+ context: {},
+ closeCallback: modalCloseCallback,
+ fullscreen: false,
+ animated: false
+ });
+ };
const masterPageFactory = function (): Page {
const masterPage = new Page();
@@ -1008,6 +1050,7 @@ export function test_WhenModalPageShownModalNavigationToEventsShouldBeRaised() {
const label = new Label();
label.text = "Text";
masterPage.content = label;
+
return masterPage;
};
@@ -1035,20 +1078,20 @@ export function test_WhenModalFrameShownModalEventsRaisedOnRootModalFrame() {
let ready = false;
const modalCloseCallback = function (returnValue: any) {
- TKUnit.assertEqual(stack().length, 1, "Single frame should be instantiated at this point!");
+ TKUnit.assertEqual(_stack().length, 1, "Single frame should be instantiated at this point!");
ready = true;
- }
+ };
const modalFrameShowingModallyEventHandler = function (args: ShownModallyData) {
showingModallyCount++;
- }
+ };
const modalFrameShownModallyEventHandler = function (args: ShownModallyData) {
shownModallyCount++;
- TKUnit.assertEqual(stack().length, 2, "Host and modal frame should be instantiated at this point!");
+ TKUnit.assertEqual(_stack().length, 2, "Host and modal frame should be instantiated at this point!");
args.closeCallback("return value");
- }
+ };
let modalFrame;
@@ -1063,17 +1106,22 @@ export function test_WhenModalFrameShownModalEventsRaisedOnRootModalFrame() {
const modalPage = createViewFromEntry(entry) as Page;
- TKUnit.assertEqual(stack().length, 1, "Single frame should be instantiated at this point!");
+ TKUnit.assertEqual(_stack().length, 1, "Single frame should be instantiated at this point!");
modalFrame = new Frame();
modalFrame.on(Frame.showingModallyEvent, modalFrameShowingModallyEventHandler);
modalFrame.on(Frame.shownModallyEvent, modalFrameShownModallyEventHandler);
modalFrame.navigate(() => modalPage);
- TKUnit.assertEqual(stack().length, 2, "Host and modal frame should be instantiated at this point!");
+ TKUnit.assertEqual(_stack().length, 2, "Host and modal frame should be instantiated at this point!");
- page.showModal(modalFrame, {}, modalCloseCallback, false, false);
- }
+ page.showModal(modalFrame, {
+ context: {},
+ closeCallback: modalCloseCallback,
+ fullscreen: false,
+ animated: false
+ });
+ };
const masterPageFactory = function (): Page {
const masterPage = new Page();
@@ -1083,6 +1131,7 @@ export function test_WhenModalFrameShownModalEventsRaisedOnRootModalFrame() {
const label = new Label();
label.text = "Text";
masterPage.content = label;
+
return masterPage;
};
@@ -1107,11 +1156,11 @@ export function test_WhenModalPageShownShowModalEventsRaisedOnRootModalPage() {
const modalCloseCallback = function (returnValue: any) {
ready = true;
- }
+ };
const modalPageShowingModallyEventHandler = function (args: ShownModallyData) {
showingModallyCount++;
- }
+ };
const modalPageShownModallyEventHandler = function (args: ShownModallyData) {
shownModallyCount++;
@@ -1119,7 +1168,7 @@ export function test_WhenModalPageShownShowModalEventsRaisedOnRootModalPage() {
setTimeout(() => {
args.closeCallback("return value");
}, 0);
- }
+ };
const hostNavigatedToEventHandler = function (args) {
const page = args.object;
@@ -1134,8 +1183,13 @@ export function test_WhenModalPageShownShowModalEventsRaisedOnRootModalPage() {
modalPage.on(Page.showingModallyEvent, modalPageShowingModallyEventHandler);
modalPage.on(Page.shownModallyEvent, modalPageShownModallyEventHandler);
- page.showModal(modalPage, {}, modalCloseCallback, false, false);
- }
+ page.showModal(modalPage, {
+ context: {},
+ closeCallback: modalCloseCallback,
+ fullscreen: false,
+ animated: false
+ });
+ };
const masterPageFactory = function (): Page {
const masterPage = new Page();
@@ -1145,6 +1199,7 @@ export function test_WhenModalPageShownShowModalEventsRaisedOnRootModalPage() {
const label = new Label();
label.text = "Text";
masterPage.content = label;
+
return masterPage;
};
@@ -1168,17 +1223,17 @@ export function test_WhenModalPageShownShowModalEventsRaisedOnRootModalTabView()
let ready = false;
const modalCloseCallback = function (returnValue: any) {
- TKUnit.assertEqual(stack().length, 1, "Single host frame should be instantiated at this point!");
+ TKUnit.assertEqual(_stack().length, 1, "Single host frame should be instantiated at this point!");
setTimeout(() => ready = true, 50);
- }
+ };
const modalTabViewShowingModallyEventHandler = function (args: ShownModallyData) {
showingModallyCount++;
- }
+ };
const modalTabViewShownModallyEventHandler = function (args: ShownModallyData) {
shownModallyCount++;
- }
+ };
const hostNavigatedToEventHandler = function (args) {
const page = args.object;
@@ -1189,16 +1244,21 @@ export function test_WhenModalPageShownShowModalEventsRaisedOnRootModalTabView()
moduleName: basePath + "modal-tab-root"
};
- TKUnit.assertEqual(stack().length, 1, "Single host frame should be instantiated at this point!");
+ TKUnit.assertEqual(_stack().length, 1, "Single host frame should be instantiated at this point!");
const modalTabView = createViewFromEntry(entry) as TabView;
modalTabView.on(TabView.showingModallyEvent, modalTabViewShowingModallyEventHandler);
modalTabView.on(TabView.shownModallyEvent, modalTabViewShownModallyEventHandler);
- TKUnit.assertEqual(stack().length, 2, "Host and tab modal frame should be instantiated at this point!");
+ TKUnit.assertEqual(_stack().length, 2, "Host and tab modal frame should be instantiated at this point!");
- page.showModal(modalTabView, {}, modalCloseCallback, false, false);
- }
+ page.showModal(modalTabView, {
+ context: {},
+ closeCallback: modalCloseCallback,
+ fullscreen: false,
+ animated: false
+ });
+ };
const masterPageFactory = function (): Page {
const masterPage = new Page();
@@ -1208,14 +1268,15 @@ export function test_WhenModalPageShownShowModalEventsRaisedOnRootModalTabView()
const label = new Label();
label.text = "Text";
masterPage.content = label;
+
return masterPage;
};
- TKUnit.assertEqual(stack().length, 1, "Single host frame should be instantiated at this point!");
+ TKUnit.assertEqual(_stack().length, 1, "Single host frame should be instantiated at this point!");
helper.navigate(masterPageFactory);
- TKUnit.assertEqual(stack().length, 2, "Host and modal tab frame should be instantiated at this point!");
+ TKUnit.assertEqual(_stack().length, 2, "Host and modal tab frame should be instantiated at this point!");
TKUnit.waitUntilReady(() => ready);
@@ -1224,7 +1285,7 @@ export function test_WhenModalPageShownShowModalEventsRaisedOnRootModalTabView()
TKUnit.waitUntilReady(() => !(topmost().currentPage.viewController).presentedViewController);
}
- TKUnit.assertEqual(stack().length, 1, "Single host frame should be instantiated at this point!");
+ TKUnit.assertEqual(_stack().length, 1, "Single host frame should be instantiated at this point!");
TKUnit.assertTrue(showingModallyCount === 1);
TKUnit.assertTrue(shownModallyCount === 1);
@@ -1241,7 +1302,7 @@ export function test_percent_width_and_height_support() {
testPage.content = stackLayout;
const pageWidth = testPage.getMeasuredWidth();
- const pageHeight = testPage.getMeasuredHeight()
+ const pageHeight = testPage.getMeasuredHeight();
TKUnit.assertEqual(pageWidth, Math.round(pageWidth / 2), "Current page MeasuredWidth incorrect");
TKUnit.assertEqual(pageHeight, Math.round(pageHeight / 2), "Current page MeasuredHeight incorrect");
diff --git a/tests/app/ui/page/page-tests.android.ts b/tests/app/ui/page/page-tests.android.ts
index d95386d5c..0edb1499d 100644
--- a/tests/app/ui/page/page-tests.android.ts
+++ b/tests/app/ui/page/page-tests.android.ts
@@ -1,17 +1,18 @@
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
-import * as PageTestCommon from "./page-tests-common";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
+import { addLabelToPage } from "./page-tests-common";
import { Page } from "tns-core-modules/ui/page";
import { Label } from "tns-core-modules/ui/label";
import { topmost } from "tns-core-modules/ui/frame";
-global.moduleMerge(PageTestCommon, exports);
+export * from "./page-tests-common";
export function test_NavigateToNewPage_WithAndroidCache() {
// Clear history if any.
helper.navigate(() => {
const launchPage = new Page();
launchPage.id = "launchPage_test_NavigateToNewPage_WithAndroidCache";
+
return launchPage;
});
@@ -26,20 +27,14 @@ export function test_NavigateToNewPage_WithAndroidCache() {
label = new Label();
label.text = "The quick brown fox jumps over the lazy dog.";
testPage.content = label;
+
return testPage;
};
- const androidFrame = topmost().android;
- const cachingBefore = androidFrame.cachePagesOnNavigate;
- try {
- const currentPage = topmost().currentPage;
- androidFrame.cachePagesOnNavigate = true;
- helper.navigateWithHistory(pageFactory);
- TKUnit.assertNotNull(currentPage.nativeView);
- helper.goBack();
- } finally {
- androidFrame.cachePagesOnNavigate = cachingBefore;
- }
+ const currentPage = topmost().currentPage;
+ helper.navigateWithHistory(pageFactory);
+ TKUnit.assertNotNull(currentPage.nativeView);
+ helper.goBack();
TKUnit.assertNull(testPage.parent, "Page.parent should become undefined after navigating back");
TKUnit.assertFalse(testPage.isLoaded, "Page.isLoaded should become false after navigating back");
@@ -58,7 +53,8 @@ export function test_NavigateToNewPage_InnerControl() {
const pageFactory = function () {
testPage = new Page();
testPage.id = "testPage_test_NavigateToNewPage_InnerControl";
- PageTestCommon.addLabelToPage(testPage);
+ addLabelToPage(testPage);
+
return testPage;
};
@@ -77,27 +73,18 @@ export function test_SetPageCaching_ToTheSameValue_AfterNavigated_DoesNotThrow()
const pageFactory = function () {
const testPage = new Page();
testPage.id = "testPage_test_SetPageCaching_ToTheSameValue_AfterNavigated_DoesNotThrow";
+
return testPage;
};
- const androidFrame = topmost().android;
- const cachingBefore = androidFrame.cachePagesOnNavigate;
-
helper.navigate(pageFactory);
-
- try {
- // Set caching to same value.
- androidFrame.cachePagesOnNavigate = cachingBefore;
- }
- finally {
- androidFrame.cachePagesOnNavigate = cachingBefore;
- }
}
-export var test_Resolve_Fragment_ForPage = function () {
+export function test_Resolve_Fragment_ForPage() {
let testPage: Page;
const pageFactory = () => {
testPage = new Page();
+
return testPage;
};
@@ -107,4 +94,4 @@ export var test_Resolve_Fragment_ForPage = function () {
const fragment = frame.android.fragmentForPage(frame._currentEntry);
TKUnit.assertNotNull(fragment, "Failed to resolve native fragment for page");
-}
\ No newline at end of file
+}
diff --git a/tests/app/ui/page/page-tests.ios.ts b/tests/app/ui/page/page-tests.ios.ts
index 34bbed8b6..3be99e136 100644
--- a/tests/app/ui/page/page-tests.ios.ts
+++ b/tests/app/ui/page/page-tests.ios.ts
@@ -1,20 +1,18 @@
-import { TabView, TabViewItem } from "tns-core-modules/ui/tab-view";
-import { Page, layout, View, EventData } from "tns-core-modules/ui/page";
-import { ios as iosView } from "tns-core-modules/ui/core/view";
+ import { Page, View, EventData } from "tns-core-modules/ui/page";
import { Label } from "tns-core-modules/ui/label";
import { topmost } from "tns-core-modules/ui/frame";
-import * as uiUtils from "tns-core-modules/ui/utils";
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
-import * as PageTestCommon from "./page-tests-common";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
+import { addLabelToPage } from "./page-tests-common";
-global.moduleMerge(PageTestCommon, exports);
+export * from "./page-tests-common";
export function test_NavigateToNewPage_InnerControl() {
var testPage: Page;
var pageFactory = function (): Page {
testPage = new Page();
- PageTestCommon.addLabelToPage(testPage);
+ addLabelToPage(testPage);
+
return testPage;
};
@@ -37,11 +35,10 @@ export function test_WhenShowingModalPageUnloadedIsNotFiredForTheMasterPage() {
let onModalUnloaded = function (args: EventData) {
modalUnloaded++;
modalPage.off(Page.unloadedEvent, onModalUnloaded);
- }
+ };
var navigatedToEventHandler = function (args) {
- var basePath = "ui/page/";
- modalPage = masterPage.showModal(basePath + "modal-page", null, null, false) as Page;
+ modalPage = masterPage.showModal("ui/page/modal-page", { context: null, closeCallback: null, fullscreen: false }) as Page;
modalPage.on(Page.unloadedEvent, onModalUnloaded);
};
@@ -57,6 +54,7 @@ export function test_WhenShowingModalPageUnloadedIsNotFiredForTheMasterPage() {
var label = new Label();
label.text = "Modal Page";
masterPage.content = label;
+
return masterPage;
};
@@ -67,15 +65,15 @@ export function test_WhenShowingModalPageUnloadedIsNotFiredForTheMasterPage() {
masterPage.off(View.unloadedEvent, unloadedEventHandler);
}
-function getHeight(view: View): number {
- const bounds = view._getCurrentLayoutBounds();
- return bounds.bottom - bounds.top;
-}
+// function getHeight(view: View): number {
+// const bounds = view._getCurrentLayoutBounds();
+// return bounds.bottom - bounds.top;
+// }
-function getNativeHeight(view: View): number {
- const bounds = view.nativeViewProtected.frame;
- return layout.toDevicePixels(bounds.size.height);
-}
+// function getNativeHeight(view: View): number {
+// const bounds = view.nativeViewProtected.frame;
+// return layout.toDevicePixels(bounds.size.height);
+// }
// export function test_correct_layout_top_bottom_edges_does_not_span_not_scrollable_not_flat() {
// test_correct_layout_top_bottom_edges_does_not_span_options(false, false);
@@ -307,7 +305,7 @@ function getNativeHeight(view: View): number {
// tabItem.view = lbl;
// tabView.items = [tabItem];
// page.content = tabView;
-
+
// helper.navigate(() => page);
// TKUnit.assertTrue(page.isLoaded, "page NOT loaded!");
// TKUnit.assertNotNull(lbl.viewController);
@@ -405,4 +403,4 @@ export function test_showing_native_viewcontroller_doesnt_throw_exception() {
TKUnit.assertEqual(0, navigatingFrom, "navigatingTo");
TKUnit.assertEqual(0, unloaded, "navigatingTo");
TKUnit.assertEqual(0, navigatedFrom, "navigatingTo");
-}
\ No newline at end of file
+}
diff --git a/tests/app/ui/page/test-page-declarative-css.css b/tests/app/ui/page/test-declarative-css-page.css
similarity index 100%
rename from tests/app/ui/page/test-page-declarative-css.css
rename to tests/app/ui/page/test-declarative-css-page.css
diff --git a/tests/app/ui/page/test-page-declarative-css.xml b/tests/app/ui/page/test-declarative-css-page.xml
similarity index 100%
rename from tests/app/ui/page/test-page-declarative-css.xml
rename to tests/app/ui/page/test-declarative-css-page.xml
diff --git a/tests/app/ui/page/test-page-module-css.css b/tests/app/ui/page/test-module-css-page.css
similarity index 100%
rename from tests/app/ui/page/test-page-module-css.css
rename to tests/app/ui/page/test-module-css-page.css
diff --git a/tests/app/ui/page/test-page-module-css.ts b/tests/app/ui/page/test-module-css-page.ts
similarity index 100%
rename from tests/app/ui/page/test-page-module-css.ts
rename to tests/app/ui/page/test-module-css-page.ts
diff --git a/tests/app/ui/placeholder/placeholder-tests.ts b/tests/app/ui/placeholder/placeholder-tests.ts
index efe1eee04..724a8e6fe 100644
--- a/tests/app/ui/placeholder/placeholder-tests.ts
+++ b/tests/app/ui/placeholder/placeholder-tests.ts
@@ -1,8 +1,8 @@
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
// >> article-creating-view
import { isIOS, isAndroid } from "tns-core-modules/platform";
import * as utils from "tns-core-modules/utils/utils";
-import * as helper from "../helper";
+import * as helper from "../../ui-helper";
import * as viewModule from "tns-core-modules/ui/core/view";
// >> article-require-placeholder-module
@@ -46,7 +46,7 @@ export function test_placeholder_creatingView() {
} else if (isAndroid) {
TKUnit.assert(p.nativeViewProtected instanceof android.widget.TextView, "Native view should be android.widget.TextView. Current value: " + p.nativeViewProtected);
}
- };
+ }
helper.buildUIAndRunTest(p, testAction);
}
@@ -60,7 +60,7 @@ export function test_placeholder_will_not_crash_wihout_creatingView() {
} else if (isAndroid) {
TKUnit.assert(p.android === undefined, "android view should be undefined. Current value: " + p.android);
}
- };
+ }
helper.buildUIAndRunTest(p, testAction);
}
\ No newline at end of file
diff --git a/tests/app/ui/progress/progress-tests.ts b/tests/app/ui/progress/progress-tests.ts
index 4ad5705a8..4559a7769 100644
--- a/tests/app/ui/progress/progress-tests.ts
+++ b/tests/app/ui/progress/progress-tests.ts
@@ -1,5 +1,5 @@
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import * as viewModule from "tns-core-modules/ui/core/view";
import * as observable from "tns-core-modules/data/observable";
import * as color from "tns-core-modules/color";
@@ -28,7 +28,7 @@ export function test_default_native_values() {
function testAction(views: Array) {
TKUnit.assertEqual(getNativeValue(progress), 0, "Default native progress.value");
TKUnit.assertEqual(getNativeMaxValue(progress), 100, "Default native progress.maxValue");
- };
+ }
helper.buildUIAndRunTest(progress, testAction);
}
@@ -39,7 +39,7 @@ export function test_set_TNS_value_updates_native_value() {
function testAction(views: Array) {
progress.value = 5;
TKUnit.assertAreClose(getNativeValue(progress), 5, 0.001, "Native value is different from TNS value.");
- };
+ }
helper.buildUIAndRunTest(progress, testAction);
}
@@ -51,7 +51,7 @@ export function test_set_value_greater_than_max_should_set_value_to_max() {
progress.maxValue = 10;
progress.value = 20;
TKUnit.assertEqual(progress.value, 10, "progress.value");
- };
+ }
helper.buildUIAndRunTest(progress, testAction);
}
@@ -64,10 +64,10 @@ if (platform.device.os === platform.platformNames.ios) {
function testAction(views: Array) {
TKUnit.assertEqual(progress.color.ios.CGColor, progress.ios.progressTintColor.CGColor, "progress.color");
- };
+ }
helper.buildUIAndRunTest(progress, testAction);
- }
+ };
exports.test_set_backgroundColor = function () {
var progress = new progressModule.Progress();
@@ -75,10 +75,10 @@ if (platform.device.os === platform.platformNames.ios) {
function testAction(views: Array) {
TKUnit.assertEqual((progress.backgroundColor).ios.CGColor, progress.ios.trackTintColor.CGColor, "progress.color");
- };
+ }
helper.buildUIAndRunTest(progress, testAction);
- }
+ };
}
export function test_set_maxValue_should_adjust_value() {
@@ -94,7 +94,7 @@ export function test_set_maxValue_should_adjust_value() {
TKUnit.assertEqual(progress.maxValue, 10, "progress.maxValue");
TKUnit.assertEqual(progress.value, 10, "progress.value");
- };
+ }
helper.buildUIAndRunTest(progress, testAction);
}
@@ -126,7 +126,7 @@ export function test_property_changed_event_when_setting_maxValue_with_adjust()
TKUnit.assert(changedProperties["maxValue"], "Property changed for 'maxValue' not called.");
TKUnit.assert(changedProperties["value"], "Property changed for 'value' not called.");
TKUnit.assertEqual(allChanges, 2, "Property changed callbacks.");
- };
+ }
helper.buildUIAndRunTest(progress, testAction);
}
diff --git a/tests/app/ui/proxy-view-container/proxy-view-container-tests.ts b/tests/app/ui/proxy-view-container/proxy-view-container-tests.ts
index ebbd1f834..7b7b70c7f 100644
--- a/tests/app/ui/proxy-view-container/proxy-view-container-tests.ts
+++ b/tests/app/ui/proxy-view-container/proxy-view-container-tests.ts
@@ -1,5 +1,5 @@
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import { View } from "tns-core-modules/ui/core/view";
import { Button } from "tns-core-modules/ui/button";
import { Page } from "tns-core-modules/ui/page";
@@ -24,7 +24,7 @@ export function test_add_children_to_attached_proxy() {
outer.addChild(createBtn("5"));
assertNativeChildren(outer, ["1", "2", "3", "4", "5"]);
- };
+ }
helper.buildUIAndRunTest(outer, testAction);
}
@@ -38,7 +38,7 @@ export function test_children_immediately_registered_in_parent_grid_layout() {
proxy.addChild(createBtn("1"));
assertNativeChildren(outer, ["1"]);
- };
+ }
helper.buildUIAndRunTest(outer, testAction);
}
@@ -53,7 +53,7 @@ export function test_children_registered_in_parent_grid_layout_on_attach() {
outer.addChild(proxy);
assertNativeChildren(outer, ["1"]);
- };
+ }
helper.buildUIAndRunTest(outer, testAction);
}
@@ -73,7 +73,7 @@ export function test_add_children_to_detached_proxy() {
outer.addChild(createBtn("5"));
assertNativeChildren(outer, ["1", "2", "3", "4", "5"]);
- };
+ }
helper.buildUIAndRunTest(outer, testAction);
}
@@ -95,7 +95,7 @@ export function test_remove_proxy() {
assertNativeChildren(outer, ["1", "2", "3", "4", "5"]);
outer.removeChild(proxy);
assertNativeChildren(outer, ["1", "5"]);
- };
+ }
helper.buildUIAndRunTest(outer, testAction);
}
@@ -118,7 +118,7 @@ export function test_remove_child_of_attached_proxy() {
assertNativeChildren(outer, ["1", "2", "3", "4", "5"]);
proxy.removeChild(testBtn);
assertNativeChildren(outer, ["1", "2", "4", "5"]);
- };
+ }
helper.buildUIAndRunTest(outer, testAction);
}
@@ -139,7 +139,7 @@ export function test_insert_inside_proxy() {
assertNativeChildren(outer, ["1", "2", "4", "5"]);
proxy.insertChild(createBtn("3"), 1);
assertNativeChildren(outer, ["1", "2", "3", "4", "5"]);
- };
+ }
helper.buildUIAndRunTest(outer, testAction);
}
@@ -159,7 +159,7 @@ export function test_insert_after_proxy() {
assertNativeChildren(outer, ["1", "2", "3", "4"]);
outer.insertChild(createBtn("5"), 2);
assertNativeChildren(outer, ["1", "2", "3", "4", "5"]);
- };
+ }
helper.buildUIAndRunTest(outer, testAction);
}
@@ -179,7 +179,7 @@ export function test_proxy_does_not_stop_request_layout_bubble() {
TKUnit.assert(outer.isLayoutValid, "outer container isLayoutValid should be true");
btn.requestLayout();
TKUnit.assertFalse(outer.isLayoutValid, "outer container isLayoutValid should be invalidated here");
- };
+ }
helper.buildUIAndRunTest(outer, testAction);
}
@@ -191,7 +191,7 @@ export function test_proxy_iniside_page() {
function testAction(views: Array) {
const page = views[1];
waitUntilElementLayoutIsValid(page);
- };
+ }
helper.buildUIAndRunTest(proxy, testAction);
}
@@ -206,7 +206,7 @@ export function test_proxy_inside_scroll_view() {
function testAction(views: Array) {
const page = views[1];
waitUntilElementLayoutIsValid(page);
- };
+ }
helper.buildUIAndRunTest(scroll, testAction);
}
@@ -221,7 +221,7 @@ export function test_proxy_inside_border() {
function testAction(views: Array) {
const page = views[1];
waitUntilElementLayoutIsValid(page);
- };
+ }
helper.buildUIAndRunTest(scroll, testAction);
}
@@ -240,7 +240,7 @@ export function test_proxy_inside_listview_itemTemplate_crash() {
function testAction(views: Array) {
const page = views[1];
waitUntilElementLayoutIsValid(page);
- };
+ }
helper.buildUIAndRunTest(list, testAction);
}
@@ -285,6 +285,7 @@ function waitUntilElementLayoutIsValid(view: View, timeoutSec?: number): void {
function createBtn(text: string): Button {
const b = new Button();
b.text = text;
+
return b;
}
diff --git a/tests/app/ui/repeater/repeater-safe-area-tests.ts b/tests/app/ui/repeater/repeater-safe-area-tests.ts
index e9c677006..ae123d294 100644
--- a/tests/app/ui/repeater/repeater-safe-area-tests.ts
+++ b/tests/app/ui/repeater/repeater-safe-area-tests.ts
@@ -1,16 +1,11 @@
-import * as helper from "../helper";
-import * as TKUnit from "../../TKUnit";
+import * as helper from "../../ui-helper";
+import * as TKUnit from "../../tk-unit";
import { parse } from "tns-core-modules/ui/builder";
import * as view from "tns-core-modules/ui/core/view";
import * as platform from "tns-core-modules/platform";
import { Repeater } from "tns-core-modules/ui/repeater";
-import { ios as iosUtils } from "tns-core-modules/utils/utils";
import { UITest } from "../../ui-test";
-import {
- dipToDp, left, top, right, bottom, height, width,
- equal, check, lessOrCloseEnough, greaterOrCloseEnough,
- isLeftAlignedWith, isRightAlignedWith, isTopAlignedWith
-} from "../layouts/layout-tests-helper";
+import { left, top, right, bottom, equal } from "../layouts/layout-tests-helper";
export class RepeaterSafeAreaTest extends UITest {
@@ -26,19 +21,20 @@ export class RepeaterSafeAreaTest extends UITest {
waitUntilTestElementLayoutIsValid(ui.root);
test(ui);
}, pageOptions);
- };
+ }
private noop() {
// no operation
- };
+ }
private getViews(template: string) {
let root = parse(template);
+
return {
root,
list: root.getViewById("repeater") as Repeater
};
- };
+ }
private repeater_in_full_screen(repeater: Repeater, pageOptions?: helper.PageOptions) {
const l = left(repeater);
diff --git a/tests/app/ui/repeater/repeater-tests.ts b/tests/app/ui/repeater/repeater-tests.ts
index 113b15ad9..51ff30c60 100644
--- a/tests/app/ui/repeater/repeater-tests.ts
+++ b/tests/app/ui/repeater/repeater-tests.ts
@@ -1,6 +1,6 @@
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import * as app from "tns-core-modules/application";
-import * as helper from "../helper";
+import * as helper from "../../ui-helper";
import * as viewModule from "tns-core-modules/ui/core/view";
import * as stackLayoutModule from "tns-core-modules/ui/layouts/stack-layout";
import * as wrapLayoutModule from "tns-core-modules/ui/layouts/wrap-layout";
@@ -44,7 +44,7 @@ export function test_set_items_to_array_loads_all_items() {
TKUnit.assert(getChildAtText(repeater, 0) === "red", "Item not created for index 0");
TKUnit.assert(getChildAtText(repeater, 1) === "green", "Item not created for index 1");
TKUnit.assert(getChildAtText(repeater, 2) === "blue", "Item not created for index 2");
- };
+ }
helper.buildUIAndRunTest(repeater, testAction);
}
@@ -57,7 +57,7 @@ export function test_set_items_to_array_creates_views() {
TKUnit.waitUntilReady(() => repeater.isLayoutValid);
TKUnit.assertEqual(getChildrenCount(repeater), FEW_ITEMS.length, "views count.");
- };
+ }
helper.buildUIAndRunTest(repeater, testAction);
}
@@ -80,7 +80,7 @@ export function test_refresh_after_adding_items_to_array_loads_new_items() {
// TKUnit.wait(ASYNC);
TKUnit.waitUntilReady(() => repeater.isLayoutValid);
TKUnit.assertEqual(getChildrenCount(repeater), colors.length, "views count.");
- };
+ }
helper.buildUIAndRunTest(repeater, testAction);
}
@@ -109,7 +109,7 @@ export function test_refresh_reloads_all_items() {
TKUnit.assert(getChildAtText(repeater, 0) === "red", "Item not created for index 0");
TKUnit.assert(getChildAtText(repeater, 1) === "green", "Item not created for index 1");
TKUnit.assert(getChildAtText(repeater, 2) === "blue", "Item not created for index 2");
- };
+ }
helper.buildUIAndRunTest(repeater, testAction);
}
@@ -125,7 +125,7 @@ export function test_set_itmes_to_null_clears_items() {
repeater.items = null;
TKUnit.waitUntilReady(() => repeater.isLayoutValid);
TKUnit.assertEqual(getChildrenCount(repeater), 0, "views count.");
- };
+ }
helper.buildUIAndRunTest(repeater, testAction);
}
@@ -144,7 +144,7 @@ export function test_set_itemsLayout_accepted() {
TKUnit.waitUntilReady(() => repeater.isLayoutValid);
TKUnit.assert((repeater.itemsLayout).orientation === "horizontal", "views count.");
TKUnit.assertEqual(getChildrenCount(repeater), FEW_ITEMS.length, "views count.");
- };
+ }
helper.buildUIAndRunTest(repeater, testAction);
}
@@ -160,7 +160,7 @@ export function test_set_itmes_to_undefiend_clears_items() {
repeater.items = undefined;
TKUnit.waitUntilReady(() => repeater.isLayoutValid);
TKUnit.assertEqual(getChildrenCount(repeater), 0, "views count.");
- };
+ }
helper.buildUIAndRunTest(repeater, testAction);
}
@@ -176,7 +176,7 @@ export function test_set_itmes_to_different_source_loads_new_items() {
repeater.items = ["a", "b", "c", "d"];
TKUnit.waitUntilReady(() => repeater.isLayoutValid);
TKUnit.assertEqual(getChildrenCount(repeater), 4, "views count.");
- };
+ }
helper.buildUIAndRunTest(repeater, testAction);
}
@@ -194,7 +194,7 @@ export function test_set_items_to_observable_array_loads_all_items() {
TKUnit.assert(getChildAtText(repeater, 0) === "red", "Item not created for index 0");
TKUnit.assert(getChildAtText(repeater, 1) === "green", "Item not created for index 1");
TKUnit.assert(getChildAtText(repeater, 2) === "blue", "Item not created for index 2");
- };
+ }
helper.buildUIAndRunTest(repeater, testAction);
}
@@ -213,7 +213,7 @@ export function test_add_to_observable_array_refreshes_the_Repeater() {
// The Repeater will be updated automatically.
// << article-push-to-observablearray
TKUnit.assertEqual(getChildrenCount(repeater), 4, "getChildrenCount");
- };
+ }
helper.buildUIAndRunTest(repeater, testAction);
}
@@ -232,7 +232,7 @@ export function test_remove_from_observable_array_refreshes_the_Repeater() {
TKUnit.waitUntilReady(() => repeater.isLayoutValid);
TKUnit.assertEqual(getChildrenCount(repeater), 2, "getChildrenCount");
- };
+ }
helper.buildUIAndRunTest(repeater, testAction);
}
@@ -247,12 +247,12 @@ export function test_splice_observable_array_refreshes_the_Repeater() {
TKUnit.waitUntilReady(() => repeater.isLayoutValid);
TKUnit.assertEqual(getChildrenCount(repeater), 3, "getChildrenCount");
- // Remove the first 2 elements and add
+ // Remove the first 2 elements and add
data.splice(0, 2, "d", "e", "f");
TKUnit.waitUntilReady(() => repeater.isLayoutValid);
TKUnit.assertEqual(getChildrenCount(repeater), 4, "getChildrenCount");
- };
+ }
helper.buildUIAndRunTest(repeater, testAction);
}
@@ -267,6 +267,7 @@ export function test_usingAppLevelConvertersInRepeaterItems() {
var month = value.getMonth() + 1;
result = result.replace("MM", month < 10 ? "0" + month : month);
result = result.replace("YYYY", value.getFullYear());
+
return result;
};
@@ -283,7 +284,7 @@ export function test_usingAppLevelConvertersInRepeaterItems() {
TKUnit.waitUntilReady(() => repeater.isLayoutValid);
TKUnit.assertEqual(getChildAtText(repeater, 0), dateConverter(new Date(), "DD.MM.YYYY"), "element");
- };
+ }
helper.buildUIAndRunTest(repeater, testAction);
}
@@ -313,8 +314,9 @@ export function test_ItemTemplateFactoryFunction() {
var label = new Label();
label.id = "testLabel";
label.bind({ sourceProperty: "$value", targetProperty: "text", twoWay: false });
+
return label;
- }
+ };
repeater.items = [1, 2, 3];
TKUnit.waitUntilReady(() => repeater.isLayoutValid);
@@ -356,16 +358,17 @@ export var test_RepeaterItemsGestureBindings = function () {
else if (childItem instanceof layoutBaseModule.LayoutBase) {
childItem.eachChildView(eachChildCallback);
}
+
return true;
- }
+ };
repeater.eachChildView(eachChildCallback);
TKUnit.assertEqual(hasObservers, true, "Every item should have tap observer!");
- }
+ };
- helper.navigateToModuleAndRunTest("ui/repeater/repeaterItems-bindingToGestures", null, testFunc);
-}
+ helper.navigateToModuleAndRunTest("ui/repeater/repeaterItems-bindingToGestures-page", null, testFunc);
+};
export var test_RepeaterItemsParentBindingsShouldWork = function () {
var testFunc = function (page: pageModule.Page) {
@@ -382,16 +385,17 @@ export var test_RepeaterItemsParentBindingsShouldWork = function () {
else if (childItem instanceof layoutBaseModule.LayoutBase) {
childItem.eachChildView(eachChildCallback);
}
+
return true;
- }
+ };
repeater.eachChildView(eachChildCallback);
TKUnit.assertEqual(testPass, true, "Every item should have text bound to Page binding context!");
- }
+ };
- helper.navigateToModuleAndRunTest("ui/repeater/repeaterItems-bindingToGestures", null, testFunc);
-}
+ helper.navigateToModuleAndRunTest("ui/repeater/repeaterItems-bindingToGestures-page", null, testFunc);
+};
export function test_ChildrenAreNotCreatedUntilTheRepeaterIsLoaded() {
var repeater = new repeaterModule.Repeater();
@@ -427,7 +431,7 @@ export function test_no_memory_leak_when_items_is_regular_array(done) {
}
export function test_no_memory_leak_when_items_is_observable_array(done) {
- // Keep the reference to the observable array to test the weakEventListener
+ // Keep the reference to the observable array to test the weakEventListener
var colors = new observableArray.ObservableArray(["red", "green", "blue"]);
var createFunc = function (): repeaterModule.Repeater {
diff --git a/tests/app/ui/repeater/repeaterItems-bindingToGestures.ts b/tests/app/ui/repeater/repeaterItems-bindingToGestures-page.ts
similarity index 90%
rename from tests/app/ui/repeater/repeaterItems-bindingToGestures.ts
rename to tests/app/ui/repeater/repeaterItems-bindingToGestures-page.ts
index 28d51ee14..3d79b8e98 100644
--- a/tests/app/ui/repeater/repeaterItems-bindingToGestures.ts
+++ b/tests/app/ui/repeater/repeaterItems-bindingToGestures-page.ts
@@ -1,9 +1,9 @@
-function pageLoaded(args) {
+function pageLoaded(args) {
var page = args.object;
page.bindingContext = {
items: [
- { text: "1", tapItem: function () { console.log("1") } },
- { text: "2", tapItem: function () { console.log("2") } }
+ { text: "1", tapItem: function () { console.log("1"); } },
+ { text: "2", tapItem: function () { console.log("2"); } }
],
parentViewProperty: "Parent View Property"
};
@@ -12,4 +12,4 @@ exports.pageLoaded = pageLoaded;
exports.tapPage = function (args) {
console.log("Tap! " + args + " " + args.object);
-}
\ No newline at end of file
+};
\ No newline at end of file
diff --git a/tests/app/ui/repeater/repeaterItems-bindingToGestures.xml b/tests/app/ui/repeater/repeaterItems-bindingToGestures-page.xml
similarity index 100%
rename from tests/app/ui/repeater/repeaterItems-bindingToGestures.xml
rename to tests/app/ui/repeater/repeaterItems-bindingToGestures-page.xml
diff --git a/tests/app/ui/root-view/reset-root-view-tests.ts b/tests/app/ui/root-view/reset-root-view-tests.ts
index 08e04e808..51db842ff 100644
--- a/tests/app/ui/root-view/reset-root-view-tests.ts
+++ b/tests/app/ui/root-view/reset-root-view-tests.ts
@@ -1,8 +1,8 @@
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import { Page } from "tns-core-modules/ui/page";
import { isAndroid } from "tns-core-modules/platform";
-import { Frame, NavigationEntry, stack } from "tns-core-modules/ui/frame";
+import { Frame, NavigationEntry, _stack } from "tns-core-modules/ui/frame";
import { _resetRootView, getRootView } from "tns-core-modules/application";
import { TabView, TabViewItem } from "tns-core-modules/ui/tab-view";
@@ -60,7 +60,7 @@ export function test_reset_frame_to_frame() {
helper.waitUntilNavigatedTo(testFrameRoot1.page, () => _resetRootView(testFrameRoot1.entry));
const rootView1 = getRootView();
- const frameStack1 = stack();
+ const frameStack1 = _stack();
TKUnit.assertEqual(rootView1, testFrameRoot1.root);
TKUnit.assertEqual(frameStack1.length, 1);
@@ -69,10 +69,10 @@ export function test_reset_frame_to_frame() {
helper.waitUntilNavigatedTo(testFrameRoot2.page, () => _resetRootView(testFrameRoot2.entry));
const rootView2 = getRootView();
- const frameStack2 = stack();
+ const frameStack2 = _stack();
TKUnit.assertEqual(rootView2, testFrameRoot2.root);
TKUnit.assertEqual(frameStack2.length, 1);
-};
+}
export function test_reset_frame_to_tab() {
const testFrameRoot = createTestFrameRootEntry();
@@ -80,7 +80,7 @@ export function test_reset_frame_to_tab() {
helper.waitUntilNavigatedTo(testFrameRoot.page, () => _resetRootView(testFrameRoot.entry));
const rootView1 = getRootView();
- const frameStack1 = stack();
+ const frameStack1 = _stack();
TKUnit.assertEqual(rootView1, testFrameRoot.root);
TKUnit.assertEqual(frameStack1.length, 1);
@@ -89,10 +89,10 @@ export function test_reset_frame_to_tab() {
waitUntilTabViewReady(testTabRoot.page, () => _resetRootView(testTabRoot.entry));
const rootView2 = getRootView();
- const frameStack2 = stack();
+ const frameStack2 = _stack();
TKUnit.assertEqual(rootView2, testTabRoot.root);
TKUnit.assertEqual(frameStack2.length, 2);
-};
+}
export function test_reset_tab_to_frame() {
const testTabRoot = createTestTabRootEntry();
@@ -100,7 +100,7 @@ export function test_reset_tab_to_frame() {
waitUntilTabViewReady(testTabRoot.page, () => _resetRootView(testTabRoot.entry));
const rootView2 = getRootView();
- const frameStack2 = stack();
+ const frameStack2 = _stack();
TKUnit.assertEqual(rootView2, testTabRoot.root);
TKUnit.assertEqual(frameStack2.length, 2);
@@ -109,10 +109,10 @@ export function test_reset_tab_to_frame() {
helper.waitUntilNavigatedTo(testFrameRoot.page, () => _resetRootView(testFrameRoot.entry));
const rootView1 = getRootView();
- const frameStack1 = stack();
+ const frameStack1 = _stack();
TKUnit.assertEqual(rootView1, testFrameRoot.root);
TKUnit.assertEqual(frameStack1.length, 1);
-};
+}
export function test_reset_tab_to_tab() {
const testTabRoot1 = createTestTabRootEntry();
@@ -120,7 +120,7 @@ export function test_reset_tab_to_tab() {
waitUntilTabViewReady(testTabRoot1.page, () => _resetRootView(testTabRoot1.entry));
const rootView1 = getRootView();
- const frameStack1 = stack();
+ const frameStack1 = _stack();
TKUnit.assertEqual(rootView1, testTabRoot1.root);
TKUnit.assertEqual(frameStack1.length, 2);
@@ -129,10 +129,10 @@ export function test_reset_tab_to_tab() {
waitUntilTabViewReady(testTabRoot2.page, () => _resetRootView(testTabRoot2.entry));
const rootView2 = getRootView();
- const frameStack2 = stack();
+ const frameStack2 = _stack();
TKUnit.assertEqual(rootView2, testTabRoot2.root);
TKUnit.assertEqual(frameStack2.length, 2);
-};
+}
export function test_reset_during_tab_index_change() {
const testTabRoot = createTestTabRootEntry();
@@ -154,4 +154,4 @@ export function tearDownModule() {
_resetRootView(resetFrameRoot.entry);
TKUnit.waitUntilReady(() => resetFrameRoot.page.isLoaded);
-}
\ No newline at end of file
+}
diff --git a/tests/app/ui/root-view/root-modules/custom-component-root.xml b/tests/app/ui/root-view/root-modules/custom-component-root.xml
index 6f233546c..ed7b48fa5 100644
--- a/tests/app/ui/root-view/root-modules/custom-component-root.xml
+++ b/tests/app/ui/root-view/root-modules/custom-component-root.xml
@@ -1,2 +1,2 @@
-
+
\ No newline at end of file
diff --git a/tests/app/ui/root-view/root-view-tests.ts b/tests/app/ui/root-view/root-view-tests.ts
index 1f308446d..ec564717a 100644
--- a/tests/app/ui/root-view/root-view-tests.ts
+++ b/tests/app/ui/root-view/root-view-tests.ts
@@ -1,11 +1,10 @@
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import { Page, View } from "tns-core-modules/ui/page";
-import { Frame, NavigationEntry, stack } from "tns-core-modules/ui/frame";
+import { Frame, NavigationEntry, _stack } from "tns-core-modules/ui/frame";
import { _resetRootView, getRootView } from "tns-core-modules/application";
-import { TabView, TabViewItem } from "tns-core-modules/ui/tab-view";
+import { TabView } from "tns-core-modules/ui/tab-view";
import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout";
-import * as myCustomControlWithoutXml from "./mymodule/MyControl";
-import * as helper from "../helper";
+import * as helper from "../../ui-helper";
function createTestFrameRootEntry() {
const page = new Page();
@@ -33,9 +32,14 @@ export function test_custom_component_rootview_css_applied() {
var rootView = getRootView();
TKUnit.waitUntilReady(() => rootView.isLoaded);
- TKUnit.assert(rootView instanceof myCustomControlWithoutXml.MyControl);
+ TKUnit.assertNotNull(rootView);
+ TKUnit.assertEqual(rootView.className, "MyStackLayoutRoot", "Expected result custom control is created");
helper.assertViewBackgroundColor(rootView, "#0000FF");
-};
+}
+
+export function test_custom_component_rootview_layout_updates() {
+ layout_invalidate_test("./ui/root-view/root-modules/custom-component-root");
+}
export function test_tabview_rootview_css_applied() {
var entry = {
@@ -49,7 +53,7 @@ export function test_tabview_rootview_css_applied() {
TKUnit.assert(rootView instanceof TabView);
helper.assertTabSelectedTabTextColor(rootView, "#0000FF");
-};
+}
export function test_gridlayout_rootview_css_applied() {
var entry = {
@@ -63,16 +67,12 @@ export function test_gridlayout_rootview_css_applied() {
TKUnit.assert(rootView instanceof GridLayout);
helper.assertViewBackgroundColor(rootView, "#0000FF");
-};
+}
export function test_gridlayout_rootview_layout_updates() {
layout_invalidate_test("ui/root-view/root-modules/gridlayout-root");
}
-export function test_custom_component_rootview_layout_updates() {
- layout_invalidate_test("ui/root-view/root-modules/custom-component-root");
-}
-
export function test_tabview_rootview_layout_updates() {
layout_invalidate_test("ui/root-view/root-modules/gridlayout-root");
}
diff --git a/tests/app/ui/scroll-view/scroll-view-safe-area-tests.ts b/tests/app/ui/scroll-view/scroll-view-safe-area-tests.ts
index 9d10c6a15..ad2021ebb 100644
--- a/tests/app/ui/scroll-view/scroll-view-safe-area-tests.ts
+++ b/tests/app/ui/scroll-view/scroll-view-safe-area-tests.ts
@@ -1,16 +1,15 @@
import { UITest } from "../../ui-test";
import { ScrollView } from "tns-core-modules/ui/scroll-view";
import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout";
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import * as view from "tns-core-modules/ui/core/view";
import * as platform from "tns-core-modules/platform";
-import { ios as iosUtils } from "tns-core-modules/utils/utils";
-import * as helper from "../helper";
+import * as helper from "../../ui-helper";
import { parse } from "tns-core-modules/ui/builder";
import {
dipToDp, left, top, right, bottom, height, width,
- equal, check, lessOrCloseEnough, greaterOrCloseEnough,
+ equal, lessOrCloseEnough, greaterOrCloseEnough,
isLeftAlignedWith, isRightAlignedWith, isTopAlignedWith, isBottomAlignedWith,
isLeftWith, isRightWith, isBelowWith
} from "../layouts/layout-tests-helper";
@@ -29,14 +28,15 @@ class ScrollLayoutSafeAreaTest extends UITest {
waitUntilTestElementLayoutIsValid(ui.root);
test(ui);
}, pageOptions);
- };
+ }
private noop() {
// no operation
- };
+ }
private getViews(template: string) {
let root = parse(template);
+
return {
root,
grid: root.getViewById("grid") as GridLayout,
@@ -48,7 +48,7 @@ class ScrollLayoutSafeAreaTest extends UITest {
[root.getViewById("cell20") as view.View, root.getViewById("cell21") as view.View, root.getViewById("cell22") as view.View]
]
};
- };
+ }
private scroll_view_in_full_screen(scrollView: view.View, pageOptions?: helper.PageOptions) {
const l = left(scrollView);
@@ -425,7 +425,7 @@ class ScrollLayoutSafeAreaTest extends UITest {
greaterOrCloseEnough(width(cells[1][0]), width(cells[1][1]), `cell10 width<${width(cells[1][0])}> not greater or close enough cell11 width<${width(cells[1][1])}>`);
lessOrCloseEnough(width(cells[1][1]), width(cells[1][2]), `cell11 width<${width(cells[1][1])}> not less or close enough cell12 width<${width(cells[1][2])}>`);
- const sumOfNestedScrollViewWidths = width(cells[1][0]) + width(cells[1][1]) + width(cells[1][2])
+ const sumOfNestedScrollViewWidths = width(cells[1][0]) + width(cells[1][1]) + width(cells[1][2]);
equal(width(grid), sumOfNestedScrollViewWidths, `grid width<${width(grid)}> sum of nested scroll views width <${sumOfNestedScrollViewWidths}>`);
},
pageOptions
diff --git a/tests/app/ui/scroll-view/scroll-view-tests.ts b/tests/app/ui/scroll-view/scroll-view-tests.ts
index 8c375305b..3bb231c47 100644
--- a/tests/app/ui/scroll-view/scroll-view-tests.ts
+++ b/tests/app/ui/scroll-view/scroll-view-tests.ts
@@ -1,10 +1,9 @@
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import { Button } from "tns-core-modules/ui/button";
import { Page, isIOS } from "tns-core-modules/ui/page";
import { UITest } from "../../ui-test";
import * as layoutHelper from "../layouts/layout-helper";
-import * as frame from "tns-core-modules/ui/frame";
-import * as helper from "../helper";
+import * as helper from "../../ui-helper";
// >> article-require-scrollview-module
import { ScrollView, ScrollEventData } from "tns-core-modules/ui/scroll-view";
@@ -27,6 +26,7 @@ class ScrollLayoutTest extends UITest {
// Use page with scrollableContent disabled for scroll-view tests
(this.testPage).scrollableContent = false;
+
return scrollView;
}
@@ -135,7 +135,7 @@ class ScrollLayoutTest extends UITest {
TKUnit.assertEqual(this.testView.horizontalOffset, 0, "this.testView.horizontalOffset");
this.testView.scrollToHorizontalOffset(layoutHelper.dp(100), true);
- // No synchronous change.
+ // No synchronous change.
TKUnit.assertEqual(this.testView.horizontalOffset, 0, "this.testView.horizontalOffset");
TKUnit.waitUntilReady(() => TKUnit.areClose(layoutHelper.dip(this.testView.horizontalOffset), 100, 0.9));
diff --git a/tests/app/ui/search-bar/search-bar-code-snippet.ts b/tests/app/ui/search-bar/search-bar-code-snippet.ts
index c93d26d41..7b56a8544 100644
--- a/tests/app/ui/search-bar/search-bar-code-snippet.ts
+++ b/tests/app/ui/search-bar/search-bar-code-snippet.ts
@@ -1,5 +1,5 @@
import { EventData } from "tns-core-modules/data/observable";
-import { SearchBar } from "tns-core-modules/ui/search-bar"
+import { SearchBar } from "tns-core-modules/ui/search-bar";
export function navigatingTo(args: EventData) {
console.log("page navigating to");
diff --git a/tests/app/ui/search-bar/search-bar-tests-native.android.ts b/tests/app/ui/search-bar/search-bar-tests-native.android.ts
index 77b316d2b..edf4f0474 100644
--- a/tests/app/ui/search-bar/search-bar-tests-native.android.ts
+++ b/tests/app/ui/search-bar/search-bar-tests-native.android.ts
@@ -20,6 +20,7 @@ export function getNativeHintColor(searchBar: searchBarModule.SearchBar): colorM
if (textView) {
return new colorModule.Color(textView.getHintTextColors().getDefaultColor());
}
+
return undefined;
}
@@ -29,6 +30,7 @@ export function getNativeTextFieldBackgroundColor(searchBar: searchBarModule.Sea
if (textView) {
return new colorModule.Color((textView.getBackground()).getColor());
}
+
return undefined;
}
@@ -38,5 +40,6 @@ export function getNativeFontSize(searchBar: searchBarModule.SearchBar): number
if (textView) {
return textView.getTextSize() / utils.layout.getDisplayDensity();
}
+
return undefined;
}
diff --git a/tests/app/ui/search-bar/search-bar-tests-native.ios.ts b/tests/app/ui/search-bar/search-bar-tests-native.ios.ts
index 0076d8bb3..7764ccc13 100644
--- a/tests/app/ui/search-bar/search-bar-tests-native.ios.ts
+++ b/tests/app/ui/search-bar/search-bar-tests-native.ios.ts
@@ -1,18 +1,19 @@
import { SearchBar } from "tns-core-modules/ui/search-bar";
import { Color } from "tns-core-modules/color";
-import { getColor } from "../helper";
+import { getColor } from "../../ui-helper";
export function getNativeHintColor(searchBar: SearchBar): Color {
if ((searchBar)._textField) {
const placeholder = (searchBar)._textField.valueForKey("placeholderLabel");
+
return getColor(placeholder.textColor);
}
- return undefined;
+ return undefined;
}
export function getNativeTextFieldBackgroundColor(searchBar: SearchBar): Color {
- return (searchBar)._textField ? getColor((searchBar)._textField.backgroundColor) : undefined;
+ return (searchBar)._textField ? getColor((searchBar)._textField.backgroundColor) : undefined;
}
export function getNativeFontSize(searchBar: SearchBar): number {
diff --git a/tests/app/ui/search-bar/search-bar-tests.ts b/tests/app/ui/search-bar/search-bar-tests.ts
index a6b2198fe..c22686947 100644
--- a/tests/app/ui/search-bar/search-bar-tests.ts
+++ b/tests/app/ui/search-bar/search-bar-tests.ts
@@ -1,5 +1,5 @@
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import * as viewModule from "tns-core-modules/ui/core/view";
import * as searchBarTestsNative from "./search-bar-tests-native";
import * as colorModule from "tns-core-modules/color";
@@ -14,13 +14,14 @@ import * as searchBarModule from "tns-core-modules/ui/search-bar";
//
//
//```
-//
+//
var _createSearchBarFunc = function (): searchBarModule.SearchBar {
// >> article-creating-searchbar
var searchBar = new searchBarModule.SearchBar();
// << article-creating-searchbar
searchBar.text = "searchBar";
+
return searchBar;
};
@@ -118,7 +119,7 @@ export var testSearchBarPropertiesWithCSS = function () {
export function test_DummyTestForSnippetOnly() {
// >> article-searching
var searchBar = new searchBarModule.SearchBar();
- searchBar.on(searchBarModule.SearchBar.submitEvent, function (args: observable.EventData) {
+ searchBar.on(searchBarModule.SearchBar.submitEvent, function (args: observable.EventData) {
console.log("Search for " + (args.object).text);
});
searchBar.on(searchBarModule.SearchBar.clearEvent, function (args: observable.EventData) {
diff --git a/tests/app/ui/segmented-bar/segmented-bar-tests-native.ios.ts b/tests/app/ui/segmented-bar/segmented-bar-tests-native.ios.ts
index 64fe7a0e8..b4da9c29d 100644
--- a/tests/app/ui/segmented-bar/segmented-bar-tests-native.ios.ts
+++ b/tests/app/ui/segmented-bar/segmented-bar-tests-native.ios.ts
@@ -1,4 +1,4 @@
-import * as segmentedBarModule from "tns-core-modules/ui/segmented-bar";
+import * as segmentedBarModule from "tns-core-modules/ui/segmented-bar";
export function getNativeItemsCount(bar: segmentedBarModule.SegmentedBar): number {
return (bar.nativeViewProtected).numberOfSegments;
@@ -8,6 +8,7 @@ export function checkNativeItemsTextColor(bar: segmentedBarModule.SegmentedBar):
var attrs = (bar.nativeViewProtected).titleTextAttributesForState(UIControlState.Normal);
var nativeViewColor = bar.color && attrs && attrs.valueForKey(NSForegroundColorAttributeName);
var barColor = bar.color.ios;
+
return barColor.isEqual(nativeViewColor);
}
diff --git a/tests/app/ui/segmented-bar/segmented-bar-tests.ts b/tests/app/ui/segmented-bar/segmented-bar-tests.ts
index e6e4bd2a0..24caeab0b 100644
--- a/tests/app/ui/segmented-bar/segmented-bar-tests.ts
+++ b/tests/app/ui/segmented-bar/segmented-bar-tests.ts
@@ -1,11 +1,11 @@
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import * as segmentedBarTestsNative from "./segmented-bar-tests-native";
-import { buildUIAndRunTest } from "../helper";
+import { buildUIAndRunTest } from "../../ui-helper";
import { View } from "tns-core-modules/ui/core/view";
import { BindingOptions } from "tns-core-modules/ui/core/bindable";
import { Observable } from "tns-core-modules/data/observable";
import { Color } from "tns-core-modules/color";
-import * as helper from "../helper";
+import * as helper from "../../ui-helper";
// >> article-require-segmentedbar-module
import * as segmentedBarModule from "tns-core-modules/ui/segmented-bar";
@@ -16,6 +16,7 @@ function _createSegmentedBar(): segmentedBarModule.SegmentedBar {
var segmentedBar = new segmentedBarModule.SegmentedBar();
// << article-create-segmentedbar
segmentedBar.id = "SegmentedBar";
+
return segmentedBar;
}
@@ -32,6 +33,7 @@ function _createItems(count: number): Array
bar.title = i + "";
items.push(bar);
}
+
return items;
}
@@ -42,7 +44,7 @@ export var testWhenSegmentedBarIsCreatedItemsAreUndefined = function () {
var actualValue = segmentedBar.items;
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testWhenSegmentedBarIsCreatedSelectedIndexIsUndefined = function () {
buildUIAndRunTest(_createSegmentedBar(), function (views: Array) {
@@ -51,7 +53,7 @@ export var testWhenSegmentedBarIsCreatedSelectedIndexIsUndefined = function () {
var actualValue = segmentedBar.selectedIndex;
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testWhenSettingItemsToNonEmptyArrayTheSameAmountOfNativeItemsIsCreated = function () {
buildUIAndRunTest(_createSegmentedBar(), function (views: Array) {
@@ -61,7 +63,7 @@ export var testWhenSettingItemsToNonEmptyArrayTheSameAmountOfNativeItemsIsCreate
var actualValue = segmentedBarTestsNative.getNativeItemsCount(segmentedBar);
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testWhenItemsAreBoundTheTextColorIsPreserved = function () {
var segmentedBar = _createSegmentedBar();
@@ -81,13 +83,13 @@ export var testWhenItemsAreBoundTheTextColorIsPreserved = function () {
var options: BindingOptions = {
sourceProperty: "items",
targetProperty: "items"
- }
+ };
segmentedBar.bind(options, model);
TKUnit.assert(segmentedBarTestsNative.checkNativeItemsTextColor(segmentedBar), "Items text color not preserved" + "; Expected: " + segmentedBar.color);
});
-}
+};
export var testWhenSettingItemsToEmptyArrayZeroNativeItemsAreCreated = function () {
buildUIAndRunTest(_createSegmentedBar(), function (views: Array) {
@@ -97,7 +99,7 @@ export var testWhenSettingItemsToEmptyArrayZeroNativeItemsAreCreated = function
var actualValue = segmentedBarTestsNative.getNativeItemsCount(segmentedBar);
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testSelectedIndexBecomesZeroWhenItemsBoundToNonEmptyArray = function () {
buildUIAndRunTest(_createSegmentedBar(), function (views: Array) {
@@ -119,7 +121,7 @@ export var testSelectedIndexBecomesZeroWhenItemsBoundToNonEmptyArray = function
var actualValue = segmentedBar.selectedIndex;
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testSelectedIndexBecomesUndefinedWhenItemsBoundToEmptyArray = function () {
buildUIAndRunTest(_createSegmentedBar(), function (views: Array) {
@@ -133,7 +135,7 @@ export var testSelectedIndexBecomesUndefinedWhenItemsBoundToEmptyArray = functio
var actualValue = segmentedBar.selectedIndex;
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testSelectedIndexBecomesUndefinedWhenItemsBoundToUndefined = function () {
buildUIAndRunTest(_createSegmentedBar(), function (views: Array) {
@@ -145,7 +147,7 @@ export var testSelectedIndexBecomesUndefinedWhenItemsBoundToUndefined = function
var actualValue = segmentedBar.selectedIndex;
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testSelectedIndexBecomesUndefinedWhenItemsBoundToNull = function () {
buildUIAndRunTest(_createSegmentedBar(), function (views: Array) {
@@ -157,7 +159,7 @@ export var testSelectedIndexBecomesUndefinedWhenItemsBoundToNull = function () {
var actualValue = segmentedBar.selectedIndex;
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testItemsIsResolvedCorrectlyIfSetBeforeViewIsLoaded = function () {
var segmentedBar = _createSegmentedBar();
@@ -169,7 +171,7 @@ export var testItemsIsResolvedCorrectlyIfSetBeforeViewIsLoaded = function () {
var actualValue = segmentedBar.items.length;
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testSelectedIndexIsResolvedCorrectlyIfSetBeforeViewIsLoaded = function () {
var segmentedBar = _createSegmentedBar();
@@ -181,7 +183,7 @@ export var testSelectedIndexIsResolvedCorrectlyIfSetBeforeViewIsLoaded = functio
var actualValue = segmentedBar.selectedIndex;
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
});
-}
+};
export var testSelectedIndexChangedIsReisedCorrectlyIfSelectedIndexIsSet = function () {
var oldIndex;
@@ -210,7 +212,7 @@ export var testSelectedIndexChangedIsReisedCorrectlyIfSelectedIndexIsSet = funct
TKUnit.assertEqual(oldIndex, 3);
TKUnit.assertEqual(newIndex, 9);
});
-}
+};
export var testSelectedIndexChangedIsReisedCorrectlyIfSelectedIndexIsSetNative = function () {
var oldIndex;
@@ -239,7 +241,7 @@ export var testSelectedIndexChangedIsReisedCorrectlyIfSelectedIndexIsSetNative =
TKUnit.assertEqual(oldIndex, 3);
TKUnit.assertEqual(newIndex, 9);
});
-}
+};
export var testSelectedIndexChangedIsRaisedCorrectlyIfItemsNotBound = function () {
const segmentedBar = _createSegmentedBar();
@@ -262,7 +264,7 @@ export var testSelectedIndexChangedIsRaisedCorrectlyIfItemsNotBound = function (
segmentedBarTestsNative.setNativeSelectedIndex(segmentedBar, 1);
TKUnit.assertEqual(newSelectedIndex, 1);
});
-}
+};
export function test_SettingNumberAsTitleFromXML_DoesNotThrow() {
let segmentedBar = new segmentedBarModule.SegmentedBar();
diff --git a/tests/app/ui/slider/slider-tests.ts b/tests/app/ui/slider/slider-tests.ts
index 81e8fc1bf..75ef51571 100644
--- a/tests/app/ui/slider/slider-tests.ts
+++ b/tests/app/ui/slider/slider-tests.ts
@@ -1,5 +1,5 @@
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import { View } from "tns-core-modules/ui/core/view";
import { Page } from "tns-core-modules/ui/page";
import { BindingOptions } from "tns-core-modules/ui/core/bindable";
@@ -24,9 +24,9 @@ import { Slider } from "tns-core-modules/ui/slider";
// << article-binding-slider-properties
interface SliderValues {
- min?: number,
- max?: number,
- value?: number,
+ min?: number;
+ max?: number;
+ value?: number;
}
const TEST_VALUE = 50;
@@ -60,7 +60,7 @@ export function test_set_TNS_value_updates_native_value() {
function testAction(views: Array) {
slider.value = TEST_VALUE;
TKUnit.assertEqual(getNativeValue(slider), TEST_VALUE, "Native value is different from TNS value.");
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -70,7 +70,7 @@ export function test_set_native_value_updates_TNS_value() {
function testAction(views: Array) {
setNativeValue(slider, TEST_VALUE);
TKUnit.assertEqual(slider.value, TEST_VALUE, "Native value is different from TNS value.");
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -98,7 +98,7 @@ export function test_set_native_value_triggers_propertyChanged() {
}
helper.buildUIAndRunTest(slider, testAction);
-};
+}
// Uncomment this when find way to check android Drawable color set by setColorFilter() method.
if (isIOS) {
@@ -108,7 +108,7 @@ if (isIOS) {
function testAction(views: Array) {
TKUnit.assertEqual(slider.color.ios.CGColor, slider.ios.thumbTintColor.CGColor, "slider.color");
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
};
@@ -119,7 +119,7 @@ if (isIOS) {
function testAction(views: Array) {
TKUnit.assertEqual((slider.backgroundColor).ios.CGColor, slider.ios.minimumTrackTintColor.CGColor, "slider.backgroundColor");
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
};
@@ -138,7 +138,7 @@ export function test_default_native_values() {
function testAction(views: Array) {
TKUnit.assertEqual(getNativeValue(slider), 0, "Default native slider.value");
TKUnit.assertEqual(getNativeMaxValue(slider), 100, "Default native slider.maxValue");
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -167,7 +167,7 @@ export function test_values_change_native_values() {
slider.value = 15;
TKUnit.assertEqual(getNativeValue(slider), isIOS ? 15 : 5, "5: wrong native slider.value");
TKUnit.assertEqual(getNativeMaxValue(slider), isIOS ? 20 : 10, "5: Wrong native slider.maxValue");
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -180,7 +180,7 @@ export function test_set_min_max_value() {
function testAction(views: Array) {
assertSliderValuesDefault(slider);
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -193,7 +193,7 @@ export function test_set_min_value_max() {
function testAction(views: Array) {
assertSliderValuesDefault(slider);
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -206,7 +206,7 @@ export function test_set_max_min_value() {
function testAction(views: Array) {
assertSliderValuesDefault(slider);
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -219,7 +219,7 @@ export function test_set_max_value_min() {
function testAction(views: Array) {
assertSliderValuesDefault(slider);
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -232,7 +232,7 @@ export function test_set_value_min_max() {
function testAction(views: Array) {
assertSliderValuesDefault(slider);
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -245,7 +245,7 @@ export function test_set_value_max_min() {
function testAction(views: Array) {
assertSliderValuesDefault(slider);
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -256,7 +256,7 @@ export function test_set_value_less_than_min_should_set_value_to_min() {
function testAction(views: Array) {
slider.value = -10;
assertSliderValues(slider, { value: 0 });
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -268,7 +268,7 @@ export function test_set_value_greater_than_max_should_set_value_to_max() {
slider.maxValue = 10;
slider.value = 20;
assertSliderValues(slider, { value: 10 });
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -284,7 +284,7 @@ export function test_set_maxValue_should_adjust_value() {
TKUnit.assertEqual(slider.maxValue, 40, "slider.maxValue");
TKUnit.assertEqual(slider.value, 40, "slider.value");
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -301,7 +301,7 @@ export function test_set_maxValue_should_adjust_value_but_respect_minValue() {
function testAction(views: Array) {
slider.maxValue = 30;
assertSliderValues(slider, { min: 50, max: 50, value: 50 });
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -315,7 +315,7 @@ export function test_set_minValue_should_adjust_value() {
function testAction(views: Array) {
slider.minValue = 60;
assertSliderValues(slider, { min: 60, value: 60 });
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -330,7 +330,7 @@ export function test_set_minValue_should_adjust_value_and_maxValue() {
const newMin = 120;
slider.minValue = newMin;
assertSliderValues(slider, { min: newMin, max: newMin, value: newMin });
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -356,7 +356,7 @@ export function test_property_changed_event_when_setting_minValue_no_adjust() {
// Assert
TKUnit.assert(changedProperties["minValue"], "Property changed for minValue not called.");
TKUnit.assertEqual(allChanges, 1, "Property changed callbacks.");
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -383,7 +383,7 @@ export function test_property_changed_event_when_setting_minValue_with_adjust()
TKUnit.assert(changedProperties["value"], "Property changed for 'value' not called.");
TKUnit.assert(changedProperties["minValue"], "Property changed for 'minValue' not called.");
TKUnit.assertEqual(allChanges, 2, "Property changed callbacks.");
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -409,7 +409,7 @@ export function test_property_changed_event_when_setting_maxValue_no_adjust() {
// Assert
TKUnit.assert(changedProperties["maxValue"], "Property changed for maxValue not called.");
TKUnit.assertEqual(allChanges, 1, "Property changed callbacks.");
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
@@ -436,7 +436,7 @@ export function test_property_changed_event_when_setting_maxValue_with_adjust()
TKUnit.assert(changedProperties["value"], "Property changed for 'value' not called.");
TKUnit.assert(changedProperties["maxValue"], "Property changed for 'maxValue' not called.");
TKUnit.assertEqual(allChanges, 2, "Property changed callbacks.");
- };
+ }
helper.buildUIAndRunTest(slider, testAction);
}
diff --git a/tests/app/ui/styling/style-properties-tests.ts b/tests/app/ui/styling/style-properties-tests.ts
index 83f6dc66f..931270f71 100644
--- a/tests/app/ui/styling/style-properties-tests.ts
+++ b/tests/app/ui/styling/style-properties-tests.ts
@@ -1,5 +1,5 @@
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import { Button } from "tns-core-modules/ui/button";
import { Label } from "tns-core-modules/ui/label";
import { TextField } from "tns-core-modules/ui/text-field";
@@ -626,7 +626,7 @@ export function test_setting_label_whiteSpace_nowrap_sets_native() {
TKUnit.assertEqual((testView.ios).numberOfLines, 1);
}
});
-};
+}
export function test_setting_label_whiteSpace_normal_sets_native() {
const testView = new Label();
@@ -640,7 +640,7 @@ export function test_setting_label_whiteSpace_normal_sets_native() {
TKUnit.assertEqual((testView.ios).numberOfLines, 0);
}
});
-};
+}
export function test_setting_button_whiteSpace_nowrap_sets_native() {
const testView = new Button();
@@ -654,7 +654,7 @@ export function test_setting_button_whiteSpace_nowrap_sets_native() {
TKUnit.assertEqual((testView.ios).titleLabel.numberOfLines, 1);
}
});
-};
+}
export function test_setting_button_whiteSpace_normal_sets_native() {
const testView = new Button();
@@ -668,7 +668,7 @@ export function test_setting_button_whiteSpace_normal_sets_native() {
TKUnit.assertEqual((testView.ios).titleLabel.numberOfLines, 0);
}
});
-};
+}
const initial = "text Text";
const capitalized = "Text Text";
@@ -752,23 +752,6 @@ export const test_setting_textView_textTransform_sets_native = function () {
}
};
-export const test_setting_button_textTransform_sets_native = function () {
- const testView = new Button();
- testView.text = initial;
- testView.style.textTransform = "capitalize";
-
- executeTransformTest(testView, androidText, function (v) { return (v.ios).titleForState(UIControlState.Normal); });
-};
-
-export const test_setting_label_textTransform_and_textDecoration_sets_native = function () {
- const testView = new Label();
- testView.text = initial;
- testView.style.textTransform = "capitalize";
- testView.style.textDecoration = "underline";
-
- executeTransformTest(testView, androidText, iOSText);
-};
-
export const test_setting_textField_textTransform_and_textDecoration_sets_native = function () {
if (isIOS) {
const testView = new TextField();
@@ -791,6 +774,23 @@ export const test_setting_textView_textTransform_and_textDecoration_sets_native
}
};
+export const test_setting_button_textTransform_sets_native = function () {
+ const testView = new Button();
+ testView.text = initial;
+ testView.style.textTransform = "capitalize";
+
+ executeTransformTest(testView, androidText, function (v) { return (v.ios).titleForState(UIControlState.Normal); });
+};
+
+export const test_setting_label_textTransform_and_textDecoration_sets_native = function () {
+ const testView = new Label();
+ testView.text = initial;
+ testView.style.textTransform = "capitalize";
+ testView.style.textDecoration = "underline";
+
+ executeTransformTest(testView, androidText, iOSText);
+};
+
export const test_setting_button_textTransform_and_textDecoration_sets_native = function () {
const testView = new Button();
testView.text = initial;
@@ -878,16 +878,16 @@ function assertPercentLengthParseInputOutputPairs(pairs: [string, any][]) {
export function test_PercentLength_parses_pixel_values_from_string_input() {
assertPercentLengthParseInputOutputPairs([
- ["4px", {unit: "px", value: 4}],
- ["-4px", {unit: "px", value: -4}],
+ ["4px", { unit: "px", value: 4 }],
+ ["-4px", { unit: "px", value: -4 }],
]);
}
export function test_PercentLength_parses_percentage_values_from_string_input() {
assertPercentLengthParseInputOutputPairs([
- ["4%", {unit: "%", value: 0.04}],
- ["17%", {unit: "%", value: 0.17}],
- ["-27%", {unit: "%", value: -0.27}],
+ ["4%", { unit: "%", value: 0.04 }],
+ ["17%", { unit: "%", value: 0.17 }],
+ ["-27%", { unit: "%", value: -0.27 }],
]);
}
@@ -910,7 +910,7 @@ export function test_PercentLength_returns_unsupported_types_untouched() {
const inputs: any[] = [
null,
undefined,
- {baz: true}
+ { baz: true }
];
inputs.forEach((input) => {
const result = PercentLength.parse(input);
diff --git a/tests/app/ui/styling/style-tests.ts b/tests/app/ui/styling/style-tests.ts
index ffe9873ca..6512d0f42 100644
--- a/tests/app/ui/styling/style-tests.ts
+++ b/tests/app/ui/styling/style-tests.ts
@@ -1,4 +1,4 @@
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import * as application from "tns-core-modules/application";
import * as buttonModule from "tns-core-modules/ui/button";
import * as labelModule from "tns-core-modules/ui/label";
@@ -6,12 +6,13 @@ import * as pageModule from "tns-core-modules/ui/page";
import * as stackModule from "tns-core-modules/ui/layouts/stack-layout";
import * as wrapModule from "tns-core-modules/ui/layouts/wrap-layout";
import * as tabViewModule from "tns-core-modules/ui/tab-view";
-import * as helper from "../../ui/helper";
+import * as helper from "../../ui-helper";
import * as types from "tns-core-modules/utils/types";
import * as viewModule from "tns-core-modules/ui/core/view";
import { resolveFileNameFromUrl, removeTaggedAdditionalCSS, addTaggedAdditionalCSS } from "tns-core-modules/ui/styling/style-scope";
import { unsetValue } from "tns-core-modules/ui/core/view";
import * as color from "tns-core-modules/color";
+import * as fs from "tns-core-modules/file-system";
export function test_css_dataURI_is_applied_to_backgroundImageSource() {
const stack = new stackModule.StackLayout();
@@ -279,7 +280,7 @@ export function test_class_and_state_selector() {
page.style.color = unsetValue;
let btn = new buttonModule.Button();
- btn.className = "test"
+ btn.className = "test";
let testStack = new stackModule.StackLayout();
page.content = testStack;
@@ -297,7 +298,7 @@ export function test_class_and_state_selector_with_multiple_classes() {
let testStack = new stackModule.StackLayout();
page.content = testStack;
- btn.className = "test otherClass"
+ btn.className = "test otherClass";
testStack.addChild(btn);
page.css = ".test:pressed { color: red; }";
@@ -362,10 +363,10 @@ export const test_composite_selector_type_and_class = function () {
TKUnit.assert(btnWithClass.style.color.hex === "#FF0000", "Color property no applied correctly.");
TKUnit.assert(btnWithNoClass.style.color === undefined, "btnWithNoClass color should not have a value");
TKUnit.assert(lblWithClass.style.color === undefined, "lblWithClass color should not have a value");
- }
+ };
helper.buildUIAndRunTest(testStack, testFunc, { pageCss: testCss });
-}
+};
export const test_composite_selector_type_class_state = function () {
const testStack = new stackModule.StackLayout();
@@ -393,9 +394,9 @@ export const test_composite_selector_type_class_state = function () {
TKUnit.assertNull(btnWithNoClass.style.color, "Color should not have a value.");
TKUnit.assertNull(lblWithClass.style.color, "Color should not have a value");
- }
+ };
helper.buildUIAndRunTest(testStack, testFunc, { pageCss: testCss });
-}
+};
export const test_style_is_applied_when_control_is_added_after_load = function () {
let page = helper.getClearCurrentPage();
@@ -407,7 +408,7 @@ export const test_style_is_applied_when_control_is_added_after_load = function (
testStack.addChild(btn);
TKUnit.assert(btn.style.color, "Color property no applied correctly.");
TKUnit.assertEqual(btn.style.color.hex, "#FF0000", "Color property not applied correctly.");
-}
+};
const changeIdOrClassTestCss =
"button { background-color: #111111 } " +
@@ -587,7 +588,7 @@ function testSelectorsPrioritiesTemplate(css: string) {
btnWithId = new buttonModule.Button();
btnWithId.className = "button-class";
- btnWithId.id = "myButton"
+ btnWithId.id = "myButton";
testStack.addChild(btnWithId);
page.css = css;
@@ -647,7 +648,7 @@ export function test_CSS_isAppliedOnPage_From_Import() {
helper.buildUIAndRunTest(testButton, function (views: Array) {
const page: pageModule.Page = views[1];
- page.css = "@import url('~/ui/styling/test.css');";
+ page.css = "@import url('ui/styling/test-page.css');";
helper.assertViewBackgroundColor(page, "#FF0000");
});
}
@@ -658,7 +659,7 @@ export function test_CSS_isAppliedOnPage_From_Import_Without_Url() {
helper.buildUIAndRunTest(testButton, function (views: Array) {
const page: pageModule.Page = views[1];
- page.css = "@import '~/ui/styling/test.css';";
+ page.css = "@import 'ui/styling/test-page.css';";
helper.assertViewBackgroundColor(page, "#FF0000");
});
}
@@ -669,7 +670,7 @@ export function test_CSS_isAppliedOnPage_From_addCssFile() {
helper.buildUIAndRunTest(testButton, function (views: Array) {
const page: pageModule.Page = views[1];
- page.addCssFile("~/ui/styling/test.css");
+ page.addCssFile(fs.knownFolders.currentApp().path + "/ui/styling/test-page.css");
helper.assertViewBackgroundColor(page, "#FF0000");
});
}
@@ -683,10 +684,10 @@ export function test_CSS_isAppliedOnPage_From_changeCssFile() {
const testFunc = function (views: Array) {
helper.assertViewColor(testButton, "#0000FF");
const page: pageModule.Page = views[1];
- page.changeCssFile("~/ui/styling/test.css");
+ page.changeCssFile(fs.knownFolders.currentApp().path + "/ui/styling/test-page.css");
helper.assertViewBackgroundColor(page, "#FF0000");
TKUnit.assert(testButton.style.color === undefined, "Color should not have a value");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -757,7 +758,7 @@ export function test_basic_hierarchical_selectors() {
let testFunc = function (views: Array) {
helper.assertViewBackgroundColor(stack.getViewById("testButton1"), "#FF0000");
helper.assertViewBackgroundColor(stack.getViewById("testButton2"), "#FF0000");
- }
+ };
helper.buildUIAndRunTest(stack, testFunc, { pageCss: testCss });
}
@@ -783,7 +784,7 @@ export function test_basic_hierarchical_direct_child_selectors() {
helper.assertViewBackgroundColor(stack.getViewById("testButton1"), "#FF0000");
// only buttons that are direct children of StackLayout should have red background color
helper.assertViewBackgroundColor(stack.getViewById("testButton2"), "#00FF00");
- }
+ };
helper.buildUIAndRunTest(stack, testFunc, { pageCss: testCss });
}
@@ -809,7 +810,7 @@ export function test_basic_hierarchical_direct_child_more_levels_selectors() {
helper.assertViewBackgroundColor(stack.getViewById("testButton1"), "#00FF00");
// only buttons that are direct children of StackLayout and WrapLayout should have red background color
helper.assertViewBackgroundColor(stack.getViewById("testButton2"), "#FF0000");
- }
+ };
helper.buildUIAndRunTest(stack, testFunc, { pageCss: testCss });
}
@@ -837,7 +838,7 @@ export function test_hierarchical_direct_child_more_levels_diff_selector_types()
helper.assertViewBackgroundColor(stack.getViewById("testButton1"), "#00FF00");
// only buttons that are direct children of StackLayout and WrapLayout should have red background color
helper.assertViewBackgroundColor(stack.getViewById("testButton2"), "#FF0000");
- }
+ };
helper.buildUIAndRunTest(stack, testFunc, { pageCss: testCss });
}
@@ -866,7 +867,7 @@ export function test_hierarchical_direct_child_more_levels_diff_selector_types2(
helper.assertViewBackgroundColor(stack.getViewById("testButton1"), "#00FF00");
// only buttons that are direct children of Layout with id stack and Layout with cssClass wraplayoutClass should have red background color
helper.assertViewBackgroundColor(stack.getViewById("testButton2"), "#FF0000");
- }
+ };
helper.buildUIAndRunTest(stack, testFunc, { pageCss: testCss });
}
@@ -895,7 +896,7 @@ export function test_hierarchical_direct_child_more_levels_diff_selector_types_i
helper.assertViewBackgroundColor(stack.getViewById("testButton1"), "#00FF00");
// this is an invalid css so red style should not be applied
helper.assertViewBackgroundColor(stack.getViewById("testButton2"), "#00FF00");
- }
+ };
helper.buildUIAndRunTest(stack, testFunc, { pageCss: testCss });
}
@@ -924,7 +925,7 @@ export function test_hierarchical_direct_child_more_levels_diff_selector_types_i
helper.assertViewBackgroundColor(stack.getViewById("testButton1"), "#00FF00");
// this is an invalid css so red style should not be applied
helper.assertViewBackgroundColor(stack.getViewById("testButton2"), "#00FF00");
- }
+ };
helper.buildUIAndRunTest(stack, testFunc, { pageCss: testCss });
}
@@ -937,7 +938,7 @@ export function test_type_attr_selector() {
let testFunc = function (views: Array) {
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -950,7 +951,7 @@ export function test_class_attr_selector() {
let testFunc = function (views: Array) {
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -963,7 +964,7 @@ export function test_id_attr_selector() {
let testFunc = function (views: Array) {
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -975,7 +976,7 @@ export function test_type_attr_value_selector() {
let testFunc = function (views: Array) {
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -988,7 +989,7 @@ export function test_type_attr_invalid_value_selector() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#00FF00");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1001,7 +1002,7 @@ export function test_tilde_attr_selector_correct_syntax() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1014,7 +1015,7 @@ export function test_tilde_attr_selector_correct_syntax1() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1027,7 +1028,7 @@ export function test_tilde_attr_selector_correct_syntax2() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1040,7 +1041,7 @@ export function test_tilde_attr_selector_incorrect_syntax() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#00FF00");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1053,7 +1054,7 @@ export function test_tilde_attr_selector_incorrect_syntax1() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#00FF00");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1066,7 +1067,7 @@ export function test_tilde_attr_selector_incorrect_syntax2() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#00FF00");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1079,7 +1080,7 @@ export function test_pipe_attr_selector_correct_syntax() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1092,7 +1093,7 @@ export function test_pipe_attr_selector_correct_syntax1() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1105,7 +1106,7 @@ export function test_pipe_attr_selector_incorrect_syntax() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#00FF00");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1118,7 +1119,7 @@ export function test_pipe_attr_selector_incorrect_syntax1() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#00FF00");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1131,7 +1132,7 @@ export function test_pipe_attr_selector_incorrect_syntax2() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#00FF00");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1144,7 +1145,7 @@ export function test_power_attr_selector_correct_syntax() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1157,7 +1158,7 @@ export function test_power_attr_selector_correct_syntax1() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1170,7 +1171,7 @@ export function test_power_attr_selector_correct_synta2() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1183,7 +1184,7 @@ export function test_power_attr_selector_incorrect_syntax() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#00FF00");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1196,7 +1197,7 @@ export function test_power_attr_selector_incorrect_syntax1() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#00FF00");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1209,7 +1210,7 @@ export function test_dollar_attr_selector_correct_syntax() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1222,7 +1223,7 @@ export function test_dollar_attr_selector_correct_syntax1() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1235,7 +1236,7 @@ export function test_dollar_attr_selector_correct_syntax2() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1248,7 +1249,7 @@ export function test_dollar_attr_selector_incorrect_syntax() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#00FF00");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1261,7 +1262,7 @@ export function test_dollar_attr_selector_incorrect_syntax1() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#00FF00");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1274,7 +1275,7 @@ export function test_dollar_attr_selector_incorrect_syntax2() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#00FF00");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1287,7 +1288,7 @@ export function test_star_attr_selector_correct_syntax() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1300,7 +1301,7 @@ export function test_star_attr_selector_correct_syntax1() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1313,7 +1314,7 @@ export function test_star_attr_selector_correct_syntax2() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1326,7 +1327,7 @@ export function test_star_attr_selector_correct_syntax3() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1339,7 +1340,7 @@ export function test_star_attr_selector_correct_syntax4() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1352,7 +1353,7 @@ export function test_star_attr_selector_correct_syntax5() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#FF0000");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1365,7 +1366,7 @@ export function test_star_attr_selector_incorrect_syntax() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#00FF00");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1378,7 +1379,7 @@ export function test_alone_attr_selector() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#00FF00");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1391,7 +1392,7 @@ export function test_UsingSameSelectors_ShouldApplyLatest() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#00FF00");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
@@ -1404,7 +1405,7 @@ export function test_UsingSameSelectorsWithSpecific_ShouldApplyLatest() {
let testFunc = function (views: Array) {
// style from correct type css should be applied
helper.assertViewBackgroundColor(testButton, "#00FF00");
- }
+ };
helper.buildUIAndRunTest(testButton, testFunc, { pageCss: testCss });
}
diff --git a/tests/app/ui/styling/test.css b/tests/app/ui/styling/test-page.css
similarity index 100%
rename from tests/app/ui/styling/test.css
rename to tests/app/ui/styling/test-page.css
diff --git a/tests/app/ui/styling/value-source-tests.ts b/tests/app/ui/styling/value-source-tests.ts
index c94522911..2e72c0690 100644
--- a/tests/app/ui/styling/value-source-tests.ts
+++ b/tests/app/ui/styling/value-source-tests.ts
@@ -1,8 +1,8 @@
import * as color from "tns-core-modules/color";
import * as button from "tns-core-modules/ui/button";
import * as stack from "tns-core-modules/ui/layouts/stack-layout";
-import * as helper from "../helper";
-import * as TKUnit from "../../TKUnit";
+import * as helper from "../../ui-helper";
+import * as TKUnit from "../../tk-unit";
import { unsetValue } from "tns-core-modules/ui/core/view";
export var test_value_Inherited_after_unset = function () {
@@ -16,7 +16,7 @@ export var test_value_Inherited_after_unset = function () {
helper.assertViewColor(btn, "#0000FF");
btn.className = "";
helper.assertViewColor(btn, "#FF0000");
-}
+};
export var test_value_Inherited_stronger_than_Default = function () {
let page = helper.getCurrentPage();
@@ -27,7 +27,7 @@ export var test_value_Inherited_stronger_than_Default = function () {
page.css = "stackLayout { color: red; }";
helper.assertViewColor(btn, "#FF0000");
page.css = "";
-}
+};
export var test_value_Css_stronger_than_Inherited = function () {
let page = helper.getCurrentPage();
@@ -39,7 +39,7 @@ export var test_value_Css_stronger_than_Inherited = function () {
page.css = "stackLayout { color: red; } button { color: blue; }";
helper.assertViewColor(btn, "#0000FF");
-}
+};
export function test_value_Local_stronger_than_Css() {
let testPage = helper.getCurrentPage();
diff --git a/tests/app/ui/styling/visual-state-tests.ts b/tests/app/ui/styling/visual-state-tests.ts
index c2e754280..b72fabd2c 100644
--- a/tests/app/ui/styling/visual-state-tests.ts
+++ b/tests/app/ui/styling/visual-state-tests.ts
@@ -1,8 +1,8 @@
-import * as TKUnit from "../../TKUnit";
+import * as TKUnit from "../../tk-unit";
import * as view from "tns-core-modules/ui/core/view";
import * as page from "tns-core-modules/ui/page";
import * as types from "tns-core-modules/utils/types";
-import * as helper from "../helper";
+import * as helper from "../../ui-helper";
function assertInState(view: view.View, state: string, knownStates: string[]): void {
let pseudo = view.cssPseudoClasses;
@@ -35,10 +35,10 @@ export var test_goToVisualState = function () {
TKUnit.assert(types.isDefined(btn.style.color) && btn.style.color.name === "white");
TKUnit.assert(types.isDefined(btn.style.backgroundColor) && btn.style.backgroundColor.name === "black");
- }
+ };
helper.do_PageTest_WithButton(test);
-}
+};
export var test_goToVisualState_NoState_ShouldResetStyledProperties = function () {
var test = function (views: Array) {
@@ -61,10 +61,10 @@ export var test_goToVisualState_NoState_ShouldResetStyledProperties = function (
// properties are reset (set to undefined)
TKUnit.assert(types.isUndefined(btn.style.color));
TKUnit.assert(types.isUndefined(btn.style.backgroundColor));
- }
+ };
helper.do_PageTest_WithButton(test);
-}
+};
export var test_goToVisualState_NoState_ShouldGoToNormal = function () {
var test = function (views: Array) {
@@ -88,7 +88,7 @@ export var test_goToVisualState_NoState_ShouldGoToNormal = function () {
// the actual state is "normal" and properties are reverted to these settings (if any)
TKUnit.assert(types.isDefined(btn.style.color) && btn.style.color.name === "orange");
TKUnit.assert(types.isDefined(btn.style.backgroundColor) && btn.style.backgroundColor.name === "black");
- }
+ };
helper.do_PageTest_WithButton(test);
-}
+};
diff --git a/tests/app/ui/switch/switch-tests.ts b/tests/app/ui/switch/switch-tests.ts
index dd2789258..0da19f252 100644
--- a/tests/app/ui/switch/switch-tests.ts
+++ b/tests/app/ui/switch/switch-tests.ts
@@ -1,5 +1,5 @@
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import * as viewModule from "tns-core-modules/ui/core/view";
import * as bindable from "tns-core-modules/ui/core/bindable";
import * as observable from "tns-core-modules/data/observable";
@@ -37,7 +37,7 @@ export function test_default_native_values() {
function testAction(views: Array) {
TKUnit.assertEqual(getNativeValue(mySwitch), false, "Default native switch.checked");
- };
+ }
helper.buildUIAndRunTest(mySwitch, testAction);
}
@@ -50,10 +50,10 @@ if (platform.device.os === platform.platformNames.ios) {
function testAction(views: Array) {
TKUnit.assert(mySwitch.color.ios.isEqual(mySwitch.ios.thumbTintColor), "mySwitch.color");
- };
+ }
helper.buildUIAndRunTest(mySwitch, testAction);
- }
+ };
exports.test_set_backgroundColor = function () {
var mySwitch = new switchModule.Switch();
@@ -61,10 +61,10 @@ if (platform.device.os === platform.platformNames.ios) {
function testAction(views: Array) {
TKUnit.assert(CGColorEqualToColor((mySwitch.backgroundColor).ios.CGColor, mySwitch.ios.onTintColor.CGColor), "mySwitch.color");
- };
+ }
helper.buildUIAndRunTest(mySwitch, testAction);
- }
+ };
}
export function test_set_TNS_checked_updates_native_checked() {
@@ -74,7 +74,7 @@ export function test_set_TNS_checked_updates_native_checked() {
mySwitch.checked = true;
// << article-setting-checked-property
TKUnit.assertEqual(getNativeValue(mySwitch), true, "Native checked is different from TNS checked.");
- };
+ }
helper.buildUIAndRunTest(mySwitch, testAction);
}
@@ -84,7 +84,7 @@ export function test_set_native_checked_updates_TNS_checked() {
function testAction(views: Array) {
setNativeValue(mySwitch, true);
TKUnit.assertEqual(mySwitch.checked, true, "Native checked is different from TNS checked.");
- };
+ }
helper.buildUIAndRunTest(mySwitch, testAction);
}
@@ -111,10 +111,10 @@ export function test_set_native_checked_triggers_propertyChanged() {
}
helper.buildUIAndRunTest(mySwitch, testAction);
-};
+}
export function test_binding_value_to_model() {
- var mySwitch = new switchModule.Switch()
+ var mySwitch = new switchModule.Switch();
function testAction(views: Array) {
// >> aricle-binding-checked-property
@@ -143,6 +143,7 @@ export function test_binding_value_to_model() {
function getNativeValue(mySwitch: switchModule.Switch): boolean {
if (platform.isAndroid) {
const nativeView: android.widget.Switch = mySwitch.nativeViewProtected;
+
return nativeView.isChecked();
} else if (mySwitch.ios) {
return mySwitch.ios.on;
diff --git a/tests/app/ui/tab-view/tab-view-navigation-tests.ts b/tests/app/ui/tab-view/tab-view-navigation-tests.ts
index 920efc45f..54cb4489e 100644
--- a/tests/app/ui/tab-view/tab-view-navigation-tests.ts
+++ b/tests/app/ui/tab-view/tab-view-navigation-tests.ts
@@ -1,10 +1,10 @@
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import { isIOS, isAndroid } from "tns-core-modules/platform";
import { Label } from "tns-core-modules/ui/label";
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
import * as frameModule from "tns-core-modules/ui/frame";
-import { Page, NavigatedData } from "tns-core-modules/ui/page";
+import { Page } from "tns-core-modules/ui/page";
import { ListView, ItemEventData } from "tns-core-modules/ui/list-view";
import { TabView, TabViewItem } from "tns-core-modules/ui/tab-view";
import { Button } from "tns-core-modules/ui/button";
@@ -14,6 +14,7 @@ var ASYNC = 2;
function _createTabView(): TabView {
var tabView = new TabView();
tabView.id = "TabView";
+
return tabView;
}
@@ -28,6 +29,7 @@ function _createItems(count: number): Array {
tabEntry["index"] = i;
items.push(tabEntry);
}
+
return items;
}
@@ -61,16 +63,18 @@ function _clickHandlerFactory(index: number) {
var detailsPage = new Page();
detailsPage.id = "details-page";
detailsPage.content = detailsLabel;
+
return detailsPage;
};
helper.navigateWithHistory(pageFactory);
- }
+ };
}
function _createFrameView(): frameModule.Frame {
const frame = new frameModule.Frame();
frame.navigate({ create: () => new Page() });
+
return frame;
}
@@ -101,7 +105,7 @@ export function testBackNavigationToTabViewWithNestedFramesShouldWork() {
tabViewPage.content = tabView;
return tabViewPage;
- }
+ };
helper.waitUntilNavigatedFrom(() => topFrame.navigate(pageFactory), topFrame);
@@ -121,12 +125,6 @@ export function testBackNavigationToTabViewWithNestedFramesShouldWork() {
export function testWhenNavigatingBackToANonCachedPageContainingATabViewWithAListViewTheListViewIsThere() {
var topFrame = frameModule.topmost();
- let oldChache;
- if (topFrame.android) {
- oldChache = topFrame.android.cachePagesOnNavigate;
- topFrame.android.cachePagesOnNavigate = true;
- }
-
let tabViewPage: Page;
let tabView: TabView;
@@ -155,7 +153,7 @@ export function testWhenNavigatingBackToANonCachedPageContainingATabViewWithALis
tabViewPage.content = tabView;
return tabViewPage;
- }
+ };
let rootPage = helper.getCurrentPage();
@@ -173,10 +171,6 @@ export function testWhenNavigatingBackToANonCachedPageContainingATabViewWithALis
TKUnit.waitUntilReady(() => topFrame.currentPage === rootPage);
- if (topFrame.android) {
- topFrame.android.cachePagesOnNavigate = oldChache;
- }
-
TKUnit.assert(tabView.items[0].view instanceof ListView, "ListView should be created when navigating back to the main page.");
}
@@ -214,13 +208,13 @@ export function testLoadedAndUnloadedAreFired_WhenNavigatingAwayAndBack() {
function createLoadedFor(tabIndex: number) {
return function () {
loadedEventsCount[tabIndex] = loadedEventsCount[tabIndex] + 1;
- }
+ };
}
function createUnloadedFor(tabIndex: number) {
return function () {
unloadedEventsCount[tabIndex] = unloadedEventsCount[tabIndex] + 1;
- }
+ };
}
tabView.items.forEach((item, i) => {
@@ -231,6 +225,7 @@ export function testLoadedAndUnloadedAreFired_WhenNavigatingAwayAndBack() {
const tabViewPage = new Page();
helper.navigateWithHistory(() => {
tabViewPage.content = tabView;
+
return tabViewPage;
});
TKUnit.waitUntilReady(() => tabViewIsFullyLoaded(tabView), ASYNC);
@@ -277,4 +272,4 @@ function _clickTheFirstButtonInTheListViewNatively(tabView: TabView) {
const btn = cell.contentView.subviews[0];
btn.sendActionsForControlEvents(UIControlEvents.TouchUpInside);
}
-}
\ No newline at end of file
+}
diff --git a/tests/app/ui/tab-view/tab-view-root-tests.ts b/tests/app/ui/tab-view/tab-view-root-tests.ts
index eb181e589..672c1dc2a 100644
--- a/tests/app/ui/tab-view/tab-view-root-tests.ts
+++ b/tests/app/ui/tab-view/tab-view-root-tests.ts
@@ -1,4 +1,4 @@
-import TKUnit = require("../../TKUnit");
+import * as TKUnit from "../../tk-unit";
import { isAndroid } from "tns-core-modules/platform";
import { _resetRootView } from "tns-core-modules/application/";
import { Frame, NavigationEntry, topmost } from "tns-core-modules/ui/frame";
diff --git a/tests/app/ui/tab-view/tab-view-tests-native.android.ts b/tests/app/ui/tab-view/tab-view-tests-native.android.ts
index 4edbda3f1..b1f11b753 100644
--- a/tests/app/ui/tab-view/tab-view-tests-native.android.ts
+++ b/tests/app/ui/tab-view/tab-view-tests-native.android.ts
@@ -1,7 +1,8 @@
-import { TabView } from "tns-core-modules/ui/tab-view";
+import { TabView } from "tns-core-modules/ui/tab-view";
export function getNativeTabCount(tabView: TabView): number {
const pagerAdapter: androidx.viewpager.widget.PagerAdapter = (tabView)._pagerAdapter;
+
return pagerAdapter ? pagerAdapter.getCount() : 0;
}
@@ -14,6 +15,7 @@ export function selectNativeTab(tabView: TabView, index: number): void {
export function getNativeSelectedIndex(tabView: TabView): number {
const viewPager: androidx.viewpager.widget.ViewPager = (tabView)._viewPager;
+
return viewPager ? viewPager.getCurrentItem() : -1;
}
@@ -23,7 +25,7 @@ export function getNativeFont(tabView: TabView): any {
return {
typeface: tv.getTypeface(),
size: tv.getTextSize()
- }
+ };
}
return null;
@@ -31,8 +33,9 @@ export function getNativeFont(tabView: TabView): any {
export function getOriginalFont(tabView: TabView): any {
const tv: android.widget.TextView = ((tabView)._tabLayout).getTextViewForItemAt(0);
+
return {
typeface: tv.getTypeface(),
size: tv.getTextSize()
- }
+ };
}
\ No newline at end of file
diff --git a/tests/app/ui/tab-view/tab-view-tests-native.ios.ts b/tests/app/ui/tab-view/tab-view-tests-native.ios.ts
index 47cea99ca..5d197bd12 100644
--- a/tests/app/ui/tab-view/tab-view-tests-native.ios.ts
+++ b/tests/app/ui/tab-view/tab-view-tests-native.ios.ts
@@ -1,6 +1,4 @@
import tabViewModule = require("tns-core-modules/ui/tab-view");
-import * as utils from "tns-core-modules/utils/utils";
-import getter = utils.ios.getter;
export function getNativeTabCount(tabView: tabViewModule.TabView): number {
if (!tabView.ios.viewControllers) {
@@ -33,4 +31,4 @@ export function getNativeFont(tabView: tabViewModule.TabView): UIFont {
export function getOriginalFont(tabView: tabViewModule.TabView): UIFont {
return tabView.style.fontInternal.getUIFont(UIFont.systemFontOfSize(10));
-}
\ No newline at end of file
+}
diff --git a/tests/app/ui/tab-view/tab-view-tests.ts b/tests/app/ui/tab-view/tab-view-tests.ts
index 75ccad938..3d12fa7dd 100644
--- a/tests/app/ui/tab-view/tab-view-tests.ts
+++ b/tests/app/ui/tab-view/tab-view-tests.ts
@@ -2,8 +2,8 @@ import { UITest } from "../../ui-test";
import { Label } from "tns-core-modules/ui/label";
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
import { unsetValue } from "tns-core-modules/ui/core/view";
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import * as tabViewTestsNative from "./tab-view-tests-native";
// Using a TabView requires the "ui/tab-view" module.
@@ -18,6 +18,7 @@ export class TabViewTest extends UITest {
var tabView = new tabViewModule.TabView();
// << article-create-tabview
tabView.id = "TabView";
+
return tabView;
}
@@ -37,6 +38,7 @@ export class TabViewTest extends UITest {
tabEntry.view = label;
items.push(tabEntry);
}
+
return items;
}
@@ -70,11 +72,11 @@ export class TabViewTest extends UITest {
public testWhenTabViewIsCreatedItemsAreUndefined = function () {
TKUnit.assertEqual(this.testView.items, undefined, "Items should be undefined initally.");
- }
+ };
public testWhenTabViewIsCreatedSelectedIndexIsUndefined = function () {
TKUnit.assertEqual(this.testView.selectedIndex, -1, "selectedIndex should be undefined initally.");
- }
+ };
public testWhenSettingItemsToNonEmptyArrayTheSameAmountOfNativeTabsIsCreated = function () {
this.testView.items = this._createItems(10);
@@ -84,7 +86,7 @@ export class TabViewTest extends UITest {
let actualValue = tabViewTestsNative.getNativeTabCount(this.testView);
TKUnit.assertEqual(actualValue, expectedValue, "NativeItems not equal to JS items.");
- }
+ };
public testWhenSettingItemsToEmptyArrayZeroNativeTabsAreCreated = function () {
var tabView = this.testView;
@@ -95,7 +97,7 @@ export class TabViewTest extends UITest {
var actualValue = tabViewTestsNative.getNativeTabCount(tabView);
TKUnit.assertEqual(actualValue, expectedValue, "Should have 0 native tabs.");
- }
+ };
public testSelectedIndexBecomesZeroWhenItemsBoundToNonEmptyArray = function () {
var tabView = this.testView;
@@ -125,7 +127,7 @@ export class TabViewTest extends UITest {
var expectedValue = 0;
var actualValue = tabView.selectedIndex;
TKUnit.assertEqual(actualValue, expectedValue, "When bound selectedIndex should be 0.");
- }
+ };
public testSelectedIndexBecomesUndefinedWhenItemsBoundToEmptyArray = function () {
@@ -141,7 +143,7 @@ export class TabViewTest extends UITest {
var expectedValue = -1;
var actualValue = tabView.selectedIndex;
TKUnit.assertEqual(actualValue, expectedValue, "selectedIndex should be undefined.");
- }
+ };
public testSelectedIndexBecomesUndefinedWhenItemsSetToUndefined = function () {
var tabView = this.testView;
@@ -153,7 +155,7 @@ export class TabViewTest extends UITest {
var expectedValue = -1;
var actualValue = tabView.selectedIndex;
TKUnit.assertEqual(actualValue, expectedValue, "selectedIndex should be undefined.");
- }
+ };
public testSelectedIndexBecomesUndefinedWhenItemsSetToNull = function () {
var tabView = this.testView;
@@ -165,7 +167,7 @@ export class TabViewTest extends UITest {
var expectedValue = -1;
var actualValue = tabView.selectedIndex;
TKUnit.assertEqual(actualValue, expectedValue, "selectedIndex should be undefined.");
- }
+ };
public testItemsIsResolvedCorrectlyIfSetBeforeViewIsLoaded = function () {
var tabView = this.testView;
@@ -176,7 +178,7 @@ export class TabViewTest extends UITest {
var actualValue = tabView.items.length;
TKUnit.assertEqual(actualValue, expectedValue, "items.length should be 10");
- }
+ };
public testSelectedIndexIsResolvedCorrectlyIfSetBeforeViewIsLoaded = function () {
var tabView = this.testView;
@@ -187,7 +189,7 @@ export class TabViewTest extends UITest {
var actualValue = tabView.selectedIndex;
TKUnit.assertEqual(actualValue, expectedValue, "selectedIndex");
- }
+ };
public testBindingToTabEntryWithUndefinedViewShouldThrow = function () {
var tabView = this.testView;
@@ -200,7 +202,7 @@ export class TabViewTest extends UITest {
tabView.items = [item];
}, "Binding TabView to a TabViewItem with undefined view should throw.");
- }
+ };
public testBindingToTabEntryWithNullViewShouldThrow = function () {
var tabView = this.testView;
@@ -213,7 +215,7 @@ export class TabViewTest extends UITest {
tabView.items = [item];
}, "Binding TabView to a TabViewItem with null view should throw.");
- }
+ };
public testWhenSelectingATabNativelySelectedIndexIsUpdatedProperly = function () {
var tabView = this.testView;
@@ -228,7 +230,7 @@ export class TabViewTest extends UITest {
var actualValue = tabView.selectedIndex;
TKUnit.assertEqual(actualValue, expectedValue, "selectedIndex");
- }
+ };
public testWhenSelectingATabNativelySelectedIndexChangedEventIsRaised = function () {
var tabView = this.testView;
@@ -259,7 +261,7 @@ export class TabViewTest extends UITest {
TKUnit.assertEqual(actualOldIndex, expectedOldIndex, "expectedOldIndex");
TKUnit.assertEqual(actualNewIndex, expectedNewIndex, "expectedNewIndex");
- }
+ };
public testWhenSettingSelectedIndexProgramaticallySelectedIndexChangedEventIsRaised = function () {
var tabView = this.testView;
@@ -279,7 +281,7 @@ export class TabViewTest extends UITest {
tabView.on(tabViewModule.TabView.selectedIndexChangedEvent, (args: tabViewModule.SelectedIndexChangedEventData) => {
actualOldIndex = args.oldIndex;
actualNewIndex = args.newIndex;
- TKUnit.assertEqual(args.object, tabView, "args.object should be TabView")
+ TKUnit.assertEqual(args.object, tabView, "args.object should be TabView");
});
tabView.selectedIndex = expectedNewIndex;
@@ -289,7 +291,7 @@ export class TabViewTest extends UITest {
TKUnit.assertEqual(actualOldIndex, expectedOldIndex, "expectedOldIndex");
TKUnit.assertEqual(actualNewIndex, expectedNewIndex, "expectedNewIndex");
- }
+ };
public test_FontIsReappliedWhenTabItemsChange = function () {
const assertFontsAreEqual = (actual: any, expected: any, message?: string) => {
@@ -299,7 +301,7 @@ export class TabViewTest extends UITest {
TKUnit.assertEqual(actual.typeface, expected.typeface, `${message} [typeface]`);
TKUnit.assertEqual(actual.size, expected.size, `${message} [size]`);
}
- }
+ };
this.testView.items = this._createItems(1);
this.waitUntilSelectedItemIsFullyLoaded();
@@ -325,7 +327,7 @@ export class TabViewTest extends UITest {
this.testView.style.font = unsetValue;
assertFontsAreEqual(tabViewTestsNative.getNativeFont(this.testView), originalFont, "Font must be the original one after resetting the style.");
- }
+ };
}
export function createTestCase(): TabViewTest {
diff --git a/tests/app/ui/tabs/tabs-navigation-tests.ts b/tests/app/ui/tabs/tabs-navigation-tests.ts
index c21d71015..d06b06331 100644
--- a/tests/app/ui/tabs/tabs-navigation-tests.ts
+++ b/tests/app/ui/tabs/tabs-navigation-tests.ts
@@ -1,10 +1,9 @@
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
-import { isIOS, isAndroid } from "tns-core-modules/platform";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import { Label } from "tns-core-modules/ui/label";
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
import * as frameModule from "tns-core-modules/ui/frame";
-import { Page, NavigatedData } from "tns-core-modules/ui/page";
+import { Page } from "tns-core-modules/ui/page";
import { ListView, ItemEventData } from "tns-core-modules/ui/list-view";
import { Tabs, TabContentItem, TabStrip, TabStripItem } from "tns-core-modules/ui/tabs";
import { Button } from "tns-core-modules/ui/button";
@@ -14,6 +13,7 @@ var ASYNC = 2;
function _createBottomNavigation(): Tabs {
var tabView = new Tabs();
tabView.id = "BottomNavigation";
+
return tabView;
}
@@ -26,6 +26,7 @@ function _createContentItems(count: number): Array {
tabEntry.view = label;
items.push(tabEntry);
}
+
return items;
}
@@ -73,16 +74,18 @@ function _clickHandlerFactory(index: number) {
var detailsPage = new Page();
detailsPage.id = "details-page";
detailsPage.content = detailsLabel;
+
return detailsPage;
};
helper.navigateWithHistory(pageFactory);
- }
+ };
}
function _createFrameView(): frameModule.Frame {
const frame = new frameModule.Frame();
frame.navigate({ create: () => new Page() });
+
return frame;
}
@@ -114,7 +117,7 @@ export function testBackNavigationToTabViewWithNestedFramesShouldWork() {
tabViewPage.content = tabView;
return tabViewPage;
- }
+ };
helper.waitUntilNavigatedFrom(() => topFrame.navigate(pageFactory), topFrame);
@@ -134,12 +137,6 @@ export function testBackNavigationToTabViewWithNestedFramesShouldWork() {
export function testWhenNavigatingBackToANonCachedPageContainingATabViewWithAListViewTheListViewIsThere() {
var topFrame = frameModule.topmost();
- let oldChache;
- if (topFrame.android) {
- oldChache = topFrame.android.cachePagesOnNavigate;
- topFrame.android.cachePagesOnNavigate = true;
- }
-
let tabViewPage: Page;
let tabView: Tabs;
@@ -169,7 +166,7 @@ export function testWhenNavigatingBackToANonCachedPageContainingATabViewWithALis
tabViewPage.content = tabView;
return tabViewPage;
- }
+ };
let rootPage = helper.getCurrentPage();
@@ -187,10 +184,6 @@ export function testWhenNavigatingBackToANonCachedPageContainingATabViewWithALis
TKUnit.waitUntilReady(() => topFrame.currentPage === rootPage);
- if (topFrame.android) {
- topFrame.android.cachePagesOnNavigate = oldChache;
- }
-
TKUnit.assert(tabView.items[0].view instanceof ListView, "ListView should be created when navigating back to the main page.");
}
@@ -229,13 +222,13 @@ export function testLoadedAndUnloadedAreFired_WhenNavigatingAwayAndBack() {
function createLoadedFor(tabIndex: number) {
return function () {
loadedEventsCount[tabIndex] = loadedEventsCount[tabIndex] + 1;
- }
+ };
}
function createUnloadedFor(tabIndex: number) {
return function () {
unloadedEventsCount[tabIndex] = unloadedEventsCount[tabIndex] + 1;
- }
+ };
}
tabView.items.forEach((item, i) => {
@@ -246,6 +239,7 @@ export function testLoadedAndUnloadedAreFired_WhenNavigatingAwayAndBack() {
const tabViewPage = new Page();
helper.navigateWithHistory(() => {
tabViewPage.content = tabView;
+
return tabViewPage;
});
TKUnit.waitUntilReady(() => tabViewIsFullyLoaded(tabView), ASYNC);
@@ -286,4 +280,4 @@ function _clickTheFirstButtonInTheListViewNatively(tabView: Tabs) {
const btn = cell.contentView.subviews[0];
btn.sendActionsForControlEvents(UIControlEvents.TouchUpInside);
}
-}
\ No newline at end of file
+}
diff --git a/tests/app/ui/tabs/tabs-root-tests.ts b/tests/app/ui/tabs/tabs-root-tests.ts
index d05282fb5..594f4622b 100644
--- a/tests/app/ui/tabs/tabs-root-tests.ts
+++ b/tests/app/ui/tabs/tabs-root-tests.ts
@@ -1,9 +1,7 @@
-import TKUnit = require("../../TKUnit");
-import { isAndroid } from "tns-core-modules/platform";
+import * as TKUnit from "../../tk-unit";
import { _resetRootView } from "tns-core-modules/application/";
import { Frame, NavigationEntry, topmost } from "tns-core-modules/ui/frame";
import { Page } from "tns-core-modules/ui/page";
-// import { TabView, TabViewItem } from "tns-core-modules/ui/tab-view";
import { Tabs, TabContentItem, TabStrip, TabStripItem } from "tns-core-modules/ui/tabs";
function waitUntilNavigatedToMaxTimeout(pages: Page[], action: Function) {
@@ -19,16 +17,6 @@ function waitUntilNavigatedToMaxTimeout(pages: Page[], action: Function) {
TKUnit.waitUntilReady(() => completed === pages.length, maxTimeout);
}
-function waitUntilTabViewReady(page: Page, action: Function) {
- action();
-
- if (isAndroid) {
- TKUnit.waitUntilReady(() => page.frame._currentEntry.fragment.isAdded());
- } else {
- TKUnit.waitUntilReady(() => page.isLoaded);
- }
-}
-
function createPage(i: number) {
const page = new Page();
page.id = `Tab${i} Frame${i} Page${i}`;
diff --git a/tests/app/ui/tabs/tabs-tests-native.android.ts b/tests/app/ui/tabs/tabs-tests-native.android.ts
index 0f43ac234..1640c79de 100644
--- a/tests/app/ui/tabs/tabs-tests-native.android.ts
+++ b/tests/app/ui/tabs/tabs-tests-native.android.ts
@@ -1,4 +1,4 @@
-import { BottomNavigation } from "tns-core-modules/ui/bottom-navigation";
+import { BottomNavigation } from "tns-core-modules/ui/bottom-navigation";
export function getNativeTabCount(tabView: BottomNavigation): number {
// there is no native tab content view implementation for Android Bottom Navigation
@@ -24,7 +24,7 @@ export function getNativeFont(tabView: BottomNavigation): any {
return {
typeface: tv.getTypeface(),
size: tv.getTextSize()
- }
+ };
}
return null;
@@ -32,8 +32,9 @@ export function getNativeFont(tabView: BottomNavigation): any {
export function getOriginalFont(tabView: BottomNavigation): any {
const tv: android.widget.TextView = ((tabView)._bottomNavigationBar).getTextViewForItemAt(0);
+
return {
typeface: tv.getTypeface(),
size: tv.getTextSize()
- }
+ };
}
\ No newline at end of file
diff --git a/tests/app/ui/tabs/tabs-tests.ts b/tests/app/ui/tabs/tabs-tests.ts
index 5ccb8323a..edb848bdc 100644
--- a/tests/app/ui/tabs/tabs-tests.ts
+++ b/tests/app/ui/tabs/tabs-tests.ts
@@ -1,8 +1,7 @@
import { UITest } from "../../ui-test";
import { Label } from "tns-core-modules/ui/label";
-import { unsetValue } from "tns-core-modules/ui/core/view";
-import * as TKUnit from "../../TKUnit";
-import * as helper from "../helper";
+import * as TKUnit from "../../tk-unit";
+import * as helper from "../../ui-helper";
import * as tabViewTestsNative from "./tabs-tests-native";
import { Tabs, TabContentItem, TabStrip, TabStripItem, SelectedIndexChangedEventData } from "tns-core-modules/ui/tabs";
@@ -12,6 +11,7 @@ export class TabsTest extends UITest {
public create(): Tabs {
var tabView = new Tabs();
tabView.id = "TabView";
+
return tabView;
}
@@ -30,6 +30,7 @@ export class TabsTest extends UITest {
tabEntry.view = label;
items.push(tabEntry);
}
+
return items;
}
@@ -77,11 +78,11 @@ export class TabsTest extends UITest {
public test_when_created_items_are_undefined = function () {
TKUnit.assertEqual(this.testView.items, undefined, "Items should be undefined initally.");
- }
+ };
public test_when_created_selected_index_is_undefined = function () {
TKUnit.assertEqual(this.testView.selectedIndex, -1, "selectedIndex should be undefined initally.");
- }
+ };
// TODO: Do we need this test? The number of tabs is dynamic and isn't kept in the native implementation.
// TODO: Maybe test if all native tabBarItems are created.
@@ -93,7 +94,7 @@ export class TabsTest extends UITest {
let actualValue = tabViewTestsNative.getNativeTabCount(this.testView);
TKUnit.assertEqual(actualValue, expectedValue, "NativeItems not equal to JS items.");
- }
+ };
// TODO: Do we need this test? The number of tabs is dynamic and isn't kept in the native implementation.
// TODO: Maybe test if all native tabBarItems are created.
@@ -106,7 +107,7 @@ export class TabsTest extends UITest {
var actualValue = tabViewTestsNative.getNativeTabCount(tabView);
TKUnit.assertEqual(actualValue, expectedValue, "Should have 0 native tabs.");
- }
+ };
public test_selected_index_becomes_zero_when_items_bound_to_non_empty_array = function () {
var tabView = this.testView;
@@ -137,7 +138,7 @@ export class TabsTest extends UITest {
var expectedValue = 0;
var actualValue = tabView.selectedIndex;
TKUnit.assertEqual(actualValue, expectedValue, "When bound selectedIndex should be 0.");
- }
+ };
public test_selected_index_becomes_undefined_when_items_bound_to_empty_array = function () {
var tabView = this.testView;
@@ -151,7 +152,7 @@ export class TabsTest extends UITest {
var expectedValue = -1;
var actualValue = tabView.selectedIndex;
TKUnit.assertEqual(actualValue, expectedValue, "selectedIndex should be undefined.");
- }
+ };
public test_selected_index_becomes_undefined_when_items_set_to_undefined = function () {
var tabView = this.testView;
@@ -165,7 +166,7 @@ export class TabsTest extends UITest {
var expectedValue = -1;
var actualValue = tabView.selectedIndex;
TKUnit.assertEqual(actualValue, expectedValue, "selectedIndex should be undefined.");
- }
+ };
public test_selected_index_becomes_undefined_when_items_set_to_null = function () {
var tabView = this.testView;
@@ -178,7 +179,7 @@ export class TabsTest extends UITest {
var expectedValue = -1;
var actualValue = tabView.selectedIndex;
TKUnit.assertEqual(actualValue, expectedValue, "selectedIndex should be undefined.");
- }
+ };
public test_items_is_resolved_correctly_if_set_before_view_is_loaded = function () {
var tabView = this.testView;
@@ -189,7 +190,7 @@ export class TabsTest extends UITest