Merge remote-tracking branch 'origin/master' into vsetoslavtsenov/merge-release-in-master

This commit is contained in:
SvetoslavTsenov
2019-08-20 01:00:52 +03:00
193 changed files with 3029 additions and 2257 deletions

1
.gitignore vendored
View File

@@ -30,6 +30,7 @@ package-lock.json
!.vscode/extensions.json
# Appium files
mochawesome-report
e2e/**/*.trace/
e2e/**/test-results.xml
e2e/**/e2e/resources/

View File

@@ -1,30 +1,5 @@
env:
global:
- DATE=$(date +%Y-%m-%d)
- PACKAGE_VERSION=$DATE-$TRAVIS_BUILD_NUMBER
language: objective-c
osx_image: xcode10.2
jdk:
- oraclejdk8
- openjdk8
script:
- export JAVA_HOME=$HOME/openjdk8
- $TRAVIS_BUILD_DIR/install-jdk.sh --install openjdk8 --target $JAVA_HOME
- # do stuff with open OpenJDK 11
- jdk_switcher use openjdk8
install:
# - brew update
# - brew cask install android-sdk
# Suppress output of sdkmanager to keep log under the 4MB limit of travis-ci
# - yes | sdkmanager "platforms;android-28" >/dev/null
# - yes | sdkmanager "build-tools;28.0.3" >/dev/null
# - yes | sdkmanager "extras;android;m2repository" >/dev/null
before_script:
# - export ANDROID_HOME=/usr/local/share/android-sdk
- npm install -g grunt-cli
- npm install
script:
# - npm run setup-widgets
- npm run setup
- cd tns-core-modules && npm i && cd ..
- npm install
- npm run tsc
- npm run tslint
- npm run tslint

View File

@@ -89,7 +89,7 @@ Use `AndroidApplication.startActivity`, `AndroidApplication.foregroundActivity`,
* `start(...)` method in `tns-core-modules/application` module is now removed.
Use `application.run(...)` method instead.
Use `application.run(...)` method instead. Check the "Flexible Frame Composition" section in [this document](https://docs.google.com/document/d/1Iia0yEr5seq4H9qk4oMuJs4-M8dgmne98fymCO5IczA/edit) that explains the full migration path from `application.start(...)` to `application.run(...)` and the implications from this change
* `loadPage(...)` method in `tns-core-modules/ui/builder` module is now removed.

View File

@@ -1,35 +0,0 @@
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

View File

@@ -1,14 +0,0 @@
Execute Tests
=============
Android:
```
npm run e2e -- --runType android23 # --devMode
```
iOS:
```
npm run e2e -- --runType sim.iPhoneX.iOS112 # --devMode
```

View File

@@ -1,3 +0,0 @@
{
"useLegacyWorkflow": false
}

View File

@@ -14,11 +14,12 @@
},
"dependencies": {
"nativescript-theme-core": "~1.0.6",
"tns-core-modules": "next"
"tns-core-modules": "file:../../tns-core-modules"
},
"devDependencies": {
"@types/chai": "~4.1.7",
"@types/mocha": "~5.2.5",
"@types/node": "~10.12.18",
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",

View File

@@ -6,24 +6,24 @@
"emitDecoratorMetadata": true,
"noEmitHelpers": true,
"noEmitOnError": true,
"skipLibCheck": true,
"lib": [
"es6",
"dom"
],
"baseUrl": ".",
"paths": {
"*": [
"./node_modules/tns-core-modules/*",
"./node_modules/*"
],
"~/*": [
"app/*"
],
"*": [
"./node_modules/*"
]
}
},
"exclude": [
"e2e",
"node_modules",
"platforms",
"e2e"
"platforms"
]
}
}

View File

@@ -1,303 +0,0 @@
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 { 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/<platform>/...
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
uglify, // --env.uglify
report, // --env.report
sourceMap, // --env.sourceMap
hiddenSourceMap, // --env.hiddenSourceMap
hmr, // --env.hmr,
unitTesting, // --env.unitTesting
} = 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");
if (platform === "ios") {
entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules.js";
};
let sourceMapFilename = nsWebpack.getSourceMapFilename(hiddenSourceMap, __dirname, dist);
const config = {
mode: uglify ? "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,
registerModules: /(root|page\d*|Page\d*)\.(xml|css|js|ts|scss)$/ // NB: MODIFIED
}
},
].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"
]
},
{
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([`${dist}/**/*`]),
// Copy assets to out dir. Add your own globs as needed.
new CopyWebpackPlugin([
{ from: { glob: "fonts/**" } },
{ from: { glob: "**/*.jpg" } },
{ from: { glob: "**/*.png" } },
], { 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
})
],
};
// Copy the native app resources to the out dir
// only if doing a full build (tns run/build) and not previewing (tns preview)
if (!externals || externals.length === 0) {
config.plugins.push(new CopyWebpackPlugin([
{
from: `${appResourcesFullPath}/${appResourcesPlatformDir}`,
to: `${dist}/App_Resources/${appResourcesPlatformDir}`,
context: projectRoot
},
]));
}
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;
};

View File

@@ -1,33 +0,0 @@
# 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

View File

@@ -1,201 +0,0 @@
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.

View File

@@ -1,3 +0,0 @@
{
"useLegacyWorkflow": false
}

View File

@@ -13,12 +13,11 @@
"license": "SEE LICENSE IN <your-license-filename>",
"repository": "<fill-your-repository-here>",
"dependencies": {
"tns-core-modules": "next"
"tns-core-modules": "file:../../tns-core-modules"
},
"devDependencies": {
"nativescript-dev-webpack": "next",
"tns-platform-declarations": "next",
"typescript": "~3.4.1"
"typescript": "3.4.5"
},
"gitHead": "8c1a4866a66daab09bf5ef8e5a96472687192373",
"readme": "NativeScript Application"

View File

@@ -6,6 +6,7 @@
"emitDecoratorMetadata": true,
"noEmitHelpers": true,
"noEmitOnError": true,
"skipLibCheck": true,
"lib": [
"es6",
"dom"
@@ -14,6 +15,9 @@
"paths": {
"~/*": [
"app/*"
],
"*": [
"./node_modules/*"
]
}
},
@@ -21,4 +25,4 @@
"node_modules",
"platforms"
]
}
}

View File

@@ -1,299 +0,0 @@
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 { 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/<platform>/...
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"
]
},
{
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" } },
], { 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
})
],
};
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;
};

View File

@@ -1,35 +1 @@
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

View File

@@ -1,4 +0,0 @@
Execute Tests
=============
TODO

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">TestApp</string>
<string name="title_activity_kimera">TestApp</string>
<string name="app_name">FileQualifiers</string>
<string name="title_activity_kimera">FileQualifiers</string>
</resources>

View File

@@ -1,3 +1,5 @@
@import '~nativescript-theme-core/css/core.light.css';
.root-footer {
color: black;
background-color: lightgreen

View File

@@ -1,3 +1,6 @@
/* Currently app.land.css is never loaded */
@import '~nativescript-theme-core/css/lime.css';
.root-footer {
color: black;
background-color: lightpink;

View File

@@ -2,7 +2,7 @@
<StackLayout class="page-content">
<Label text="This is LANDSACPE page" />
<Button text="tap" tap="tap" />
<Button text="tap" tap="tap" class="btn btn-primary"/>
<Button text="navigate" tap="navigate" />

View File

@@ -2,7 +2,7 @@
<StackLayout class="page-content">
<Label text="This is DEFAULT page" />
<Button text="tap" tap="tap" />
<Button text="tap" tap="tap" class="btn btn-primary" />
<Button text="navigate" tap="navigate" />

View File

@@ -2,7 +2,7 @@
<StackLayout class="page-content">
<Label text="This is LANDSACPE other page" />
<Button text="tap" tap="tap" />
<Button text="tap" tap="tap" class="btn btn-primary"/>
<Button text="navigate" tap="navigate" />

View File

@@ -2,7 +2,7 @@
<StackLayout class="page-content">
<Label text="This is DEFAULT other page" />
<Button text="tap" tap="tap" />
<Button text="tap" tap="tap" class="btn btn-primary"/>
<Button text="navigate" tap="navigate" />

View File

@@ -1,3 +0,0 @@
{
"useLegacyWorkflow": false
}

View File

@@ -6,18 +6,18 @@
"nativescript": {
"id": "org.nativescript.filequalifiers",
"tns-ios": {
"version": "6.0.0-2019-06-19-084246-01"
"version": "next"
},
"tns-android": {
"version": "6.0.0-2019-06-24-113546-01"
"version": "next"
}
},
"dependencies": {
"nativescript-theme-core": "^1.0.6",
"tns-core-modules": "file:../../tns-core-modules"
},
"devDependencies": {
"nativescript-dev-webpack": "next",
"tns-platform-declarations": "next",
"typescript": "3.4.1"
"typescript": "3.4.5"
}
}

View File

@@ -6,24 +6,23 @@
"emitDecoratorMetadata": true,
"noEmitHelpers": true,
"noEmitOnError": true,
"skipLibCheck": true,
"lib": [
"es6",
"dom"
],
"baseUrl": ".",
"paths": {
"*": [
"./node_modules/tns-core-modules/*",
"./node_modules/*"
],
"~/*": [
"app/*"
],
"*": [
"./node_modules/*"
]
}
},
"exclude": [
"node_modules",
"platforms",
"e2e"
"platforms"
]
}
}

View File

@@ -28,12 +28,10 @@ module.exports = env => {
// Default destination inside platforms/<platform>/...
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`.
// the nsconfig.json configuration file.
appPath = "app",
appResourcesPath = "app/App_Resources",
@@ -73,6 +71,7 @@ module.exports = env => {
itemsToClean.push(`${join(projectRoot, "platforms", "android", "app", "build", "configurations", "nativescript-android-snapshot")}`);
}
nsWebpack.processAppComponents(appComponents, platform);
const config = {
mode: production ? "production" : "development",
context: appFullPath,
@@ -133,8 +132,8 @@ module.exports = env => {
test: (module, chunks) => {
const moduleName = module.nameForCondition ? module.nameForCondition() : '';
return /[\\/]node_modules[\\/]/.test(moduleName) ||
/[\\/]tns-core-modules[\\/]/.test(moduleName) || // <-- Needed for snapshot builds with linked modules!
appComponents.some(comp => comp === moduleName);
},
enforce: true,
},
@@ -164,7 +163,7 @@ module.exports = env => {
module: {
rules: [
{
test: nsWebpack.getEntryPathRegExp(appFullPath, entryPath),
include: join(appFullPath, entryPath),
use: [
// Require all Android app components
platform === "android" && {
@@ -179,13 +178,14 @@ module.exports = env => {
unitTesting,
appFullPath,
projectRoot,
ignoredFiles: nsWebpack.getUserDefinedEntries(entries, platform)
}
},
].filter(loader => !!loader)
},
{
test: /\.(ts|css|scss|less|html|xml)$/,
test: /\.(ts|css|scss|html|xml)$/,
use: "nativescript-dev-webpack/hmr/hot-loader"
},
@@ -227,7 +227,7 @@ module.exports = env => {
// Define useful constants like TNS_WEBPACK
new webpack.DefinePlugin({
"global.TNS_WEBPACK": "true",
"process": undefined,
"process": "global.process",
}),
// Remove all files from the out dir.
new CleanWebpackPlugin(itemsToClean, { verbose: !!verbose }),

View File

@@ -1,2 +0,0 @@
.vscode/settings.json
mochawesome-report

View File

@@ -1,18 +1,3 @@
Execute Tests
=============
Android:
```
npm run e2e -- --runType android23 # --devMode
```
iOS:
```
npm run e2e -- --runType sim.iPhoneX.iOS112 # --devMode
```
Scenarios
=============

View File

@@ -27,12 +27,6 @@ export function onModalNoPage(args: EventData) {
closeCallback: () => console.log("home-page modal frame closed"),
fullscreen: false
});
view.showModal("modal-no-page/modal-no-page", {
context: "context",
closeCallback: () => console.log("home-page modal frame closed"),
fullscreen: false
});
}
export function onPopoverModal(args: EventData) {
@@ -121,4 +115,4 @@ export function onTabRootViewReset() {
export function onLayoutRootViewReset() {
application._resetRootView({ moduleName: "layout-root" });
}
}

View File

@@ -1,3 +0,0 @@
{
"useLegacyWorkflow": false
}

View File

@@ -14,17 +14,18 @@
},
"dependencies": {
"nativescript-theme-core": "~1.0.6",
"tns-core-modules": "next"
"tns-core-modules": "file:../../tns-core-modules"
},
"devDependencies": {
"@types/chai": "~4.1.7",
"@types/mocha": "~5.2.5",
"@types/node": "~10.12.18",
"mocha": "~5.2.0",
"mochawesome": "~3.1.2",
"nativescript-dev-appium": "next",
"nativescript-dev-webpack": "next",
"rimraf": "^2.6.2",
"tns-platform-declarations": "next",
"tns-platform-declarations": "file:../../tns-platform-declarations",
"typescript": "~3.4.1"
},
"scripts": {

View File

@@ -1 +1,2 @@
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />

View File

@@ -6,24 +6,24 @@
"emitDecoratorMetadata": true,
"noEmitHelpers": true,
"noEmitOnError": true,
"skipLibCheck": true,
"lib": [
"es6",
"dom"
],
"baseUrl": ".",
"paths": {
"*": [
"./node_modules/tns-core-modules/*",
"./node_modules/*"
],
"~/*": [
"app/*"
],
"*": [
"./node_modules/*"
]
}
},
"exclude": [
"e2e",
"node_modules",
"platforms",
"e2e"
"platforms"
]
}
}

View File

@@ -1,2 +0,0 @@
.vscode/settings.json
mochawesome-report

View File

@@ -1,14 +0,0 @@
Execute Tests
=============
Android:
```
npm run e2e -- --runType android23 # --devMode
```
iOS:
```
npm run e2e -- --runType sim.iPhoneX.iOS112 # --devMode
```

View File

@@ -1,3 +0,0 @@
{
"useLegacyWorkflow": false
}

View File

@@ -14,12 +14,12 @@
},
"dependencies": {
"nativescript-theme-core": "~1.0.4",
"tns-core-modules": "next"
"tns-core-modules": "file:../../tns-core-modules"
},
"devDependencies": {
"@types/chai": "~4.1.7",
"@types/mocha": "~5.2.5",
"@types/node": "^12.7.2",
"@types/node": "~10.12.18",
"mocha": "~5.2.0",
"mochawesome": "~3.1.2",
"nativescript-dev-appium": "next",

View File

@@ -6,24 +6,24 @@
"emitDecoratorMetadata": true,
"noEmitHelpers": true,
"noEmitOnError": true,
"skipLibCheck": true,
"lib": [
"es6",
"dom"
],
"baseUrl": ".",
"paths": {
"*": [
"./node_modules/tns-core-modules/*",
"./node_modules/*"
],
"~/*": [
"app/*"
],
"*": [
"./node_modules/*"
]
}
},
"exclude": [
"e2e",
"node_modules",
"platforms",
"e2e"
"platforms"
]
}
}

View File

@@ -1,38 +1 @@
# 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
# tests
mochawesome-report
e2e/resources/images/uitestsapp/*
testapp

View File

@@ -1,5 +1,5 @@
#app {
background-color: lightblue;
background-color: lightyellow;
}
.ui-tests-app-issue-1639-red {
@@ -20,4 +20,4 @@
.ui-tests-app-issue-1639-yellow {
color: yellow;
margin-left: 30;
}
}

View File

@@ -52,7 +52,7 @@ export class BottomNavigationViewModel extends Observable {
const gridlayout = new GridLayout();
label.text = "Content Item " + index;
gridlayout.addChild(label);
contentItem.view = gridlayout;
contentItem.content = gridlayout;
return contentItem;
}

View File

@@ -17,3 +17,11 @@ TabStripItem.special {
TabStripItem.special:active {
color: yellowgreen;
}
TabStripItem.nested Label {
color: teal;
}
TabStripItem.nested:active Label {
color: yellowgreen;
}

View File

@@ -3,10 +3,13 @@
<ActionBar title="BottomNavigation color" icon="" class="action-bar">
</ActionBar>
<BottomNavigation style="color: green;" automationText="tabNavigation" >
<BottomNavigation automationText="tabNavigation">
<TabStrip>
<TabStripItem title="First" class="special"></TabStripItem>
<TabStripItem title="Second"></TabStripItem>
<TabStripItem title="first" class="special"></TabStripItem>
<TabStripItem title="second"></TabStripItem>
<TabStripItem class="nested">
<Label text="third" />
</TabStripItem>
</TabStrip>
<TabContentItem class="special">
@@ -20,5 +23,11 @@
<Label text="Second View" />
</GridLayout>
</TabContentItem>
<TabContentItem>
<GridLayout>
<Label text="Third View" />
</GridLayout>
</TabContentItem>
</BottomNavigation>
</Page>

View File

@@ -0,0 +1,31 @@
.custom-tabstrip {
height: 100;
vertical-align: bottom;
ios-overflow-safe-area-enabled: false;
}
.custom-tabstripitem {
height: 80;
width: 80;
vertical-align: center;
horizontal-align: center;
clip-path: circle(100% at 50% 50%);
}
.custom-title {
color: white;
vertical-align: center;
horizontal-align: center;
}
.skyblue {
background-color: skyblue;
}
.gold {
background-color: gold;
}
.olive {
background-color: olive;
}

View File

@@ -0,0 +1,24 @@
import { EventData } from "tns-core-modules/data/observable";
import { Page } from "tns-core-modules/ui/page";
import { BottomNavigation } from "tns-core-modules/ui/bottom-navigation";
export function goToFirst(args: EventData) {
const page = <Page>(<any>args.object).page;
const bottomNav = <BottomNavigation>page.getViewById("bottomNav");
bottomNav.selectedIndex = 0;
}
export function goToSecond(args: EventData) {
const page = <Page>(<any>args.object).page;
const bottomNav = <BottomNavigation>page.getViewById("bottomNav");
bottomNav.selectedIndex = 1;
}
export function goToThird(args: EventData) {
const page = <Page>(<any>args.object).page;
const bottomNav = <BottomNavigation>page.getViewById("bottomNav");
bottomNav.selectedIndex = 2;
}

View File

@@ -0,0 +1,41 @@
<Page>
<ActionBar title="BottomNavigation Custom TabStrip" icon="" class="action-bar">
</ActionBar>
<GridLayout>
<GridLayout>
<BottomNavigation id="bottomNav" automationText="tabNavigation" >
<TabContentItem>
<GridLayout backgroundColor="skyblue">
<Label text="First View"/>
</GridLayout>
</TabContentItem>
<TabContentItem>
<GridLayout backgroundColor="gold">
<Label text="Second View"/>
</GridLayout>
</TabContentItem>
<TabContentItem>
<GridLayout backgroundColor="olive">
<Label text="Third View"/>
</GridLayout>
</TabContentItem>
</BottomNavigation>
</GridLayout>
<GridLayout columns="*, *, *" class="custom-tabstrip">
<GridLayout automationText="first-tab" col="0" class="custom-tabstripitem skyblue" tap="goToFirst">
<Label text="First" class="custom-title"></Label>
</GridLayout>
<GridLayout automationText="second-tab" col="1" class="custom-tabstripitem gold" tap="goToSecond">
<Label text="Second" class="custom-title"></Label>
</GridLayout>
<GridLayout automationText="third-tab" col="2" class="custom-tabstripitem olive" tap="goToThird">
<Label text="Third" class="custom-title"></Label>
</GridLayout>
</GridLayout>
</GridLayout>
</Page>

View File

@@ -6,6 +6,34 @@
font-size: 36;
}
.color {
color: blue;
}
TabStrip {
color: mediumvioletred;
}
TabStripItem {
color: skyblue;
}
TabStripItem:active {
color: darkblue;
}
TabStripItem.special Image {
color: lightgreen;
}
TabStripItem.special:active Image {
color: darkgreen;
}
TabStripItem.special Label {
color: gold;
}
TabStripItem.special:active Label {
color: darkgoldenrod;
}
TabStripItem:active .font-size {
font-size: 10;
}

View File

@@ -3,32 +3,61 @@
<ActionBar title="BottomNavigation font icons" icon="" class="action-bar">
</ActionBar>
<BottomNavigation class="font-awesome" automationText="tabNavigation" > <!-- TODO: The font-awesome class here should be removed -->
<BottomNavigation automationText="tabNavigation" >
<TabStrip>
<!-- font family + font size + color -->
<TabStripItem title="First" iconSource="font://&#xF10B;" class="special font-awesome font-size color"></TabStripItem>
<!-- font family + font size + color -->
<TabStripItem class="special">
<Label text="All Set"/>
<Image src="font://&#xF10B;" class="font-awesome font-size" />
</TabStripItem>
<!-- default font + valid char code -->
<TabStripItem title="Second" iconSource="font://&#xF10B;"></TabStripItem>
<TabStripItem>
<Label text="Invalid Font" />
<Image src="font://&#xF10B;" />
</TabStripItem>
<!-- font family + invalid char code -->
<TabStripItem title="Third" iconSource="font://&#xF556;" class="font-awesome font-size"></TabStripItem>
<TabStripItem>
<Label text="Invalid Char" />
<Image src="font://&#xF556;" class="font-awesome font-size"/>
</TabStripItem>
</TabStrip>
<TabContentItem class="special">
<GridLayout>
<Label text="First View" />
</GridLayout>
<StackLayout>
<Label text="char code: phone" />
<Label text="font: Font Awesome" />
<Label text="font size: 36" />
<Label text="icon color inactive: lightgreen" />
<Label text="icon color active: darkgreen" />
<Label text="title color inactive: gold" />
<Label text="title color active: darkgoldenrod" />
</StackLayout>
</TabContentItem>
<TabContentItem>
<GridLayout>
<Label text="Second View" />
</GridLayout>
<StackLayout>
<Label text="char code: phone" />
<Label text="font: default/invalid" />
<Label text="font size: default" />
<Label text="icon color inactive: skyblue" />
<Label text="icon color active: darkblue" />
<Label text="title color inactive: skyblue" />
<Label text="title color active: darkblue" />
</StackLayout>
</TabContentItem>
<TabContentItem>
<GridLayout>
<Label text="Third View" />
</GridLayout>
<StackLayout>
<Label text="char code: invalid" />
<Label text="font: Font Awesome" />
<Label text="font size: 36" />
<Label text="icon color inactive: skyblue" />
<Label text="icon color active: darkblue" />
<Label text="title color inactive: skyblue" />
<Label text="title color active: darkblue" />
</StackLayout>
</TabContentItem>
</BottomNavigation>
</Page>

View File

@@ -17,3 +17,11 @@ TabStripItem.special {
TabStripItem.special:active {
font: 16 monospace;
}
TabStripItem.nested Label {
font: 12 monospace;
}
TabStripItem.nested:active Label {
font: 16 monospace;
}

View File

@@ -1,12 +1,15 @@
<Page class="page">
<ActionBar title="BottomNavigation FONT" icon="" class="action-bar">
<ActionBar title="BottomNavigation font" class="action-bar">
</ActionBar>
<BottomNavigation automationText="tabNavigation" >
<BottomNavigation automationText="tabNavigation">
<TabStrip>
<TabStripItem title="First" class="special"></TabStripItem>
<TabStripItem title="Second"></TabStripItem>
<TabStripItem title="first" class="special"></TabStripItem>
<TabStripItem title="second"></TabStripItem>
<TabStripItem class="nested">
<Label text="third" />
</TabStripItem>
</TabStrip>
<TabContentItem class="special">
@@ -20,5 +23,11 @@
<Label text="Second View" />
</GridLayout>
</TabContentItem>
<TabContentItem>
<GridLayout>
<Label text="Third View" />
</GridLayout>
</TabContentItem>
</BottomNavigation>
</Page>

View File

@@ -6,10 +6,12 @@ export function onSelectedIndexChanged(args: SelectedIndexChangedEventData) {
const newItem = bottomNav.tabStrip.items[args.newIndex];
if (newItem) {
newItem.iconSource = "res://icon";
newItem.title = "selected";
}
const oldItem = bottomNav.tabStrip.items[args.oldIndex];
if (oldItem) {
oldItem.iconSource = "res://testlogo";
oldItem.title = "unselected";
}
}

View File

@@ -4,8 +4,8 @@
<BottomNavigation id="tab-view" selectedIndexChanged="onSelectedIndexChanged" automationText="tabNavigation" >
<TabStrip>
<TabStripItem iconSource="res://icon"></TabStripItem>
<TabStripItem iconSource="res://testlogo"></TabStripItem>
<TabStripItem iconSource="res://icon" title="selected"></TabStripItem>
<TabStripItem iconSource="res://testlogo" title="unselected"></TabStripItem>
</TabStrip>
<TabContentItem>

View File

@@ -23,6 +23,7 @@ export function loadExamples() {
examples.set("font-icons", "bottom-navigation/font-icons-page");
examples.set("fancy-fonts", "bottom-navigation/fancy-fonts-page");
examples.set("css-text-transform", "bottom-navigation/bottom-navigation-css-page");
examples.set("custom-tabstrip", "bottom-navigation/custom-tabstrip-page");
return examples;
}

View File

@@ -17,3 +17,11 @@ TabStripItem.special {
TabStripItem.special:active {
text-transform: uppercase;
}
TabStripItem.nested Label {
text-transform: lowercase;
}
TabStripItem.nested:active Label {
text-transform: uppercase;
}

View File

@@ -1,12 +1,15 @@
<Page class="page">
<ActionBar title="BottomNavigation Text Transform" icon="" class="action-bar">
<ActionBar title="BottomNavigation text-transform" class="action-bar">
</ActionBar>
<BottomNavigation automationText="tabNavigation" >
<BottomNavigation automationText="tabNavigation">
<TabStrip>
<TabStripItem title="first" class="special"></TabStripItem>
<TabStripItem title="second"></TabStripItem>
<TabStripItem class="nested">
<Label text="third" />
</TabStripItem>
</TabStrip>
<TabContentItem class="special">
@@ -20,5 +23,11 @@
<Label text="Second View" />
</GridLayout>
</TabContentItem>
<TabContentItem>
<GridLayout>
<Label text="Third View" />
</GridLayout>
</TabContentItem>
</BottomNavigation>
</Page>

View File

@@ -13,7 +13,6 @@ export function loadExamples() {
const examples = new Map<string, string>();
examples.set("btn-wrap-text-alignment-4266", "button/btn-wrap-text-alignment-4266-page");
examples.set("button-border", "button/button-border-page");
examples.set("styles", "button/styles-page");
examples.set("background", "button/background-page");
examples.set("border-playground", "button/border-playground-page");
examples.set("issue-4287", "button/issue-4287-page");

View File

@@ -1,4 +0,0 @@
export function onLoaded(args) {
var page = args.object;
page.addCss("#property { background-color: lightsalmon; }");
}

View File

@@ -45,6 +45,7 @@ export function loadExamples() {
examples.set("background-shorthand", "css/background-shorthand-page");
examples.set("background-image-linear-gradient", "css/background-image-linear-gradient-page");
examples.set("background-image", "css/background-image-page");
examples.set("styles", "css/styles-page");
return examples;
}

View File

@@ -0,0 +1,10 @@
import { addCss } from "tns-core-modules/application";
export function onLoaded(args) {
var page = args.object;
page.addCss("#property { background-color: lightsalmon; }");
}
export function onTap() {
addCss("#app { background-color: lightblue; }");
}

View File

@@ -1,9 +1,9 @@
<Page loaded="onLoaded">
<WrapLayout>
<Button id="app" automationText="app" text="app" />
<Button id="app" automationText="app" text="app" tap="onTap" />
<Button id="inline" automationText="inline" text="inline" style="background-color: lightgreen;" />
<Button id="page" automationText="page" text="page" />
<Button id="property" automationText="property" text="property" />
<Button id="import" automationText="import" text="import" />
</WrapLayout>
</Page>
</Page>

View File

@@ -0,0 +1,45 @@
import * as model from "./myview";
import { Button } from "tns-core-modules/ui/button";
import { Page } from "tns-core-modules/ui/page";
import { GridLayout, ItemSpec } from "tns-core-modules/ui/layouts/grid-layout";
export function onLoaded(args: { eventName: string, object: any }) {
var page = <Page>args.object;
page.bindingContext = new model.ViewModel();
}
export function onAddRowColumn(args: { eventName: string, object: any }) {
var layout = <GridLayout>args.object.parent.parent;
var row = new ItemSpec(1, "auto");
var column = new ItemSpec(1, "auto");
layout.addRow(row);
layout.addColumn(column);
var btn0 = new Button();
var btn1 = new Button();
btn0.id = "b0";
btn1.id = "b1";
btn0.text = "b0";
btn1.text = "b1";
layout.addChild(btn0);
layout.addChild(btn1);
GridLayout.setRow(btn0, 0);
GridLayout.setColumn(btn0, 4);
GridLayout.setRow(btn1, 4);
GridLayout.setColumn(btn1, 0);
GridLayout.setColumnSpan(btn1, 2);
GridLayout.setRowSpan(btn0, 3);
}
export function onRemoveRowColumn(args: { eventName: string, object: any }) {
var layout = <GridLayout>args.object.parent.parent;
var itemSpecs, count;
itemSpecs = layout.getRows();
count = itemSpecs.length;
layout.removeRow(itemSpecs[count - 1]);
itemSpecs = layout.getColumns();
count = itemSpecs.length;
layout.removeColumn(itemSpecs[count - 1]);
}

View File

@@ -0,0 +1,18 @@
<Page loaded="onLoaded">
<GridLayout rows="auto, 100, *, 50" columns="auto, 60, *, 40">
<!-- View Properties -->
<Button text="wh" tap="{{ onWidthHeight }}" id="widthHeight" automationText="widthHeight" style="background-color: lightblue;" />
<Button text="n" tap="{{ onMinWidthMinHeight }}" column="1" id="minWidthMinHeight" automationText="minWidthMinHeight" style="background-color: lightblue;" />
<Button text="m" tap="{{ onMargins }}" column="2" id="margins" automationText="margins" style="background-color: lightblue;" />
<Button text="a" tap="{{ onAlignments }}" row="1" id="alignments" automationText="alignments" style="background-color: lightblue;" />
<Button text="c" tap="{{ onCollapse }}" row="1" column="1" id="collapse" automationText="collapse" style="background-color: lightblue;" />
<Button text="v" tap="{{ onVisibile }}" row="1" column="2" id="visible" automationText="visible" style="background-color: lightblue;" />
<!-- Layout Properties -->
<Button text="p" tap="{{ onPaddings }}" row="2" id="paddings" automationText="paddings" style="background-color: lightgray;" />
<Button text="all" tap="{{ onAllProperties }}" row="2" column="1" id="allProperties" automationText="allProperties" style="background-color: aquamarine;" />
<StackLayout row="2" column="2">
<Button text="1" tap="onAddRowColumn" id="addRowColumn" automationText="addRowColumn" style="background-color: lightgreen;" />
<Button text="0" tap="onRemoveRowColumn" id="removeRowColumn" automationText="removeRowColumn" style="background-color: lightgreen;" />
</StackLayout>
</GridLayout>
</Page>

View File

@@ -23,6 +23,7 @@ export function loadExamples() {
examples.set("pwrap", "layouts-percent/wrap-page");
examples.set("passThroughParent", "layouts/passThroughParent-page");
examples.set("stacklayout-6059", "layouts/stacklayout-6059-page");
examples.set("grid-7295", "layouts/grid-7295-page");
examples.set("safe-area", "layouts/safe-area-page");
return examples;

View File

@@ -17,3 +17,11 @@ TabStripItem.special {
TabStripItem.special:active {
color: yellowgreen;
}
TabStripItem.nested Label {
color: teal;
}
TabStripItem.nested:active Label {
color: yellowgreen;
}

View File

@@ -1,12 +1,15 @@
<Page class="page">
<ActionBar title="Tabs color" icon="" class="action-bar">
<ActionBar title="Tabs color" class="action-bar">
</ActionBar>
<Tabs automationText="tabNavigation" >
<Tabs automationText="tabNavigation">
<TabStrip>
<TabStripItem title="First" class="special"></TabStripItem>
<TabStripItem title="Second"></TabStripItem>
<TabStripItem title="first" class="special"></TabStripItem>
<TabStripItem title="second"></TabStripItem>
<TabStripItem class="nested">
<Label text="third" />
</TabStripItem>
</TabStrip>
<TabContentItem class="special">
@@ -20,5 +23,11 @@
<Label text="Second View" />
</GridLayout>
</TabContentItem>
<TabContentItem>
<GridLayout>
<Label text="Third View" />
</GridLayout>
</TabContentItem>
</Tabs>
</Page>

View File

@@ -0,0 +1,31 @@
.custom-tabstrip {
height: 100;
vertical-align: bottom;
ios-overflow-safe-area-enabled: false;
}
.custom-tabstripitem {
height: 80;
width: 80;
vertical-align: center;
horizontal-align: center;
clip-path: circle(100% at 50% 50%);
}
.custom-title {
color: white;
vertical-align: center;
horizontal-align: center;
}
.skyblue {
background-color: skyblue;
}
.gold {
background-color: gold;
}
.olive {
background-color: olive;
}

View File

@@ -0,0 +1,24 @@
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 = <Page>(<any>args.object).page;
const bottomNav = <Tabs>page.getViewById("tabsNav");
bottomNav.selectedIndex = 0;
}
export function goToSecond(args: EventData) {
const page = <Page>(<any>args.object).page;
const bottomNav = <Tabs>page.getViewById("tabsNav");
bottomNav.selectedIndex = 1;
}
export function goToThird(args: EventData) {
const page = <Page>(<any>args.object).page;
const bottomNav = <Tabs>page.getViewById("tabsNav");
bottomNav.selectedIndex = 2;
}

View File

@@ -0,0 +1,41 @@
<Page>
<ActionBar title="Tabs Custom TabStrip" icon="" class="action-bar">
</ActionBar>
<GridLayout>
<GridLayout>
<Tabs id="tabsNav" automationText="tabNavigation" >
<TabContentItem>
<GridLayout backgroundColor="skyblue">
<Label text="First View"/>
</GridLayout>
</TabContentItem>
<TabContentItem>
<GridLayout backgroundColor="gold">
<Label text="Second View"/>
</GridLayout>
</TabContentItem>
<TabContentItem>
<GridLayout backgroundColor="olive">
<Label text="Third View"/>
</GridLayout>
</TabContentItem>
</Tabs>
</GridLayout>
<GridLayout columns="*, *, *" class="custom-tabstrip">
<GridLayout automationText="first-tab" col="0" class="custom-tabstripitem skyblue" tap="goToFirst">
<Label text="First" class="custom-title"></Label>
</GridLayout>
<GridLayout automationText="second-tab" col="1" class="custom-tabstripitem gold" tap="goToSecond">
<Label text="Second" class="custom-title"></Label>
</GridLayout>
<GridLayout automationText="third-tab" col="2" class="custom-tabstripitem olive" tap="goToThird">
<Label text="Third" class="custom-title"></Label>
</GridLayout>
</GridLayout>
</GridLayout>
</Page>

View File

@@ -6,6 +6,34 @@
font-size: 36;
}
.color {
color: blue;
}
TabStrip {
color: mediumvioletred;
}
TabStripItem {
color: skyblue;
}
TabStripItem:active {
color: darkblue;
}
TabStripItem.special Image {
color: lightgreen;
}
TabStripItem.special:active Image {
color: darkgreen;
}
TabStripItem.special Label {
color: gold;
}
TabStripItem.special:active Label {
color: darkgoldenrod;
}
TabStripItem:active .font-size {
font-size: 10;
}

View File

@@ -3,32 +3,61 @@
<ActionBar title="Tabs font icons" icon="" class="action-bar">
</ActionBar>
<Tabs class="font-awesome" automationText="tabNavigation" > <!-- TODO: The font-awesome class here should be removed -->
<Tabs automationText="tabNavigation">
<TabStrip>
<!-- font family + font size + color -->
<TabStripItem title="First" iconSource="font://&#xF10B;" class="special font-awesome font-size color"></TabStripItem>
<!-- font family + font size + color -->
<TabStripItem class="special">
<Label text="All Set"/>
<Image src="font://&#xF10B;" class="font-awesome font-size" />
</TabStripItem>
<!-- default font + valid char code -->
<TabStripItem title="Second" iconSource="font://&#xF10B;"></TabStripItem>
<TabStripItem>
<Label text="Invalid Font" />
<Image src="font://&#xF10B;" />
</TabStripItem>
<!-- font family + invalid char code -->
<TabStripItem title="Third" iconSource="font://&#xF556;" class="font-awesome font-size"></TabStripItem>
<TabStripItem>
<Label text="Invalid Char" />
<Image src="font://&#xF556;" class="font-awesome font-size"/>
</TabStripItem>
</TabStrip>
<TabContentItem class="special">
<GridLayout>
<Label text="First View" />
</GridLayout>
<StackLayout>
<Label text="char code: phone" />
<Label text="font: Font Awesome" />
<Label text="font size: 36" />
<Label text="icon color inactive: lightgreen" />
<Label text="icon color active: darkgreen" />
<Label text="title color inactive: gold" />
<Label text="title color active: darkgoldenrod" />
</StackLayout>
</TabContentItem>
<TabContentItem>
<GridLayout>
<Label text="Second View" />
</GridLayout>
<StackLayout>
<Label text="char code: phone" />
<Label text="font: default/invalid" />
<Label text="font size: default" />
<Label text="icon color inactive: skyblue" />
<Label text="icon color active: darkblue" />
<Label text="title color inactive: skyblue" />
<Label text="title color active: darkblue" />
</StackLayout>
</TabContentItem>
<TabContentItem>
<GridLayout>
<Label text="Third View" />
</GridLayout>
<StackLayout>
<Label text="char code: invalid" />
<Label text="font: Font Awesome" />
<Label text="font size: 36" />
<Label text="icon color inactive: skyblue" />
<Label text="icon color active: darkblue" />
<Label text="title color inactive: skyblue" />
<Label text="title color active: darkblue" />
</StackLayout>
</TabContentItem>
</Tabs>
</Page>

View File

@@ -17,3 +17,11 @@ TabStripItem.special {
TabStripItem.special:active {
font: 16 monospace;
}
TabStripItem.nested Label {
font: 12 monospace;
}
TabStripItem.nested:active Label {
font: 16 monospace;
}

View File

@@ -1,12 +1,15 @@
<Page class="page">
<ActionBar title="Tabs font" icon="" class="action-bar">
<ActionBar title="Tabs font" class="action-bar">
</ActionBar>
<Tabs automationText="tabNavigation" >
<TabStrip>
<TabStripItem title="First" class="special"></TabStripItem>
<TabStripItem title="Second"></TabStripItem>
<TabStripItem title="first" class="special"></TabStripItem>
<TabStripItem title="second"></TabStripItem>
<TabStripItem class="nested">
<Label text="third" />
</TabStripItem>
</TabStrip>
<TabContentItem class="special">
@@ -20,5 +23,11 @@
<Label text="Second View" />
</GridLayout>
</TabContentItem>
<TabContentItem>
<GridLayout>
<Label text="Third View" />
</GridLayout>
</TabContentItem>
</Tabs>
</Page>

View File

@@ -6,10 +6,12 @@ export function onSelectedIndexChanged(args: SelectedIndexChangedEventData) {
const newItem = tabsNav.tabStrip.items[args.newIndex];
if (newItem) {
newItem.iconSource = "res://icon";
newItem.title = "selected";
}
const oldItem = tabsNav.tabStrip.items[args.oldIndex];
if (oldItem) {
oldItem.iconSource = "res://testlogo";
oldItem.title = "unselected";
}
}

View File

@@ -4,8 +4,8 @@
<Tabs id="tab-view" selectedIndexChanged="onSelectedIndexChanged" automationText="tabNavigation" >
<TabStrip>
<TabStripItem iconSource="res://icon"></TabStripItem>
<TabStripItem iconSource="res://testlogo"></TabStripItem>
<TabStripItem iconSource="res://icon" title="selected"></TabStripItem>
<TabStripItem iconSource="res://testlogo" title="unselected"></TabStripItem>
</TabStrip>
<TabContentItem>

View File

@@ -29,6 +29,7 @@ export function loadExamples() {
examples.set("font-icons", "tabs/font-icons-page");
examples.set("nested-layout", "tabs/nested-layout-page");
examples.set("nested-bottom-navigation", "tabs/nested-bottom-navigation-page");
examples.set("custom-tabstrip", "tabs/custom-tabstrip-page");
return examples;
}

View File

@@ -53,7 +53,7 @@ export class TabsBindingNavigationViewModel extends Observable {
const gridlayout = new GridLayout();
label.text = "Content Item " + index;
gridlayout.addChild(label);
contentItem.view = gridlayout;
contentItem.content = gridlayout;
return contentItem;
}

View File

@@ -17,3 +17,11 @@ TabStripItem.special {
TabStripItem.special:active {
text-transform: uppercase;
}
TabStripItem.nested Label {
text-transform: lowercase;
}
TabStripItem.nested:active Label {
text-transform: uppercase;
}

View File

@@ -1,12 +1,15 @@
<Page class="page">
<ActionBar title="Tabs text-transform" icon="" class="action-bar">
<ActionBar title="Tabs text-transform" class="action-bar">
</ActionBar>
<Tabs automationText="tabNavigation" >
<Tabs automationText="tabNavigation">
<TabStrip>
<TabStripItem title="first" class="special"></TabStripItem>
<TabStripItem title="second"></TabStripItem>
<TabStripItem class="nested">
<Label text="third" />
</TabStripItem>
</TabStrip>
<TabContentItem class="special">
@@ -20,5 +23,11 @@
<Label text="Second View" />
</GridLayout>
</TabContentItem>
<TabContentItem>
<GridLayout>
<Label text="Third View" />
</GridLayout>
</TabContentItem>
</Tabs>
</Page>

View File

@@ -0,0 +1,21 @@
import { AppiumDriver, logInfo } from "nativescript-dev-appium";
import { PageObjectBaseModel } from "../../../page-object-base-model";
export class StylesPage extends PageObjectBaseModel {
private readonly app = "app";
constructor(_driver: AppiumDriver) {
super(_driver, ["css", "styles"]);
}
async btnApp() {
return this._driver.waitForElement(this.app);
}
async tapAppBtn() {
await (await this.btnApp()).tap();
logInfo(`Tap on '${this.app}' button.`);
}
}

View File

@@ -0,0 +1,41 @@
import { assert } from "chai";
import { AppiumDriver, createDriver, nsCapabilities } from "nativescript-dev-appium";
import { setImageName } from "../../../helpers/image-helper";
import { StylesPage } from "./styles-page";
const suite = "css";
const spec = "styles";
describe(`${suite}-${spec}-suite`, () => {
let driver: AppiumDriver;
let stylesPage: StylesPage;
before(async function () {
nsCapabilities.testReporter.context = this;
driver = await createDriver();
await driver.restartApp();
stylesPage = new StylesPage(driver);
await stylesPage.initSuite();
});
after(async function () {
await stylesPage.endSuite();
});
beforeEach(async function () {
driver.imageHelper.testName = setImageName(suite, spec, this.currentTest.title);
});
afterEach(async function () {
if (this.currentTest.state === "failed") {
await driver.logTestArtifacts(this.currentTest.title);
}
});
it(`${suite}-${spec}-apply`, async function () {
await stylesPage.tapAppBtn();
await driver.imageHelper.compareScreen();
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
});
});

View File

@@ -40,6 +40,7 @@ describe(`${suite}-${spec}-suite`, async function () {
it(`${spec}-background-color`, async function () {
await bottomNavigationBasePage.navigateToSample("background-color");
await bottomNavigationBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
await bottomNavigationBasePage.tabOnItem(1);
@@ -55,6 +56,7 @@ describe(`${suite}-${spec}-suite`, async function () {
*/
it(`${spec}-binding-add-items`, async function () {
await bottomNavigationBasePage.navigateToSample("binding");
await bottomNavigationBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
const addTabBtn = await driver.waitForElement("add-tab");
@@ -83,6 +85,7 @@ describe(`${suite}-${spec}-suite`, async function () {
*/
it(`${spec}-binding-remove-items`, async function () {
await bottomNavigationBasePage.navigateToSample("binding");
await bottomNavigationBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
const removeTabBtn = await driver.waitForElement("remove-last-tab");
@@ -115,6 +118,7 @@ describe(`${suite}-${spec}-suite`, async function () {
it(`${spec}-bottom-navigation`, async function () {
await bottomNavigationBasePage.navigateToSample("bottom-navigation");
await bottomNavigationBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
const goToSecondBtn = await driver.waitForElement("goToSecond");
@@ -130,6 +134,7 @@ describe(`${suite}-${spec}-suite`, async function () {
it(`${spec}-color`, async function () {
await bottomNavigationBasePage.navigateToSample("color");
await bottomNavigationBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
await bottomNavigationBasePage.tabOnItem(1);
@@ -141,6 +146,7 @@ describe(`${suite}-${spec}-suite`, async function () {
it(`${spec}-fancy-fonts-select-tabs`, async function () {
await bottomNavigationBasePage.navigateToSample("fancy-fonts");
await bottomNavigationBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
for (let index = 1; index < 4; index++) {
@@ -154,6 +160,7 @@ describe(`${suite}-${spec}-suite`, async function () {
it(`${spec}-fancy-fonts-selected-index`, async function () {
await bottomNavigationBasePage.navigateToSample("fancy-fonts");
await bottomNavigationBasePage.refreshTabItems();
let selectSecondTabFromCodeBehind = await driver.waitForElement("selectSecondTab");
logInfo(`Click on "select second tab button"`);
@@ -186,6 +193,7 @@ describe(`${suite}-${spec}-suite`, async function () {
it(`${spec}-fancy-fonts-change-orientation`, async function () {
await bottomNavigationBasePage.navigateToSample("fancy-fonts");
await bottomNavigationBasePage.refreshTabItems();
await driver.setOrientation(DeviceOrientation.LANDSCAPE);
await driver.imageHelper.compareScreen();
@@ -212,6 +220,7 @@ describe(`${suite}-${spec}-suite`, async function () {
it(`${spec}-font-icons`, async function () {
await bottomNavigationBasePage.navigateToSample("font-icons");
await bottomNavigationBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
await bottomNavigationBasePage.tabOnItem(1);
@@ -227,6 +236,7 @@ describe(`${suite}-${spec}-suite`, async function () {
it(`${spec}-icon-change`, async function () {
await bottomNavigationBasePage.navigateToSample("icon-change");
await bottomNavigationBasePage.refreshTabItems();
await bottomNavigationBasePage.tabOnItem(1);
await driver.imageHelper.compareScreen();
@@ -240,6 +250,7 @@ describe(`${suite}-${spec}-suite`, async function () {
it(`${spec}-icon-title-placment`, async function () {
await bottomNavigationBasePage.navigateToSample("icon-title-placement");
await bottomNavigationBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
await bottomNavigationBasePage.navigateBackToSuitMainPage();
@@ -247,6 +258,7 @@ describe(`${suite}-${spec}-suite`, async function () {
it(`${spec}-5470-issue`, async function () {
await bottomNavigationBasePage.navigateToSample("issue-5470");
await bottomNavigationBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
await bottomNavigationBasePage.tabOnItem(1);
@@ -258,6 +270,7 @@ describe(`${suite}-${spec}-suite`, async function () {
it(`${spec}-text-transform`, async function () {
await bottomNavigationBasePage.navigateToSample("text-transform");
await bottomNavigationBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
await bottomNavigationBasePage.tabOnItem(1);
@@ -269,6 +282,7 @@ describe(`${suite}-${spec}-suite`, async function () {
it(`${spec}-fonts`, async function () {
await bottomNavigationBasePage.navigateToSample("text-transform");
await bottomNavigationBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
await bottomNavigationBasePage.tabOnItem(1);
@@ -277,4 +291,16 @@ describe(`${suite}-${spec}-suite`, async function () {
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
await bottomNavigationBasePage.navigateBackToSuitMainPage();
});
it(`${spec}-custom-tabstrip`, async function () {
await bottomNavigationBasePage.navigateToSample("custom-tabstrip");
await driver.imageHelper.compareScreen();
const secondTab = await driver.waitForElement("second-tab");
await secondTab.tap();
await driver.imageHelper.compareScreen();
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
await bottomNavigationBasePage.navigateBackToSuitMainPage();
});
});

View File

@@ -21,7 +21,6 @@ export abstract class TabNavigationBasePage extends PageObjectBaseModel {
async navigateToSample(sample: string) {
await super.navigateToSample(sample);
await this.refreshTabItems();
}
async refreshTabItems() {

View File

@@ -39,6 +39,7 @@ describe(`${imagePrefix}-suite`, async function () {
it(`${imagePrefix}-background-color`, async function () {
await tabsViewBasePage.navigateToSample("background-color");
await tabsViewBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
await tabsViewBasePage.tabOnItem(1);
@@ -52,6 +53,7 @@ describe(`${imagePrefix}-suite`, async function () {
// not all css is applied.
it(`${imagePrefix}-color`, async function () {
await tabsViewBasePage.navigateToSample("color");
await tabsViewBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
await tabsViewBasePage.tabOnItem(1);
@@ -63,6 +65,7 @@ describe(`${imagePrefix}-suite`, async function () {
it(`${imagePrefix}-font`, async function () {
await tabsViewBasePage.navigateToSample("font");
await tabsViewBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
await tabsViewBasePage.tabOnItem(1);
@@ -78,6 +81,7 @@ describe(`${imagePrefix}-suite`, async function () {
it(`${imagePrefix}-font-icons`, async function () {
await tabsViewBasePage.navigateToSample("font-icons");
await tabsViewBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
await tabsViewBasePage.tabOnItem(1);
@@ -98,6 +102,7 @@ describe(`${imagePrefix}-suite`, async function () {
it(`${imagePrefix}-highlight-color`, async function () {
await tabsViewBasePage.navigateToSample("highlight-color");
await tabsViewBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
await tabsViewBasePage.tabOnItem(1);
@@ -110,6 +115,7 @@ describe(`${imagePrefix}-suite`, async function () {
it(`${imagePrefix}-icon-change`, async function () {
await tabsViewBasePage.navigateToSample("icon-change");
await tabsViewBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
@@ -126,6 +132,7 @@ describe(`${imagePrefix}-suite`, async function () {
it(`${imagePrefix}-icon-title-placment`, async function () {
await tabsViewBasePage.navigateToSample("icon-title-placement");
await tabsViewBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
await tabsViewBasePage.navigateBackToSuitMainPage();
@@ -133,6 +140,7 @@ describe(`${imagePrefix}-suite`, async function () {
it(`${imagePrefix}-issue-5470`, async function () {
await tabsViewBasePage.navigateToSample("issue-5470");
await tabsViewBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
await tabsViewBasePage.tabOnItem(1);
@@ -144,6 +152,7 @@ describe(`${imagePrefix}-suite`, async function () {
it(`${imagePrefix}-strip-item`, async function () {
await tabsViewBasePage.navigateToSample("strip-item");
await tabsViewBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
@@ -155,6 +164,7 @@ describe(`${imagePrefix}-suite`, async function () {
this.skip();
}
await tabsViewBasePage.navigateToSample("swipe-disabled");
await tabsViewBasePage.refreshTabItems();
await tabsViewBasePage.swipeRightToLeft();
await driver.imageHelper.compareScreen();
@@ -166,6 +176,7 @@ describe(`${imagePrefix}-suite`, async function () {
it(`${imagePrefix}-swipe`, async function () {
await tabsViewBasePage.navigateToSample("tabs");
await tabsViewBasePage.refreshTabItems();
await tabsViewBasePage.swipeRightToLeft();
await driver.imageHelper.compareScreen();
@@ -185,6 +196,7 @@ describe(`${imagePrefix}-suite`, async function () {
this.skip();
}
await tabsViewBasePage.navigateToSample("tabs-binding");
await tabsViewBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
const addTabBtn = await driver.waitForElement("add-tab");
@@ -216,6 +228,7 @@ describe(`${imagePrefix}-suite`, async function () {
this.skip();
}
await tabsViewBasePage.navigateToSample("tabs-binding");
await tabsViewBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
const removeTabBtn = await driver.waitForElement("remove-last-tab");
@@ -248,6 +261,7 @@ describe(`${imagePrefix}-suite`, async function () {
it(`${imagePrefix}-text-transform`, async function () {
await tabsViewBasePage.navigateToSample("text-transform");
await tabsViewBasePage.refreshTabItems();
await driver.imageHelper.compareScreen();
await tabsViewBasePage.refreshTabItems();
@@ -257,4 +271,16 @@ describe(`${imagePrefix}-suite`, async function () {
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
await tabsViewBasePage.navigateBackToSuitMainPage();
});
it(`${imagePrefix}-custom-tabstrip`, async function () {
await tabsViewBasePage.navigateToSample("custom-tabstrip");
await driver.imageHelper.compareScreen();
const secondTab = await driver.waitForElement("second-tab");
await secondTab.tap();
await driver.imageHelper.compareScreen();
assert.isTrue(driver.imageHelper.hasImageComparisonPassed());
await tabsViewBasePage.navigateBackToSuitMainPage();
});
});

View File

@@ -1,3 +0,0 @@
{
"useLegacyWorkflow": false
}

View File

@@ -28,7 +28,7 @@
"mochawesome": "~3.1.2",
"nativescript-dev-appium": "next",
"nativescript-dev-webpack": "next",
"tns-platform-declarations": "next",
"tns-platform-declarations": "file:../../tns-platform-declarations",
"typescript": "~3.4.1"
},
"gitHead": "8ab7726d1ee9991706069c1359c552e67ee0d1a4",

View File

@@ -1,2 +1,2 @@
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />

View File

@@ -6,6 +6,7 @@
"emitDecoratorMetadata": true,
"noEmitHelpers": true,
"noEmitOnError": true,
"skipLibCheck": true,
"lib": [
"es6",
"dom"
@@ -14,17 +15,15 @@
"paths": {
"~/*": [
"app/*"
],
"*": [
"./node_modules/*"
]
}
},
"include": [
"../tns-core-modules",
"**/*"
],
"exclude": [
"../tns-core-modules/node_modules",
"e2e",
"node_modules",
"platforms",
"e2e"
"platforms"
]
}
}

View File

@@ -28,12 +28,10 @@ module.exports = env => {
// Default destination inside platforms/<platform>/...
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`.
// the nsconfig.json configuration file.
appPath = "app",
appResourcesPath = "app/App_Resources",
@@ -73,6 +71,7 @@ module.exports = env => {
itemsToClean.push(`${join(projectRoot, "platforms", "android", "app", "build", "configurations", "nativescript-android-snapshot")}`);
}
nsWebpack.processAppComponents(appComponents, platform);
const config = {
mode: production ? "production" : "development",
context: appFullPath,
@@ -164,7 +163,7 @@ module.exports = env => {
module: {
rules: [
{
test: nsWebpack.getEntryPathRegExp(appFullPath, entryPath),
include: join(appFullPath, entryPath),
use: [
// Require all Android app components
platform === "android" && {
@@ -179,24 +178,15 @@ module.exports = env => {
unitTesting,
appFullPath,
projectRoot,
ignoredFiles: nsWebpack.getUserDefinedEntries(entries, platform)
}
},
].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: /\.(ts|css|scss|html|xml)$/,
use: "nativescript-dev-webpack/hmr/hot-loader"
},
{ test: /\.(html|xml)$/, use: "nativescript-dev-webpack/xml-namespace-loader" },

View File

@@ -34,6 +34,7 @@
"nativescript-typedoc-theme": "git://github.com/NativeScript/nativescript-typedoc-theme.git#master",
"parse-css": "git+https://github.com/tabatkins/parse-css.git",
"parserlib": "^1.1.1",
"reduce-css-calc": "^2.1.6",
"shady-css-parser": "^0.1.0",
"shelljs": "^0.7.0",
"source-map-support": "^0.4.17",
@@ -45,8 +46,8 @@
"typescript": "^3.1.6"
},
"scripts": {
"setup": "",
"setup-widgets": "( cd tns-core-modules-widgets && sh build.sh ) && npm run dev-link-tns-core-modules-widgets",
"setup": "npm run dev-link-tns-platform-declarations && npm run dev-link-tns-core-modules && npm run dev-link-tests && npm run dev-link-apps && npm run dev-link-e2e-modal",
"tsc": "node --max_old_space_size=4096 ./node_modules/typescript/bin/tsc",
"ci": "tsc && npm run tslint && npm run ci-apps && npm run ci-e2e && npm run ci-tests",
"ci-apps": "cd apps && npm i ../tns-core-modules ../tns-platform-declarations --save",
@@ -65,20 +66,14 @@
"dev-tsc-apps": "npm run tsc -- -p apps",
"dev-tsc-e2e": "npm run tsc -- -p e2e",
"dev-tsc-all": "npm run dev-tsc-tns-platform-declarations && npm run tsc && npm run dev-tsc-tests && npm run dev-tsc-apps && && npm run dev-tsc-e2e",
"dev-link-tns-platform-declarations": "cd tns-platform-declarations && npm link",
"dev-link-tns-core-modules": "cd tns-core-modules && npm link",
"dev-link-tns-core-modules-widgets": "(cd tns-core-modules-widgets/dist/package && npm link) && (cd tns-core-modules && npm i ../tns-core-modules-widgets/dist/package --save)",
"dev-link-tests": "cd tests && npm link tns-platform-declarations && npm link tns-core-modules",
"dev-link-apps": "cd apps && npm link tns-platform-declarations && npm link tns-core-modules",
"dev-link-e2e-modal": "cd e2e && cd modal-navigation && npm link tns-platform-declarations && npm link tns-core-modules",
"dev-declarations": "npm run setup && rm -rf tns-platform-declarations/ios/objc* && TNS_TYPESCRIPT_DECLARATIONS_PATH=$PWD/tns-platform-declarations/ios/objc tns build ios --path tests",
"test": "npm run test-android && npm run test-ios",
"pretest": "npm run setup && npm run tsc",
"test-android": "tns run android --path tests --justlaunch --no-watch",
"test-ios": "tns run ios --path tests --justlaunch --no-watch",
"test-watch-android": "npm run pretest && concurrently --kill-others \"npm run tsc-tiw\" \"tns livesync android --path tests --watch\"",
"test-watch-ios": "npm run pretest && concurrently --kill-others \"npm run tsc-tiw\" \"tns livesync ios --path tests --watch\"",
"prepublish": "echo \"Development reminder for setup\n - tns-core-modules: npm run setup\n - tns-core-modules-widgets: npm run setup-widgets\n\"",
"test-watch-android": "npm run pretest && concurrently --kill-others \"npm run tsc-w\" \"tns run android --path tests --watch\"",
"test-watch-ios": "npm run pretest && concurrently --kill-others \"npm run tsc-w\" \"tns run ios --path tests --watch\"",
"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",

32
tests/.gitignore vendored
View File

@@ -1,33 +1 @@
# 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

View File

@@ -1,21 +1,16 @@
// >> application-require
import * as app from "tns-core-modules/application";
import * as app from "tns-core-modules/application";
import * as platform from "tns-core-modules/platform";
// << application-require
// >> application-app-check
if (app.android) {
console.log("We are running on Android device!");
} else if (app.ios) {
console.log("We are running on iOS device");
}
// << application-app-check
import * as TKUnit from "../tk-unit";
if (app.android) {
console.log("We are running on an Android device!");
} else if (app.ios) {
console.log("We are running on an iOS device!");
}
export function testInitialized() {
if (platform.device.os === platform.platformNames.android) {
// we have the android defined
TKUnit.assert(app.android, "Application module not properly intialized");
} else if (platform.device.os === platform.platformNames.ios) {
TKUnit.assert(app.ios, "Application module not properly intialized");

View File

@@ -37,12 +37,13 @@ if (app.android) {
}
// << application-app-android-broadcast
export var testAndroidApplicationInitialized = function () {
export function testAndroidApplicationInitialized() {
TKUnit.assert(app.android, "Android application not initialized.");
TKUnit.assert(app.android.context, "Android context 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.foregroundActivity.isNativeScriptActivity, "Andorid foregroundActivity.isNativeScriptActivity is false.");
TKUnit.assert(app.android.startActivity, "Android startActivity not initialized.");
TKUnit.assert(app.android.nativeApp, "Android nativeApp not initialized.");
TKUnit.assert(app.android.orientation, "Android orientation not initialized.");
TKUnit.assert(app.android.packageName, "Android packageName not initialized.");
};
}

View File

@@ -1,4 +1,2 @@
/* tslint:disable */
//@private
import * as android from "./application-tests.android";
import * as iOS from "./application-tests.ios";
import * as iOS from "./application-tests.ios";

View File

@@ -1,5 +1,6 @@
/* tslint:disable:no-unused-variable */
import * as app from "tns-core-modules/application";
import * as TKUnit from "../tk-unit";
export * from "./application-tests-common";
@@ -39,3 +40,12 @@ if (app.ios) {
}
// << application-ios-delegate
export function testIOSApplicationInitialized() {
TKUnit.assert(app.ios, "iOS application not initialized.");
TKUnit.assert(app.ios.delegate, "iOS delegate not initialized.");
TKUnit.assert(app.ios.nativeApp, "iOS nativeApp not initialized.");
TKUnit.assert(app.ios.orientation, "iOS orientation not initialized.");
TKUnit.assert(app.ios.window, "iOS window not initialized.");
TKUnit.assert(app.ios.rootController, "iOS root controller not initialized.");
}

View File

@@ -1,34 +0,0 @@
---
nav-title: "application How-To"
title: "application"
environment: nativescript
description: "Examples for using application"
previous_url: /ApiReference/application/HOW-TO
---
# Application
The Application module provides abstraction over the platform-specific Application implementations.
It is the main BCL module and is required for other BCL modules to work properly.
The default bootstrap.js implementation for each platform loads and initializes this module.
{%snippet application-require%}
The pre-required `app` module is used throughout the following code snippets.
### Checking the target platform
Use the following code in case you need to check somewhere in your code the platform you are running against:
{%snippet application-app-check%}
### Using the Android-specific implementation
Accessing the Android-specific object instance (will be undefined if running on iOS)
{%snippet application-app-android%}
### Using the Android Application context
{%snippet application-app-android-context%}
### Tracking the current Activity
{%snippet application-app-android-current%}
### Registering a Broadcast Receiver (Android)
{%snippet application-app-android-broadcast%}
### Adding a Notification Observer (iOS)
{%snippet application-ios-observer%}

View File

@@ -1,46 +1,41 @@
import * as TKUnit from "../tk-unit";
import * as app from "tns-core-modules/application";
import { isIOS, isAndroid } from "tns-core-modules/platform";
// >> platform-require
import * as platformModule from "tns-core-modules/platform";
// << platform-require
export function test_setTimeout_isDefined() {
var expected;
export function test_platform() {
let expectedPlatform;
if (app.android) {
expected = "Android";
expectedPlatform = "Android";
} else {
expectedPlatform = "iOS";
}
else {
expected = "iOS";
}
TKUnit.assertEqual(platformModule.device.os, expected, "device.os");
TKUnit.assertEqual(platformModule.device.os, expectedPlatform);
}
export function snippet_print_all() {
// >> platform-current
console.log("Device model: " + platformModule.device.model);
console.log("Device type: " + platformModule.device.deviceType);
console.log("Device manufacturer: " + platformModule.device.manufacturer);
console.log("Preferred language: " + platformModule.device.language);
console.log("Preferred region: " + platformModule.device.region);
console.log("OS: " + platformModule.device.os);
console.log("OS version: " + platformModule.device.osVersion);
console.log("SDK version: " + platformModule.device.sdkVersion);
console.log("Device UUID: " + platformModule.device.uuid);
export function test_device_screen() {
TKUnit.assert(platformModule.device.model, "Device model not initialized.");
TKUnit.assert(platformModule.device.manufacturer, "Device manufacturer not initialized.");
TKUnit.assert(platformModule.device.deviceType, "Device type not initialized.");
TKUnit.assert(platformModule.device.uuid, "Device UUID not initialized.");
console.log("Screen width (px): " + platformModule.screen.mainScreen.widthPixels);
console.log("Screen height (px): " + platformModule.screen.mainScreen.heightPixels);
console.log("Screen width (DIPs): " + platformModule.screen.mainScreen.widthDIPs);
console.log("Screen height (DIPs): " + platformModule.screen.mainScreen.heightDIPs);
console.log("Screen scale: " + platformModule.screen.mainScreen.scale);
// << platform-current
TKUnit.assert(platformModule.device.language, "Preferred language not initialized.");
TKUnit.assert(platformModule.device.region, "Preferred region not initialized.");
TKUnit.assert(platformModule.device.os, "OS not initialized.");
TKUnit.assert(platformModule.device.osVersion, "OS version not initialized.");
TKUnit.assert(platformModule.device.sdkVersion, "SDK version not initialized.");
TKUnit.assert(platformModule.screen.mainScreen.widthPixels, "Screen width (px) not initialized.");
TKUnit.assert(platformModule.screen.mainScreen.heightPixels, "Screen height (px) not initialized.");
TKUnit.assert(platformModule.screen.mainScreen.widthDIPs, "Screen width (DIPs) not initialized.");
TKUnit.assert(platformModule.screen.mainScreen.heightDIPs, "Screen height (DIPs) not initialized.");
TKUnit.assert(platformModule.screen.mainScreen.scale, "Screen scale not initialized.");
}
export function testIsIOSandIsAndroid() {
if (isIOS) {
export function test_IsAndroid_IsIOS() {
if (platformModule.isIOS) {
TKUnit.assertTrue(!!NSObject, "isIOS is true-ish but common iOS APIs are not available.");
} else if (isAndroid) {
TKUnit.assertTrue(!!android, "isAndroid is true but common 'android' package is not available.");
} else if (platformModule.isAndroid) {
TKUnit.assertTrue(!!android, "isAndroid is true-ish but common 'android' package is not available.");
}
}

View File

@@ -154,6 +154,9 @@ if (platform.isIOS && ios.MajorVersion > 10) {
allTests["SAFEAREA-WEBVIEW"] = webViewSafeAreaTests;
}
import * as rootViewsCssClassesTests from "./ui/styling/root-views-css-classes-tests";
allTests["ROOT-VIEWS-CSS-CLASSES"] = rootViewsCssClassesTests;
import * as stylePropertiesTests from "./ui/styling/style-properties-tests";
allTests["STYLE-PROPERTIES"] = stylePropertiesTests;

Some files were not shown because too many files have changed in this diff Show More