diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2bdcb26be..e05ea3169 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -67,7 +67,7 @@ git checkout -b master 5. Before you submit your PR: - Rebase your changes to the latest master: `git pull --rebase upstream master`. - - Ensure all unit test are green for Android and iOS. Check [running unit tests](DevelopmentWorkflow.md#running-unit-tests). + - Ensure all unit test are green for Android and iOS. Check [running unit tests](DevelopmentWorkflow.md#running-unit-tests). - Ensure your changes pass tslint validation. (run `npm run tslint` in the root of the repo). 6. Push your fork. If you have rebased you might have to use force-push your branch: @@ -223,32 +223,26 @@ Instructions how to release a new version for **NativeScript Core Team Members** ``` git checkout release ``` -2. Create a PR to cut the release: +#### If we prepare major or minor release, merge master in release branch else **skip this step**. ``` -export RELEASE_VERSION=version -export BRANCH="release-${RELEASE_VERSION}" -git checkout -b ${BRANCH} -git push --set-upstream origin ${BRANCH} +git merge --ff-only origin/master ``` -#### Merge master in release branch or cherry-pick commits. If the commits are in release branch **skip this step**. -``` -git merge --ff-only origin/master or git cherry-pick commit-sha -git push --set-upstream origin prep-release-version -``` -3. Execute `npm i` to install dependencies: +*** Note: If there are commits in release branch which are not merged in master branch '-ff-merge' command will fail. +In this case the commits should be merge firstly from release in master branch as explained in section 'Merge changes from release into master' and then repeat step 1. + +2. Execute `npm i` to install dependencies: ``` npm i ``` -4. Execute [`npm version`](https://docs.npmjs.com/cli/version) to bump the version of `tns-platform-declarations`: +3. Execute [`npm version`](https://docs.npmjs.com/cli/version) to bump the version of `tns-platform-declarations`: ``` cd tns-platform-declarations npm --no-git-tag-version version [major|minor|patch] -m "release: cut the %s release" cd .. ``` -5. Execute [`npm version`](https://docs.npmjs.com/cli/version) to bump the version of `tns-core-modules`, -tag the release and update the CHANGELOG.md. -In case we need to publish release version we need simply to use npm version x.x.x-rc +4. Execute [`npm version`](https://docs.npmjs.com/cli/version) to bump the version of `tns-core-modules`, +tag the release and update the CHANGELOG.md. Don't forget to check the auto-generated CHANGELOG.md ``` cd tns-core-modules npm --no-git-tag-version version [major|minor|patch] -m "release: cut the %s release" @@ -257,6 +251,11 @@ cd .. 6. Set correct version of **tns-core-modules-widgets** in tns-core-modules/package.json. Usually tns-core-modules-widgets should already have been released and we need to set the official version. +7. Create release-branch with change log +``` +git checkout -b release-[release-version] +``` + 7. Add changes ``` git add changed-files @@ -268,13 +267,13 @@ git push git tag release-version git push --tags ``` -9. Create a pull request. Replace env variables ${RELEASE_VERSION} and ${BRANCH} with their values +9. Create a pull request. Be careful to base your branch on the correct branch ``` -curl -d '{"title": "release: cut the ${RELEASE_VERSION} release","body": "docs: update changelog","head": "${BRANCH}","base": "release"}' -X POST https://api.github.com/repos/NativeScript/NativeScript/pulls -H "Authorization: token ${GIT_TOKEN}" +curl -d '{"title": "release: cut the [release-version] release","body": "docs: update changelog","head": "${BRANCH}","base": "release"}' -X POST https://api.github.com/repos/NativeScript/NativeScript/pulls -H "Authorization: token ${GIT_TOKEN}" ``` 10. Merge PR into release branch. -11. If all checks has passed publish package. +11. If all checks has passed publish package. Usually the night builds will be triggered and the package will be ready to be released on the next day. ## Merge changes from release into master diff --git a/CodingConvention.md b/CodingConvention.md index 826e49bd6..dc7cea973 100644 --- a/CodingConvention.md +++ b/CodingConvention.md @@ -205,7 +205,7 @@ let b = {"good": "code" ## Equality operator -Use the [strict comparison operators][comparisonoperators]. The triple equality operator helps to maintain data type integrity throughout code. +Use the [strict comparison operators][comparisonoperators]. The triple equality operator helps to maintain data type integrity throughout the code. *Right:* @@ -341,8 +341,8 @@ the last row of a big room can comfortably read. So don't count on them having perfect vision and limit yourself to 1/2 of your screen height per function (no screen rotation :). ## Return statements -There are few important considerations here: -+ To avoid deep nesting of if-statements, always return a functions value as early +There are a few important considerations here: ++ To avoid deep nesting of if-statements, always return a function's value as early as possible. In certain routines, once you know the answer, you want to return it to the calling routine immediately. If the routine is defined in such a way that it doesn't require any cleanup, not returning immediately means that you have to write more code. + Minimize the number of returns in each routine. It's harder to understand a routine if, reading it at the bottom, you're unaware of the possibility that it *return*ed somewhere above. @@ -396,7 +396,7 @@ function getSomething(val) { ## Arrow Functions -Use arrow functions over anonymous function expressions. Typescript will take care for `this`. +Use arrow functions over anonymous function expressions. Typescript will take care of `this`. *Right:* @@ -423,7 +423,7 @@ req.on("end", function () { Use the [JSDoc][JSDOC] convention for comments. When writing a comment always think how understandable will be for somebody who is new to this code. Even if it may look simple to you think how a guy that just joined will understand it. Always comment in the following cases: + When there is some non-trivial logic. -+ Some "external" knowledge is needed which is missing in the context - workaround for driver, module bug, special 'hack' because of a bug and so on; ++ Some "external" knowledge is needed which is missing in the context - workaround for a driver, module bug, special 'hack' because of a bug and so on; + When you are creating a new class + Public methods - include all the arguments and if possible the types {String}, {Number}. Optional arguments should be marked too. Check the [@param tag][param] @@ -432,7 +432,7 @@ Use the [JSDoc][JSDOC] convention for comments. When writing a comment always th ## File/module structure -Typical module should have the following structure: +A typical module should have the following structure: 1. required dependencies 2. module-private declarations - variables, functions, classes, etc. @@ -442,7 +442,7 @@ Typical module should have the following structure: For more information see [this file](https://github.com/telerik/xPlatCore/blob/master/JS/BCL/CreateNewModule.md) ## File naming -Use lower case for file names. Use dash to separate different words. +Use lower case for file names. Use a dash to separate different words. *Right:* file-system @@ -451,7 +451,7 @@ file-system FileSystem, fileSystem, file_system ## This, that, self -When you **need** to keep reference to **this** use **that** as the name of the variable. Additionally, if you use the TypeScript lambda support, the compiler will take care of this automatically. +When you **need** to keep a reference to **this** use **that** as the name of the variable. Additionally, if you use the TypeScript lambda support, the compiler will take care of this automatically. *Right:* ```TypeScript @@ -470,7 +470,7 @@ doSomething(function(){ ``` ## Private (hidden) variables and methods -Although there is the **private** keyword in TypeScript, it is only a syntax sugar. There is no such notation in JavaScript and everything is available to the users. Hence, always use underscore (**_**) to prefix private variables and methods. There are also methods which have the **public** visibility but they are meant to be used within our code ONLY. Such methods should also be prefixed with underscore. +Although there is the **private** keyword in TypeScript, it is only a syntax sugar. There is no such notation in JavaScript and everything is available to the users. Hence, always use underscore (**_**) to prefix private variables and methods. There are also methods which have the **public** visibility but they are meant to be used within our code ONLY. Such methods should also be prefixed with an underscore. *Right:* ```TypeScript diff --git a/WritingUnitTests.md b/WritingUnitTests.md index e2d791692..a6945bc1c 100644 --- a/WritingUnitTests.md +++ b/WritingUnitTests.md @@ -1,7 +1,7 @@ # Writing Unit Tests for NativeScript Core Modules Unit tests for NativeScript Modules are written and executed with a custom lightweight test-runner and assertion framework. -The purpose of this document is to get you familiar with it, so that you can unit-test your contributions to the NativeScript framework. +The purpose of this document is to get you familiar with it so that you can unit-test your contributions to the NativeScript framework. # Run Unit Tests Project @@ -19,7 +19,7 @@ tns run ios # Test Modules All unit tests are organized into test modules(bundles). -By default the test app will run all the tests from all registered test modules. This happens in [`runTests()`](/tests/app/app/mainPage.ts#L26-L28) method in the main page of the test-app. By modifying this method, you can configure the app to: +By default, the test app will run all the tests from all registered test modules. This happens in [`runTests()`](/tests/app/app/mainPage.ts#L26-L28) method in the main page of the test-app. By modifying this method, you can configure the app to: * **Execute only the tests from a specific test module**: @@ -50,8 +50,8 @@ The test modules are actually TypeScript modules which export unit tests and hoo * All exported functions with a `test` prefix are unit-tests. * The `setUpModule()` hook is called once - before all the tests in the module. -* The `setUp()` hook is called before each tests. -* The `tearDown()` hook called after each tests. +* The `setUp()` hook is called before each test. +* The `tearDown()` hook called after each test. * The `tearDownModule()` hook is called once - after all the tests in the module. # Asserting @@ -85,4 +85,4 @@ export function test_getJSON(done) { # Misc -When looking into the code of the existing tests, you might encounter strange comments looking like this `// >> animation-chaining`. These are markers for code snippets generated in the docs documetation. They are not related to testing so you don't need to add any of those in your tests. +When looking into the code of the existing tests, you might encounter strange comments looking like this `// >> animation-chaining`. These are markers for code snippets generated in the docs documentation. They are not related to testing so you don't need to add any of those in your tests. diff --git a/apps/app/App_Resources/Android/AndroidManifest.xml b/apps/app/App_Resources/Android/AndroidManifest.xml index 72e4464c2..b73635900 100644 --- a/apps/app/App_Resources/Android/AndroidManifest.xml +++ b/apps/app/App_Resources/Android/AndroidManifest.xml @@ -27,6 +27,17 @@ android:theme="@style/AppTheme" android:usesCleartextTraffic="true" > + + + + + + + + diff --git a/apps/app/ui-tests-app/action-bar/icons.ts b/apps/app/ui-tests-app/action-bar/icons.ts new file mode 100644 index 000000000..1522a19e2 --- /dev/null +++ b/apps/app/ui-tests-app/action-bar/icons.ts @@ -0,0 +1,17 @@ +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 onChangeRenderingMode(args: EventData) { + const button = + + \ No newline at end of file diff --git a/apps/app/ui-tests-app/main-page.ts b/apps/app/ui-tests-app/main-page.ts index 2e6c4fd49..88d6d06d9 100644 --- a/apps/app/ui-tests-app/main-page.ts +++ b/apps/app/ui-tests-app/main-page.ts @@ -36,6 +36,7 @@ export function pageLoaded(args: EventData) { examples.set("progress-bar", "progress-bar/main-page"); examples.set("date-picker", "date-picker/date-picker"); examples.set("nested-frames", "nested-frames/main-page"); + examples.set("intent", "intent/main-page"); page.bindingContext = new MainPageViewModel(wrapLayout, examples); const parent = page.getViewById("parentLayout"); diff --git a/apps/app/ui-tests-app/tab-view/main-page.ts b/apps/app/ui-tests-app/tab-view/main-page.ts index 57c80f6d7..69d4aa857 100644 --- a/apps/app/ui-tests-app/tab-view/main-page.ts +++ b/apps/app/ui-tests-app/tab-view/main-page.ts @@ -19,6 +19,7 @@ export function loadExamples() { 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"); diff --git a/apps/app/ui-tests-app/tab-view/tab-view-icon-local.ts b/apps/app/ui-tests-app/tab-view/tab-view-icon-local.ts new file mode 100644 index 000000000..81942fa1f --- /dev/null +++ b/apps/app/ui-tests-app/tab-view/tab-view-icon-local.ts @@ -0,0 +1,21 @@ +import { EventData } from "tns-core-modules/data/observable"; +import { Button } from "tns-core-modules/ui/button"; +import { TabView } from "tns-core-modules/ui/tab-view"; + +let iconModes = ["automatic", "alwaysOriginal", "alwaysTemplate", undefined]; + +export const onNavigate = updateButtons; + +export function onChangeRenderingMode(args: EventData) { + let tabView = (