mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
@ -11,7 +11,7 @@ addons:
|
||||
artifacts:
|
||||
paths:
|
||||
- "$HOME/test-run-results$PACKAGE_VERSION.xml"
|
||||
sudo: required
|
||||
sudo: false
|
||||
dist: trusty
|
||||
language: android
|
||||
node_js:
|
||||
|
@ -447,8 +447,8 @@
|
||||
<TypeScriptCompile Include="apps\tests\connectivity-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\console-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\file-name-resolver-tests\file-name-resolver-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\frame-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\gestures-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\frame-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\gestures\gestures-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\fetch-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\layouts\layout-helper.d.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\layouts\layout-helper.ios.ts">
|
||||
@ -548,7 +548,7 @@
|
||||
<TypeScriptCompile Include="apps\tests\ui\list-picker\list-picker-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\scroll-view\scroll-view-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\search-bar\search-bar-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\style\style-properties-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\styling\style-properties-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\view\view-tests.d.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\html-view\html-view-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\web-view\web-view-tests.ts" />
|
||||
@ -720,7 +720,7 @@
|
||||
<TypeScriptCompile Include="apps\tests\ui\bindable-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\dependency-observable-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\helper.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\observable-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\data\observable-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\pages\page6.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\pages\page5.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\application-tests-common.ts" />
|
||||
@ -737,7 +737,7 @@
|
||||
<TypeScriptCompile Include="apps\tests\location-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\TKUnit.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\slider\slider-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\style\visual-state-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\styling\visual-state-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\switch\switch-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\view\view-tests-common.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\view\view-tests.android.ts">
|
||||
@ -829,10 +829,16 @@
|
||||
<TypeScriptCompile Include="ui\layouts\layout.android.ts">
|
||||
<DependentUpon>layout.d.ts</DependentUpon>
|
||||
</TypeScriptCompile>
|
||||
<TypeScriptCompile Include="ui\layouts\layout-base.ts">
|
||||
<TypeScriptCompile Include="ui\layouts\layout-base.d.ts" />
|
||||
<TypeScriptCompile Include="ui\layouts\layout-base-common.ts">
|
||||
<DependentUpon>layout-base.d.ts</DependentUpon>
|
||||
</TypeScriptCompile>
|
||||
<TypeScriptCompile Include="ui\layouts\layout-base.android.ts">
|
||||
<DependentUpon>layout-base.d.ts</DependentUpon>
|
||||
</TypeScriptCompile>
|
||||
<TypeScriptCompile Include="ui\layouts\layout-base.ios.ts">
|
||||
<DependentUpon>layout-base.d.ts</DependentUpon>
|
||||
</TypeScriptCompile>
|
||||
<TypeScriptCompile Include="ui\layouts\layout-base.d.ts" />
|
||||
<TypeScriptCompile Include="ui\layouts\stack-layout\stack-layout.ios.ts">
|
||||
<DependentUpon>stack-layout.d.ts</DependentUpon>
|
||||
</TypeScriptCompile>
|
||||
@ -1174,7 +1180,7 @@
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="apps\tests\test-icon.png" />
|
||||
<Content Include="apps\tests\ui\style\test.css" />
|
||||
<Content Include="apps\tests\ui\styling\test.css" />
|
||||
<Content Include="apps\tests\xml-declaration\inherited-page.xml" />
|
||||
<Content Include="apps\tests\xml-declaration\mymodulewithxml\my-control-no-js.xml">
|
||||
<SubType>Designer</SubType>
|
||||
@ -1343,7 +1349,9 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include=".gitignore" />
|
||||
<Content Include="apps\template-blank\main-page.xml" />
|
||||
<Content Include="apps\template-blank\main-page.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="apps\tests\small-image.png" />
|
||||
<Content Include="apps\tests\pages\page14.xml">
|
||||
<SubType>Designer</SubType>
|
||||
@ -1456,7 +1464,7 @@
|
||||
<TypeScriptCompile Include="xhr\xhr.ts" />
|
||||
<TypeScriptCompile Include="xml\xml.d.ts" />
|
||||
<TypeScriptCompile Include="data\observable-array\observable-array.d.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\observable-array-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\data\observable-array-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\xml-parser-tests\xml-parser-tests.ts" />
|
||||
<TypeScriptCompile Include="xml\xml.ts">
|
||||
<DependentUpon>xml.d.ts</DependentUpon>
|
||||
@ -1626,7 +1634,7 @@
|
||||
<TypeScriptCompile Include="utils\utils-common.ts">
|
||||
<DependentUpon>utils.d.ts</DependentUpon>
|
||||
</TypeScriptCompile>
|
||||
<TypeScriptCompile Include="apps\tests\virtual-array-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\data\virtual-array-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\button\button-tests-native.d.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\button\button-tests.ts" />
|
||||
<TypeScriptCompile Include="apps\tests\ui\button\button-tests-native.android.ts">
|
||||
@ -2222,7 +2230,7 @@
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
<UserProperties ui_2layouts_2wrap-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2grid-layout_2package_1json__JSONSchema="" ui_2layouts_2dock-layout_2package_1json__JSONSchema="" ui_2layouts_2absolute-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2web-view_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2content-view_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2gallery-app_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2absolute-layout-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2editable-text-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2scroll-view_2package_1json__JSONSchema="http://json.schemastore.org/package" />
|
||||
<UserProperties ui_2scroll-view_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2editable-text-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2absolute-layout-demo_2package_1json__JSONSchema="http://json.schemastore.org/package" apps_2gallery-app_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2content-view_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2web-view_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2absolute-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" ui_2layouts_2dock-layout_2package_1json__JSONSchema="" ui_2layouts_2grid-layout_2package_1json__JSONSchema="" ui_2layouts_2wrap-layout_2package_1json__JSONSchema="http://json.schemastore.org/package" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "application-settings How-To"
|
||||
title: "How-To"
|
||||
title: "application-settings"
|
||||
description: "Examples for using application-settings"
|
||||
previous_url: /ApiReference/application-settings/HOW-TO
|
||||
---
|
||||
# Application Settings
|
||||
Using application settings methods requires to load "application settings" module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "application How-To"
|
||||
title: "How-To"
|
||||
title: "application"
|
||||
description: "Examples for using application"
|
||||
previous_url: /ApiReference/application/HOW-TO
|
||||
---
|
||||
# Application
|
||||
The Application module provides abstraction over the platform-specific Application implementations.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "camera How-To"
|
||||
title: "How-To"
|
||||
title: "camera"
|
||||
description: "Examples for using camera"
|
||||
previous_url: /ApiReference/camera/HOW-TO
|
||||
---
|
||||
# Camera module
|
||||
Using a camera requires the camera module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "color How-To"
|
||||
title: "How-To"
|
||||
title: "color"
|
||||
description: "Examples for using color"
|
||||
previous_url: /ApiReference/color/HOW-TO
|
||||
---
|
||||
# Color
|
||||
Using Colors requires the "color" module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "connectivity How-To"
|
||||
title: "How-To"
|
||||
title: "connectivity"
|
||||
description: "Examples for using connectivity"
|
||||
previous_url: /ApiReference/connectivity/HOW-TO
|
||||
---
|
||||
# Connectivity
|
||||
Obtaining connectivity information requires the "connectivity" module.
|
||||
@ -11,4 +12,4 @@ Obtaining connectivity information requires the "connectivity" module.
|
||||
<snippet id='connectivity-type'/>
|
||||
|
||||
### Monitoring connection type.
|
||||
<snippet id='connectivity-monitoring'/>
|
||||
<snippet id='connectivity-monitoring'/>
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "console How-To"
|
||||
title: "How-To"
|
||||
title: "console"
|
||||
description: "Examples for using console"
|
||||
previous_url: /ApiReference/console/HOW-TO
|
||||
---
|
||||
# Console
|
||||
### Logging
|
||||
|
@ -1,4 +1,4 @@
|
||||
import TKUnit = require("./TKUnit");
|
||||
import TKUnit = require("../TKUnit");
|
||||
import bindableModule = require("ui/core/bindable");
|
||||
require("globals");
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "observable-array How-To"
|
||||
title: "How-To"
|
||||
title: "observable-array"
|
||||
description: "Examples for using observable-array"
|
||||
previous_url: /ApiReference/data/observable-array/HOW-TO
|
||||
---
|
||||
# Observable Array module
|
||||
<snippet id='observable-array-require'/>
|
@ -3,7 +3,7 @@ import observable = require("data/observable");
|
||||
// << observable-require
|
||||
|
||||
import dependencyObservable = require("ui/core/dependency-observable");
|
||||
import TKUnit = require("./TKUnit");
|
||||
import TKUnit = require("../TKUnit");
|
||||
import types = require("utils/types");
|
||||
import proxy = require("ui/core/proxy");
|
||||
|
||||
@ -524,4 +524,4 @@ export function test_CorrectPropertyValueAfterUsingWrappedValue() {
|
||||
testObservable.set("property1", wrappedArray);
|
||||
|
||||
TKUnit.assertEqual(testObservable.get("property1"), testArray, "WrappedValue is used only to execute property change logic and unwrapped value should be used as proeprty value.");
|
||||
}
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "data/observable How-To"
|
||||
title: "How-To"
|
||||
title: "observable"
|
||||
description: "Examples for using data/observable"
|
||||
previous_url: /ApiReference/data/observable/HOW-TO
|
||||
---
|
||||
# Observable
|
||||
Using Observable objects requires the "data/observable" module.
|
@ -1,4 +1,4 @@
|
||||
import TKUnit = require("./TKUnit");
|
||||
import TKUnit = require("../TKUnit");
|
||||
import types = require("utils/types");
|
||||
|
||||
// >> virtual-array-require
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "virtual-array How-To"
|
||||
title: "How-To"
|
||||
title: "virtual-array"
|
||||
description: "Examples for using virtual-array"
|
||||
previous_url: /ApiReference/data/virtual-array/HOW-TO
|
||||
---
|
||||
# Virtual Array module
|
||||
<snippet id='virtual-array-require'/>
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "fetch How-To"
|
||||
title: "How-To"
|
||||
title: "fetch"
|
||||
description: "Examples for using fetch"
|
||||
previous_url: /ApiReference/fetch/HOW-TO
|
||||
---
|
||||
### Get Response from URL
|
||||
<snippet id='fetch-response'/>
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "file-system How-To"
|
||||
title: "How-To"
|
||||
title: "file-system"
|
||||
description: "Examples for using file-system"
|
||||
previous_url: /ApiReference/file-system/HOW-TO
|
||||
---
|
||||
# File System
|
||||
Using the file system requires the FileSystem module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "fps-meter How-To"
|
||||
title: "How-To"
|
||||
title: "fps-meter"
|
||||
description: "Examples for using fps-meter"
|
||||
previous_url: /ApiReference/fps-meter/HOW-TO
|
||||
---
|
||||
# Frames-per-second meter
|
||||
Logging frames-per-second statistics for your app requires the "fps-meter" module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "http How-To"
|
||||
title: "How-To"
|
||||
title: "http"
|
||||
description: "Examples for using http"
|
||||
previous_url: /ApiReference/http/HOW-TO
|
||||
---
|
||||
# Http module
|
||||
Using http methods requires to load "http" module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "image-source How-To"
|
||||
title: "How-To"
|
||||
title: "image-source"
|
||||
description: "Examples for using image-source"
|
||||
previous_url: /ApiReference/image-source/HOW-TO
|
||||
---
|
||||
# Image source
|
||||
Using the image source requires the image-source module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "location How-To"
|
||||
title: "How-To"
|
||||
title: "location"
|
||||
description: "Examples for using location"
|
||||
previous_url: /ApiReference/location/HOW-TO
|
||||
---
|
||||
# Location
|
||||
Using the location requires the Location module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "platform How-To"
|
||||
title: "How-To"
|
||||
title: "platform"
|
||||
description: "Examples for using platform"
|
||||
previous_url: /ApiReference/platform/HOW-TO
|
||||
---
|
||||
# Platform
|
||||
Information about the current device and screen are defined in the platform module
|
||||
|
@ -38,9 +38,9 @@ allTests["FETCH"] = require("./fetch-tests");
|
||||
allTests["APPLICATION SETTINGS"] = require("./application-settings-tests");
|
||||
allTests["APPLICATION"] = require("./application-tests");
|
||||
allTests["IMAGE SOURCE"] = require("./image-source-tests");
|
||||
allTests["OBSERVABLE-ARRAY"] = require("./observable-array-tests");
|
||||
allTests["VIRTUAL-ARRAY"] = require("./virtual-array-tests");
|
||||
allTests["OBSERVABLE"] = require("./observable-tests");
|
||||
allTests["OBSERVABLE-ARRAY"] = require("./data/observable-array-tests");
|
||||
allTests["VIRTUAL-ARRAY"] = require("./data/virtual-array-tests");
|
||||
allTests["OBSERVABLE"] = require("./data/observable-tests");
|
||||
allTests["TIMER"] = require("./timer-tests");
|
||||
allTests["COLOR"] = require("./color-tests");
|
||||
allTests["DEPENDENCY-OBSERVABLE"] = require("./ui/dependency-observable-tests");
|
||||
@ -57,17 +57,17 @@ allTests["PROXY-VIEW-CONTAINER"] = require("./ui/proxy-view-container/proxy-view
|
||||
allTests["SCROLL-VIEW"] = require("./ui/scroll-view/scroll-view-tests");
|
||||
allTests["ACTION-BAR"] = require("./ui/action-bar/action-bar-tests");
|
||||
allTests["XML-DECLARATION"] = require("./xml-declaration/xml-declaration-tests");
|
||||
allTests["DOCKLAYOUT"] = require("./layouts/dock-layout-tests");
|
||||
allTests["WRAPLAYOUT"] = require("./layouts/wrap-layout-tests");
|
||||
allTests["ABSOLUTELAYOUT"] = require("./layouts/absolute-layout-tests");
|
||||
allTests["GRIDLAYOUT"] = require("./layouts/grid-layout-tests");
|
||||
allTests["STACKLAYOUT"] = require("./layouts/stack-layout-tests");
|
||||
allTests["STYLE-PROPERTIES"] = require("./ui/style/style-properties-tests");
|
||||
allTests["FRAME"] = require("./frame-tests");
|
||||
allTests["DOCKLAYOUT"] = require("./ui/layouts/dock-layout-tests");
|
||||
allTests["WRAPLAYOUT"] = require("./ui/layouts/wrap-layout-tests");
|
||||
allTests["ABSOLUTELAYOUT"] = require("./ui/layouts/absolute-layout-tests");
|
||||
allTests["GRIDLAYOUT"] = require("./ui/layouts/grid-layout-tests");
|
||||
allTests["STACKLAYOUT"] = require("./ui/layouts/stack-layout-tests");
|
||||
allTests["STYLE-PROPERTIES"] = require("./ui/styling/style-properties-tests");
|
||||
allTests["FRAME"] = require("./ui/frame/frame-tests");
|
||||
allTests["VIEW"] = require("./ui/view/view-tests");
|
||||
allTests["STYLE"] = require("./ui/style/style-tests");
|
||||
allTests["VISUAL-STATE"] = require("./ui/style/visual-state-tests");
|
||||
allTests["VALUE-SOURCE"] = require("./ui/style/value-source-tests");
|
||||
allTests["STYLE"] = require("./ui/styling/style-tests");
|
||||
allTests["VISUAL-STATE"] = require("./ui/styling/visual-state-tests");
|
||||
allTests["VALUE-SOURCE"] = require("./ui/styling/value-source-tests");
|
||||
allTests["BUTTON"] = require("./ui/button/button-tests");
|
||||
allTests["BORDER"] = require("./ui/border/border-tests");
|
||||
allTests["LABEL"] = require("./ui/label/label-tests");
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "Formatted String How-To"
|
||||
title: "How-To"
|
||||
title: "formatted-string"
|
||||
description: "Examples for using Formatted String"
|
||||
previous_url: /ApiReference/text/formatted-string/HOW-TO
|
||||
---
|
||||
# Formatted String
|
||||
Using a formatted string requires loading formatted-string and span module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "timer How-To"
|
||||
title: "How-To"
|
||||
title: "timer"
|
||||
description: "Examples for using timer"
|
||||
previous_url: /ApiReference/timer/HOW-TO
|
||||
---
|
||||
# Timer module
|
||||
### How to require timer module
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "trace How-To"
|
||||
title: "How-To"
|
||||
title: "trace"
|
||||
description: "Examples for using trace"
|
||||
previous_url: /ApiReference/trace/HOW-TO
|
||||
---
|
||||
# Trace
|
||||
Tracing information about your app requires the "trace" module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "ActionBar How-To"
|
||||
title: "How-To"
|
||||
title: "action-bar"
|
||||
description: "Examples for using ActionBar"
|
||||
previous_url: /ApiReference/ui/action-bar/HOW-TO
|
||||
---
|
||||
# ActionBar
|
||||
Using a ActionBar requires the action-bar module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "activity-indicator How-To"
|
||||
title: "How-To"
|
||||
title: "activity-indicator"
|
||||
description: "Examples for using activity-indicator"
|
||||
previous_url: /ApiReference/ui/activity-indicator/HOW-TO
|
||||
---
|
||||
# ActivityIndicator
|
||||
Using the activity indicator requires the ActivityIndicator module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "animation How-To"
|
||||
title: "How-To"
|
||||
title: "animation"
|
||||
description: "Examples for using animation"
|
||||
previous_url: /ApiReference/ui/animation/HOW-TO
|
||||
---
|
||||
# Animation
|
||||
Animating view properties requires the "ui/animation" module.
|
||||
|
@ -492,6 +492,7 @@ export var test_bindingToNestedPropertyWithValueSyntax = function () {
|
||||
}, bindingSource);
|
||||
|
||||
TKUnit.assertEqual(testElement.get("targetPropertyName"), "testValue");
|
||||
TKUnit.assertTrue(bindingSource['$value'] === undefined, "We should not add $value to bindingSource.");
|
||||
}
|
||||
|
||||
export var test_TwoElementsBindingToSameBindingContext = function () {
|
||||
@ -546,6 +547,58 @@ export var test_BindingToSource_FailsAfterBindingContextChange = function () {
|
||||
helper.buildUIAndRunTest(createLabel(), testFunc);
|
||||
}
|
||||
|
||||
export var test_BindingToParentView_ShouldNotLeaveGarbageInViewModel = function () {
|
||||
var createStack = function () {
|
||||
var stack = new stackLayoutModule.StackLayout();
|
||||
var label = new labelModule.Label();
|
||||
stack.addChild(label);
|
||||
return stack;
|
||||
}
|
||||
var stackViewModel = new observable.Observable();
|
||||
var expectedValue = "testValue";
|
||||
stackViewModel.set("testProperty", expectedValue);
|
||||
|
||||
var testFunc = function (views: Array<viewModule.View>) {
|
||||
let testStack = <stackLayoutModule.StackLayout>(views[0]);
|
||||
testStack.bindingContext = stackViewModel;
|
||||
|
||||
let testLabel = <labelModule.Label>(testStack.getChildAt(0));
|
||||
testLabel.bind({ sourceProperty: "$parent.testProperty", targetProperty: "text", expression: "$parent.testProperty"});
|
||||
|
||||
TKUnit.assertEqual(testLabel.text, expectedValue);
|
||||
TKUnit.assertTrue(stackViewModel['$parent'] === undefined, "stackViewModel['$parent'] should be removed from parent binding context.");
|
||||
TKUnit.assertTrue(testLabel.bindingContext['$parent'] === undefined, "testLabel.bindingContext['$parent'] should be removed from parent binding context.");
|
||||
}
|
||||
|
||||
helper.buildUIAndRunTest(createStack(), testFunc);
|
||||
}
|
||||
|
||||
export var test_BindingToParentsView_ShouldNotLeaveGarbageInViewModel = function () {
|
||||
var createStack = function () {
|
||||
var stack = new stackLayoutModule.StackLayout();
|
||||
var label = new labelModule.Label();
|
||||
stack.addChild(label);
|
||||
return stack;
|
||||
}
|
||||
var stackViewModel = new observable.Observable();
|
||||
var expectedValue = "testValue";
|
||||
stackViewModel.set("testProperty", expectedValue);
|
||||
|
||||
var testFunc = function (views: Array<viewModule.View>) {
|
||||
let testStack = <stackLayoutModule.StackLayout>(views[0]);
|
||||
testStack.bindingContext = stackViewModel;
|
||||
|
||||
let testLabel = <labelModule.Label>(testStack.getChildAt(0));
|
||||
testLabel.bind({ sourceProperty: "$parents['StackLayout'].testProperty", targetProperty: "text", expression: "$parents['StackLayout'].testProperty"});
|
||||
|
||||
TKUnit.assertEqual(testLabel.text, expectedValue);
|
||||
TKUnit.assertTrue(stackViewModel['$parent'] === undefined, "stackViewModel['$parent'] should be removed from parent binding context.");
|
||||
TKUnit.assertTrue(testLabel.bindingContext['$parents'] === undefined, "testLabel.bindingContext['$parents'] should be removed from parent binding context.");
|
||||
}
|
||||
|
||||
helper.buildUIAndRunTest(createStack(), testFunc);
|
||||
}
|
||||
|
||||
export function test_BindingToDictionaryAtAppLevel() {
|
||||
var createLabel = function () {
|
||||
var label = new labelModule.Label();
|
||||
@ -998,6 +1051,7 @@ export function test_$ValueSupportWithinExpression() {
|
||||
model.set("anyColor", "red");
|
||||
|
||||
TKUnit.assertEqual(bindableObj.get("test"), "red", "When anyColor is red test property should be red too.");
|
||||
TKUnit.assertTrue(model['$value'] === undefined, "We should not add $value to binding context.");
|
||||
}
|
||||
|
||||
class DummyNestedClass extends observable.Observable {
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "Border How-To"
|
||||
title: "How-To"
|
||||
title: "border"
|
||||
description: "Examples for using Border"
|
||||
previous_url: /ApiReference/ui/border/HOW-TO
|
||||
---
|
||||
# Border
|
||||
Using borders requires the "ui/border" module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "button How-To"
|
||||
title: "How-To"
|
||||
title: "button"
|
||||
description: "Examples for using button"
|
||||
previous_url: /ApiReference/ui/button/HOW-TO
|
||||
---
|
||||
# Button
|
||||
### Declaring button module
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "DatePicker How-To"
|
||||
title: "How-To"
|
||||
title: "date-picker"
|
||||
description: "Examples for using DatePicker"
|
||||
previous_url: /ApiReference/ui/date-picker/HOW-TO
|
||||
---
|
||||
# DatePicker
|
||||
Using a DatePicker requires the "ui/date-picker" module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "dialogs How-To"
|
||||
title: "How-To"
|
||||
title: "dialogs"
|
||||
description: "Examples for using dialogs"
|
||||
previous_url: /ApiReference/ui/dialogs/HOW-TO
|
||||
---
|
||||
# Dialogs
|
||||
Displaying dialogs requires the "ui/dialogs" module.
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "frame How-To"
|
||||
title: "How-To"
|
||||
title: "frame"
|
||||
description: "Examples for using frame"
|
||||
previous_url: /ApiReference/ui/frame/HOW-TO
|
||||
---
|
||||
# Frame
|
||||
To perform navigation, you will need a reference to the topmost frame of the application.
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "gestures How-To"
|
||||
title: "How-To"
|
||||
title: "gestures"
|
||||
description: "Examples for using gestures"
|
||||
previous_url: /ApiReference/ui/gestures/HOW-TO
|
||||
---
|
||||
# Gestures
|
||||
Detecting user gestures requires the "ui/gestures" module.
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "HtmlView How-To"
|
||||
title: "How-To"
|
||||
title: "html-view"
|
||||
description: "Examples for using HtmlView"
|
||||
previous_url: /ApiReference/ui/html-view/HOW-TO
|
||||
---
|
||||
# HtmlView
|
||||
Using a HtmlView requires the html-view module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "image-cache How-To"
|
||||
title: "How-To"
|
||||
title: "image-cache"
|
||||
description: "Examples for using image-cache"
|
||||
previous_url: /ApiReference/ui/image-cache/HOW-TO
|
||||
---
|
||||
# ImageCache
|
||||
Using the ImageCache requires the "ui/image-cache" module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "Image How-To"
|
||||
title: "How-To"
|
||||
title: "image"
|
||||
description: "Examples for using Image"
|
||||
previous_url: /ApiReference/ui/image/HOW-TO
|
||||
---
|
||||
# Image
|
||||
Using an image requires the Image module to be loaded.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "Label How-To"
|
||||
title: "How-To"
|
||||
title: "label"
|
||||
description: "Examples for using Label"
|
||||
previous_url: /ApiReference/ui/label/HOW-TO
|
||||
---
|
||||
# Label
|
||||
Using a label requires the Label module.
|
||||
|
@ -1,5 +1,5 @@
|
||||
import testModule = require("../ui-test");
|
||||
import TKUnit = require("../TKUnit");
|
||||
import testModule = require("../../ui-test");
|
||||
import TKUnit = require("../../TKUnit");
|
||||
import labelModule = require("ui/label");
|
||||
import colorModule = require("color");
|
||||
import layoutHelper = require("./layout-helper");
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "absolute-layout How-To"
|
||||
title: "How-To"
|
||||
title: "absolute-layoyt"
|
||||
description: "Examples for using absolute-layout"
|
||||
previous_url: /ApiReference/ui/layouts/absolute-layout/HOW-TO
|
||||
---
|
||||
# AbsoluteLayout
|
||||
Using a AbsoluteLayout requires the AbsoluteLayout module.
|
@ -1,7 +1,7 @@
|
||||
import TKUnit = require("../TKUnit");
|
||||
import TKUnit = require("../../TKUnit");
|
||||
import layoutHelper = require("./layout-helper");
|
||||
import enums = require("ui/enums");
|
||||
import testModule = require("../ui-test");
|
||||
import testModule = require("../../ui-test");
|
||||
import {LayoutBase} from "ui/layouts/layout-base";
|
||||
import {widthProperty} from "ui/styling/style"
|
||||
import platform = require("platform");
|
||||
@ -152,4 +152,4 @@ export function percent_support_test(test: testModule.UITest<LayoutBase>) {
|
||||
TKUnit.assertEqual(bounds.top, 0, "Reset Stretch layout TOP incorrect");
|
||||
TKUnit.assertEqual(bounds.right, 200, "Reset Stretch layout RIGHT incorrect");
|
||||
TKUnit.assertEqual(bounds.bottom, 200, "Reset Stretch layout BOTTOM incorrect");
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
import button = require("ui/button");
|
||||
import {DockLayout} from "ui/layouts/dock-layout";
|
||||
import TKUnit = require("../TKUnit");
|
||||
import TKUnit = require("../../TKUnit");
|
||||
import helper = require("./layout-helper");
|
||||
import testModule = require("../ui-test");
|
||||
import testModule = require("../../ui-test");
|
||||
import layoutHelper = require("./layout-helper");
|
||||
import commonTests = require("./common-layout-tests");
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
---
|
||||
nav-title: "dock-layout How-To"
|
||||
title: "How-To"
|
||||
title: "dock-layout"
|
||||
description: "Examples for using dock-layout"
|
||||
previous_url: /ApiReference/ui/layouts/dock-layout/HOW-TO
|
||||
---
|
||||
# DockLayout
|
||||
Using a DockLayout requires the DockLayout module.
|
||||
@ -33,5 +33,5 @@ Other frequently used modules when working with a DockLayout include:
|
||||
## Remove child view from layout
|
||||
<snippet id='dock-layout-removechild'/>
|
||||
|
||||
## Setting the dock property
|
||||
## Setting the dock roperty
|
||||
<snippet id='dock-layout-setdocl'/>
|
@ -1,11 +1,11 @@
|
||||
import {Page} from "ui/page";
|
||||
import {GridLayout, ItemSpec, GridUnitType} from "ui/layouts/grid-layout";
|
||||
import {Button} from "ui/button";
|
||||
import TKUnit = require("../TKUnit");
|
||||
import TKUnit = require("../../TKUnit");
|
||||
import view = require("ui/core/view");
|
||||
import builder = require("ui/builder");
|
||||
import enums = require("ui/enums");
|
||||
import testModule = require("../ui-test");
|
||||
import testModule = require("../../ui-test");
|
||||
import layoutHelper = require("./layout-helper");
|
||||
import platform = require("platform");
|
||||
import commonTests = require("./common-layout-tests");
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "grid-layout How-To"
|
||||
title: "How-To"
|
||||
title: "grid-layout"
|
||||
description: "Examples for using grid-layout"
|
||||
previous_url: /ApiReference/ui/layouts/grid-layout/HOW-TO
|
||||
---
|
||||
## GridLayout sample
|
||||
### Creating Grid Layout via code.
|
@ -3,7 +3,7 @@ import {StackLayout} from "ui/layouts/stack-layout";
|
||||
import {GridLayout} from "ui/layouts/grid-layout";
|
||||
|
||||
import utils = require("utils/utils");
|
||||
import TKUnit = require("../TKUnit");
|
||||
import TKUnit = require("../../TKUnit");
|
||||
import def = require("./layout-helper");
|
||||
|
||||
var DELTA = 0.1;
|
@ -2,7 +2,7 @@
|
||||
import {StackLayout} from "ui/layouts/stack-layout";
|
||||
import {GridLayout} from "ui/layouts/grid-layout";
|
||||
import utils = require("utils/utils");
|
||||
import TKUnit = require("../TKUnit");
|
||||
import TKUnit = require("../../TKUnit");
|
||||
import def = require("./layout-helper");
|
||||
|
||||
var DELTA = 0.1;
|
||||
@ -197,4 +197,4 @@ export function dp(value: number): number {
|
||||
|
||||
export function dip(value: number): number {
|
||||
return utils.layout.toDevicePixels(value);
|
||||
}
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
import {StackLayout} from "ui/layouts/stack-layout";
|
||||
import {Button} from "ui/button";
|
||||
import TKUnit = require("../TKUnit");
|
||||
import TKUnit = require("../../TKUnit");
|
||||
import helper = require("./layout-helper");
|
||||
import enums = require("ui/enums");
|
||||
import utils = require("utils/utils");
|
||||
import testModule = require("../ui-test");
|
||||
import testModule = require("../../ui-test");
|
||||
import layoutHelper = require("./layout-helper");
|
||||
import commonTests = require("./common-layout-tests");
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "stack-layout How-To"
|
||||
title: "How-To"
|
||||
title: "stack-layout"
|
||||
description: "Examples for using stack-layout"
|
||||
previous_url: /ApiReference/ui/layouts/stack-layout/HOW-TO
|
||||
---
|
||||
### import StackLayout and Button classes
|
||||
var StackLayout = require("ui/layouts/stack-layout").StackLayout;
|
@ -1,7 +1,7 @@
|
||||
import TKUnit = require("../TKUnit");
|
||||
import TKUnit = require("../../TKUnit");
|
||||
import {Label} from "ui/label";
|
||||
import layoutHelper = require("./layout-helper");
|
||||
import testModule = require("../ui-test");
|
||||
import testModule = require("../../ui-test");
|
||||
import commonTests = require("./common-layout-tests");
|
||||
|
||||
// >> wrap-layout-require
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "WrapLayout How-To"
|
||||
title: "How-To"
|
||||
title: "wrap-layout"
|
||||
description: "Examples for using WrapLayout"
|
||||
previous_url: /ApiReference/ui/layouts/wrap-layout/HOW-TO
|
||||
---
|
||||
# WrapLayout
|
||||
Using a WrapLayout requires the WrapLayout module.
|
@ -4,9 +4,9 @@ import viewModule = require("ui/core/view");
|
||||
import listPickerTestsNative = require("./list-picker-tests-native");
|
||||
import application = require("application");
|
||||
|
||||
// >> article-require-module
|
||||
// >> article-require-listpicker-module
|
||||
import listPickerModule = require("ui/list-picker");
|
||||
// << article-require-module
|
||||
// << article-require-listpicker-module
|
||||
|
||||
function _createListPicker(): listPickerModule.ListPicker {
|
||||
// >> article-create-listpicker
|
||||
@ -227,4 +227,4 @@ export var test_Android_WhenSelectedIndexChangesEditTextIsUpdatedProperly = func
|
||||
var actualValue = (<any>listPicker)._editText.getText().toString();
|
||||
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,12 @@
|
||||
---
|
||||
nav-title: "ListPicker How-To"
|
||||
title: "How-To"
|
||||
title: "list-picker"
|
||||
description: "Examples for using ListPicker"
|
||||
previous_url: /ApiReference/ui/list-picker/HOW-TO
|
||||
---
|
||||
# ListPicker
|
||||
Using a ListPicker requires the "ui/list-picker" module.
|
||||
<snippet id='article-require-module'/>
|
||||
<snippet id='article-require-listpicker-module'/>
|
||||
## Creating a ListPicker
|
||||
<snippet id='article-create-listpicker'/>
|
||||
## Binding listPicker.items
|
||||
|
@ -7,9 +7,9 @@ import platform = require("platform");
|
||||
import utils = require("utils/utils");
|
||||
import { Label } from "ui/label";
|
||||
|
||||
// >> article-require-module
|
||||
// >> article-require-listview-module
|
||||
import listViewModule = require("ui/list-view");
|
||||
// << article-require-module
|
||||
// << article-require-listview-module
|
||||
|
||||
// >> article-require-modules
|
||||
import observableArray = require("data/observable-array");
|
||||
|
@ -1,11 +1,12 @@
|
||||
---
|
||||
nav-title: "list-view How-To"
|
||||
title: "How-To"
|
||||
title: "list-view"
|
||||
description: "Examples for using list-view"
|
||||
previous_url: /ApiReference/ui/list-view/HOW-TO
|
||||
---
|
||||
# ListView
|
||||
Using a ListView requires the ListView module.
|
||||
<snippet id='article-require-module'/>
|
||||
<snippet id='article-require-listview-module'/>
|
||||
Other modules which will be used in the code samples in this article:
|
||||
<snippet id='article-require-modules'/>
|
||||
### Binding the ListView items property to collection in the view-model.
|
||||
|
@ -1,8 +1,8 @@
|
||||
// >> article-require-module
|
||||
// >> article-require-page-module
|
||||
import pageModule = require("ui/page");
|
||||
//// FrameModule is needed in order to have an option to navigate to the new page.
|
||||
import frameModule = require("ui/frame");
|
||||
// << article-require-module
|
||||
// << article-require-page-module
|
||||
|
||||
// >> article-set-bindingcontext
|
||||
function pageLoaded(args) {
|
||||
|
@ -1,11 +1,12 @@
|
||||
---
|
||||
nav-title: "Page How-To"
|
||||
title: "How-To"
|
||||
title: "page"
|
||||
description: "Examples for using Page"
|
||||
previous_url: /ApiReference/ui/page/HOW-TO
|
||||
---
|
||||
# Page
|
||||
Using a page requires the Page module.
|
||||
<snippet id='article-require-module'/>
|
||||
<snippet id='article-require-page/module'/>
|
||||
### Attaching event handler for the Page loaded event to set bindingContext.
|
||||
``` XML
|
||||
<Page loaded="pageLoaded">
|
||||
|
@ -6,9 +6,9 @@ import utils = require("utils/utils");
|
||||
import helper = require("../helper");
|
||||
import viewModule = require("ui/core/view");
|
||||
|
||||
// >> article-require-module
|
||||
// >> article-require-placeholder-module
|
||||
import placeholderModule = require("ui/placeholder");
|
||||
// << article-require-module
|
||||
// << article-require-placeholder-module
|
||||
|
||||
function creatingView(args) {
|
||||
var nativeView;
|
||||
|
@ -1,11 +1,12 @@
|
||||
---
|
||||
nav-title: "placeholder How-To"
|
||||
title: "How-To"
|
||||
title: "placeholder"
|
||||
description: "Examples for using placeholder"
|
||||
previous_url: /ApiReference/ui/placeholder/HOW-TO
|
||||
---
|
||||
# Placeholder
|
||||
Using the placeholder requires the Placeholder module.
|
||||
<snippet id='article-require-module'/>
|
||||
<snippet id='article-require-placeholder-module'/>
|
||||
Creating native view for the Placeholder using creatingView event.
|
||||
``` XML
|
||||
<Page>
|
||||
|
@ -5,9 +5,9 @@ import observable = require("data/observable");
|
||||
import color = require("color");
|
||||
import platform = require("platform");
|
||||
|
||||
// >> article-require-module
|
||||
// >> article-require-progress-module
|
||||
import progressModule = require("ui/progress");
|
||||
// << article-require-module
|
||||
// << article-require-progress-module
|
||||
|
||||
export function test_default_TNS_values() {
|
||||
// >> article-create-progress-view
|
||||
|
@ -1,11 +1,12 @@
|
||||
---
|
||||
nav-title: "progress How-To"
|
||||
title: "How-To"
|
||||
title: "progress"
|
||||
description: "Examples for using progress"
|
||||
previous_url: /ApiReference/ui/progress/HOW-TO
|
||||
---
|
||||
# Progress
|
||||
Using the progress view requires the Progress module.
|
||||
<snippet id='article-require-module'/>
|
||||
<snippet id='article-require-progress-module'/>
|
||||
Binding the Progress value property to a view-model property.
|
||||
``` XML
|
||||
<Page loaded="pageLoaded">
|
||||
|
@ -10,9 +10,9 @@ import pageModule = require("ui/page");
|
||||
import gestureModule = require("ui/gestures");
|
||||
import { Label } from "ui/label";
|
||||
|
||||
// >> article-require-module
|
||||
// >> article-require-repeater-module
|
||||
import repeaterModule = require("ui/repeater");
|
||||
// << article-require-module
|
||||
// << article-require-repeater-module
|
||||
|
||||
// >> article-require-modules
|
||||
import observableArray = require("data/observable-array");
|
||||
|
@ -1,11 +1,12 @@
|
||||
---
|
||||
nav-title: "repeater How-To"
|
||||
title: "How-To"
|
||||
title: "repeater"
|
||||
description: "Examples for using repeater"
|
||||
previous_url: /ApiReference/ui/repeater/HOW-TO
|
||||
---
|
||||
# Repeater
|
||||
Using a Repeater requires the repeater module.
|
||||
<snippet id='article-require-module'/>
|
||||
<snippet id='article-require-repeater-module'/>
|
||||
Other modules which will be used in the code samples in this article:
|
||||
<snippet id='article-require-modules'/>
|
||||
### Binding the Repeater items property to collection in the view-model.
|
||||
|
@ -3,13 +3,13 @@ import app = require("application");
|
||||
import button = require("ui/button");
|
||||
import enums = require("ui/enums");
|
||||
import testModule = require("../../ui-test");
|
||||
import layoutHelper = require("../../layouts/layout-helper");
|
||||
import layoutHelper = require("../layouts/layout-helper");
|
||||
import {Page} from "ui/page";
|
||||
import * as frame from "ui/frame";
|
||||
|
||||
// >> article-require-module
|
||||
// >> article-require-scrollview-module
|
||||
import scrollViewModule = require("ui/scroll-view");
|
||||
// << article-require-module
|
||||
// << article-require-scrollview-module
|
||||
|
||||
class ScrollLayoutTest extends testModule.UITest<scrollViewModule.ScrollView> {
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
---
|
||||
nav-title: "scroll-view How-To"
|
||||
title: "How-To"
|
||||
title: "scroll-view"
|
||||
description: "Examples for using scroll-view"
|
||||
previous_url: /ApiReference/ui/scroll-view/HOW-TO
|
||||
---
|
||||
# ScrollView
|
||||
Using a ScrollView requires the ScrollView module.
|
||||
<snippet id='article-require-module'/>
|
||||
<snippet id='article-require-scrollview-module'/>
|
||||
### Declaring the ScrollView.
|
||||
``` XML
|
||||
<Page>
|
||||
|
@ -4,9 +4,9 @@ import viewModule = require("ui/core/view");
|
||||
import searchBarTestsNative = require("./search-bar-tests-native");
|
||||
import colorModule = require("color");
|
||||
import observable = require("data/observable");
|
||||
// >> article-require-module
|
||||
// >> article-require-searchbar-module
|
||||
import searchBarModule = require("ui/search-bar");
|
||||
// << article-require-module
|
||||
// << article-require-searchbar-module
|
||||
|
||||
// ### Declaring a SearchBar.
|
||||
//``` XML
|
||||
|
@ -1,11 +1,12 @@
|
||||
---
|
||||
nav-title: "search-bar How-To"
|
||||
title: "How-To"
|
||||
title: "search-bar"
|
||||
description: "Examples for using search-bar"
|
||||
previous_url: /ApiReference/ui/search-bar/HOW-TO
|
||||
---
|
||||
# SearchBar
|
||||
Using the SearchBar requires the "ui/search-bar" module.
|
||||
<snippet id='article-require-module'/>
|
||||
<snippet id='article-require-searchbar-module'/>
|
||||
### Creating a SearchBar
|
||||
<snippet id='article-creating-searchbar'/>
|
||||
### Searching
|
||||
|
@ -6,9 +6,9 @@ import bindable = require("ui/core/bindable");
|
||||
import observable = require("data/observable");
|
||||
import color = require("color");
|
||||
|
||||
// >> article-require-module
|
||||
// >> article-require-segmentedbar-module
|
||||
import segmentedBarModule = require("ui/segmented-bar");
|
||||
// << article-require-module
|
||||
// << article-require-segmentedbar-module
|
||||
|
||||
function _createSegmentedBar(): segmentedBarModule.SegmentedBar {
|
||||
// >> article-create-segmentedbar
|
||||
|
@ -1,11 +1,12 @@
|
||||
---
|
||||
nav-title: "SegmentedBar How-To"
|
||||
title: "How-To"
|
||||
title: "segmented-bar"
|
||||
description: "Examples for using SegmentedBar"
|
||||
previous_url: /ApiReference/ui/segmented-bar/HOW-TO
|
||||
---
|
||||
# SegmentedBar
|
||||
Using a SegmentedBar requires the "ui/segmented-bar" module.
|
||||
<snippet id='article-require-module'/>
|
||||
<snippet id='article-require-segmentedbar-module'/>
|
||||
## Creating a SegmentedBar
|
||||
<snippet id='article-create-segmentedbar'/>
|
||||
``` XML
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "slider How-To"
|
||||
title: "How-To"
|
||||
title: "slider"
|
||||
description: "Examples for using slider"
|
||||
previous_url: /ApiReference/ui/slider/HOW-TO
|
||||
---
|
||||
# Slider
|
||||
Using a slider requires the Slider module.
|
||||
|
@ -683,7 +683,7 @@ export function test_CSS_isAppliedOnPage_From_Import() {
|
||||
|
||||
helper.buildUIAndRunTest(testButton, function (views: Array<viewModule.View>) {
|
||||
var page: pageModule.Page = <pageModule.Page>views[1];
|
||||
page.css = "@import url('~/ui/style/test.css');";
|
||||
page.css = "@import url('~/ui/styling/test.css');";
|
||||
helper.assertViewBackgroundColor(page, "#FF0000");
|
||||
});
|
||||
}
|
||||
@ -694,7 +694,7 @@ export function test_CSS_isAppliedOnPage_From_Import_Without_Url() {
|
||||
|
||||
helper.buildUIAndRunTest(testButton, function (views: Array<viewModule.View>) {
|
||||
var page: pageModule.Page = <pageModule.Page>views[1];
|
||||
page.css = "@import '~/ui/style/test.css';";
|
||||
page.css = "@import '~/ui/styling/test.css';";
|
||||
helper.assertViewBackgroundColor(page, "#FF0000");
|
||||
});
|
||||
}
|
||||
@ -705,7 +705,7 @@ export function test_CSS_isAppliedOnPage_From_addCssFile() {
|
||||
|
||||
helper.buildUIAndRunTest(testButton, function (views: Array<viewModule.View>) {
|
||||
var page: pageModule.Page = <pageModule.Page>views[1];
|
||||
page.addCssFile("~/ui/style/test.css");
|
||||
page.addCssFile("~/ui/styling/test.css");
|
||||
helper.assertViewBackgroundColor(page, "#FF0000");
|
||||
});
|
||||
}
|
||||
@ -1400,6 +1400,32 @@ export function test_alone_attr_selector() {
|
||||
}
|
||||
helper.buildUIAndRunTest(testButton, testFunc, testCss);
|
||||
}
|
||||
|
||||
export function test_UsingSameSelectors_ShouldApplyLatest() {
|
||||
let testButton = new buttonModule.Button();
|
||||
testButton.className = 'green';
|
||||
|
||||
let testCss = ".green { background-color: #FF0000; } .green { background-color: #00FF00; }";
|
||||
|
||||
let testFunc = function (views: Array<viewModule.View>) {
|
||||
// style from correct type css should be applied
|
||||
helper.assertViewBackgroundColor(testButton, "#00FF00");
|
||||
}
|
||||
helper.buildUIAndRunTest(testButton, testFunc, testCss);
|
||||
}
|
||||
|
||||
export function test_UsingSameSelectorsWithSpecific_ShouldApplyLatest() {
|
||||
let testButton = new buttonModule.Button();
|
||||
testButton.className = 'red green';
|
||||
|
||||
let testCss = ".red { background-color: #FF0000; } Button.green { background-color: #00FF00; }";
|
||||
|
||||
let testFunc = function (views: Array<viewModule.View>) {
|
||||
// style from correct type css should be applied
|
||||
helper.assertViewBackgroundColor(testButton, "#00FF00");
|
||||
}
|
||||
helper.buildUIAndRunTest(testButton, testFunc, testCss);
|
||||
}
|
||||
// <snippet module="ui/styling" title="styling">
|
||||
// For information and example how to use style properties please refer to special [**Styling**](../../../styling.md) topic.
|
||||
// </snippet>
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "styling How-To"
|
||||
title: "How-To"
|
||||
title: "styling"
|
||||
description: "Examples for using styling"
|
||||
previous_url: ApiReference/ui/styling/HOW-TO
|
||||
---
|
||||
# Styling
|
||||
### Setting CSS to a page
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "switch How-To"
|
||||
title: "How-To"
|
||||
title: "switch"
|
||||
description: "Examples for using switch"
|
||||
previous_url: /ApiReference/ui/switch/HOW-TO
|
||||
---
|
||||
# Switch
|
||||
Using a switch requires the Switch module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "TabView How-To"
|
||||
title: "How-To"
|
||||
title: "tab-view"
|
||||
description: "Examples for using TabView"
|
||||
previous_url: /ApiReference/ui/tab-view/HOW-TO
|
||||
---
|
||||
# TabView
|
||||
### Declaring the TabView in xml.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "TextField How-To"
|
||||
title: "How-To"
|
||||
title: "text-field"
|
||||
description: "Examples for using TextField"
|
||||
previous_url: /ApiReference/ui/text-field/HOW-TO
|
||||
---
|
||||
# TextField
|
||||
Using a TextField requires the text-field module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "TextView How-To"
|
||||
title: "How-To"
|
||||
title: "text-view"
|
||||
description: "Examples for using TextView"
|
||||
previous_url: /ApiReference/ui/text-view/HOW-TO
|
||||
---
|
||||
# TextView
|
||||
Using a TextView requires the text-view module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "TimePicker How-To"
|
||||
title: "How-To"
|
||||
title: "time-picker"
|
||||
description: "Examples for using TimePicker"
|
||||
previous_url: /ApiReference/ui/time-picker/HOW-TO
|
||||
---
|
||||
# TimePicker
|
||||
Using a TimePicker requires the "ui/time-picker" module.
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "WebView How-To"
|
||||
title: "How-To"
|
||||
title: "web-view"
|
||||
description: "Examples for using WebView"
|
||||
previous_url: /ApiReference/ui/web-view/HOW-TO
|
||||
---
|
||||
# WebView
|
||||
Using a WebView requires the web-view module.
|
||||
@ -15,4 +16,4 @@ Using a WebView requires the web-view module.
|
||||
### Using WebView
|
||||
<snippet id='webview-localfile'/>
|
||||
### Using WebView
|
||||
<snippet id='webview-string'/>
|
||||
<snippet id='webview-string'/>
|
||||
|
@ -1,7 +1,8 @@
|
||||
---
|
||||
nav-title: "xml How-To"
|
||||
title: "How-To"
|
||||
title: "xml"
|
||||
description: "Examples for using xml"
|
||||
previous_url: /ApiReference/xml/HOW-TO
|
||||
---
|
||||
# Xml module
|
||||
Using xml requires the Xml module.
|
||||
|
28
gruntfile.js
28
gruntfile.js
@ -429,7 +429,7 @@ module.exports = function(grunt) {
|
||||
mochaNode: {
|
||||
cmd: "grunt simplemocha:node"
|
||||
},
|
||||
injectArticles: {
|
||||
injectArticleSnippets: {
|
||||
cmd: "node node_modules/markdown-snippet-injector/index.js --root=<%= localCfg.srcAppsTests %> --docsroot=<%= localCfg.outArticlesDir %>"
|
||||
}
|
||||
},
|
||||
@ -663,6 +663,29 @@ module.exports = function(grunt) {
|
||||
grunt.registerTask("distribute-ts-apps-files", [
|
||||
"copy:readyTsAppFiles"
|
||||
]);
|
||||
grunt.registerTask("herdArticles", function() {
|
||||
var moveSinglesUp = function(dir) {
|
||||
var objs = fs.readdirSync(dir);
|
||||
for (var i=0; i<objs.length; i++) {
|
||||
var obj = objs[i];
|
||||
var fullPath = pathModule.join(dir, obj);
|
||||
if (objs.length == 1) {
|
||||
var parentDir = pathModule.dirname(dir);
|
||||
var newPath = pathModule.join(parentDir, obj);
|
||||
fs.renameSync(fullPath, newPath);
|
||||
fs.rmdirSync(dir);
|
||||
} else {
|
||||
var objStat = fs.statSync(fullPath);
|
||||
if (objStat.isDirectory()) {
|
||||
moveSinglesUp(fullPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
moveSinglesUp(localCfg.outArticlesDir);
|
||||
});
|
||||
|
||||
grunt.registerTask("generate-tns-core-modules-dev-dts", generateModulesDts.bind(null, "."));
|
||||
grunt.registerTask("generate-tns-core-modules-dts", generateModulesDts.bind(null, localCfg.outModulesDir));
|
||||
//aliasing pack-modules for backwards compatibility
|
||||
@ -735,7 +758,8 @@ module.exports = function(grunt) {
|
||||
grunt.registerTask("articles", [
|
||||
"clean:articles",
|
||||
"copy:articleMDs",
|
||||
"exec:injectArticles"
|
||||
"exec:injectArticleSnippets",
|
||||
"herdArticles"
|
||||
]);
|
||||
|
||||
grunt.registerTask("docs", [
|
||||
|
@ -169,26 +169,26 @@
|
||||
"apps/tests/file-system-access-tests/file-system-access-tests.ts",
|
||||
"apps/tests/file-system-tests.ts",
|
||||
"apps/tests/fps-meter-tests.ts",
|
||||
"apps/tests/frame-tests.ts",
|
||||
"apps/tests/gestures-tests.ts",
|
||||
"apps/tests/ui/frame/frame-tests.ts",
|
||||
"apps/tests/ui/gestures/gestures-tests.ts",
|
||||
"apps/tests/http-tests.ts",
|
||||
"apps/tests/image-source-tests.ts",
|
||||
"apps/tests/layouts/absolute-layout-tests.ts",
|
||||
"apps/tests/layouts/common-layout-tests.ts",
|
||||
"apps/tests/layouts/dock-layout-tests.ts",
|
||||
"apps/tests/layouts/grid-layout-tests.ts",
|
||||
"apps/tests/layouts/layout-helper.android.ts",
|
||||
"apps/tests/layouts/layout-helper.d.ts",
|
||||
"apps/tests/layouts/layout-helper.ios.ts",
|
||||
"apps/tests/layouts/stack-layout-tests.ts",
|
||||
"apps/tests/layouts/wrap-layout-tests.ts",
|
||||
"apps/tests/ui/layouts/absolute-layout-tests.ts",
|
||||
"apps/tests/ui/layouts/common-layout-tests.ts",
|
||||
"apps/tests/ui/layouts/dock-layout-tests.ts",
|
||||
"apps/tests/ui/layouts/grid-layout-tests.ts",
|
||||
"apps/tests/ui/layouts/layout-helper.android.ts",
|
||||
"apps/tests/ui/layouts/layout-helper.d.ts",
|
||||
"apps/tests/ui/layouts/layout-helper.ios.ts",
|
||||
"apps/tests/ui/layouts/stack-layout-tests.ts",
|
||||
"apps/tests/ui/layouts/wrap-layout-tests.ts",
|
||||
"apps/tests/location-tests.ts",
|
||||
"apps/tests/navigation/custom-transition.android.ts",
|
||||
"apps/tests/navigation/custom-transition.ios.ts",
|
||||
"apps/tests/navigation/navigation-tests.ts",
|
||||
"apps/tests/navigation/transition-tests.ts",
|
||||
"apps/tests/observable-array-tests.ts",
|
||||
"apps/tests/observable-tests.ts",
|
||||
"apps/tests/data/observable-array-tests.ts",
|
||||
"apps/tests/data/observable-tests.ts",
|
||||
"apps/tests/pages/app.ts",
|
||||
"apps/tests/pages/background-test.ts",
|
||||
"apps/tests/pages/file-load-test.ts",
|
||||
@ -286,10 +286,10 @@
|
||||
"apps/tests/ui/segmented-bar/segmented-bar-tests-native.ios.ts",
|
||||
"apps/tests/ui/segmented-bar/segmented-bar-tests.ts",
|
||||
"apps/tests/ui/slider/slider-tests.ts",
|
||||
"apps/tests/ui/style/style-properties-tests.ts",
|
||||
"apps/tests/ui/style/style-tests.ts",
|
||||
"apps/tests/ui/style/value-source-tests.ts",
|
||||
"apps/tests/ui/style/visual-state-tests.ts",
|
||||
"apps/tests/ui/styling/style-properties-tests.ts",
|
||||
"apps/tests/ui/styling/style-tests.ts",
|
||||
"apps/tests/ui/styling/value-source-tests.ts",
|
||||
"apps/tests/ui/styling/visual-state-tests.ts",
|
||||
"apps/tests/ui/switch/switch-tests.ts",
|
||||
"apps/tests/ui/tab-view/tab-view-navigation-tests.ts",
|
||||
"apps/tests/ui/tab-view/tab-view-tests-native.android.ts",
|
||||
@ -321,7 +321,7 @@
|
||||
"apps/tests/ui/view/view-tests.d.ts",
|
||||
"apps/tests/ui/view/view-tests.ios.ts",
|
||||
"apps/tests/ui/web-view/web-view-tests.ts",
|
||||
"apps/tests/virtual-array-tests.ts",
|
||||
"apps/tests/data/virtual-array-tests.ts",
|
||||
"apps/tests/weak-event-listener-tests.ts",
|
||||
"apps/tests/xhr-tests.ts",
|
||||
"apps/tests/xml-declaration/app.ts",
|
||||
@ -583,7 +583,9 @@
|
||||
"ui/layouts/grid-layout/grid-layout.d.ts",
|
||||
"ui/layouts/grid-layout/grid-layout.ios.ts",
|
||||
"ui/layouts/layout-base.d.ts",
|
||||
"ui/layouts/layout-base.ts",
|
||||
"ui/layouts/layout-base-common.ts",
|
||||
"ui/layouts/layout-base.android.ts",
|
||||
"ui/layouts/layout-base.ios.ts",
|
||||
"ui/layouts/layout.android.ts",
|
||||
"ui/layouts/layout.d.ts",
|
||||
"ui/layouts/layout.ios.ts",
|
||||
|
@ -330,7 +330,7 @@ export class Binding {
|
||||
}
|
||||
|
||||
let updateExpression = this.prepareExpressionForUpdate();
|
||||
this.prepareContextForExpression(changedModel, updateExpression);
|
||||
this.prepareContextForExpression(changedModel, updateExpression, undefined);
|
||||
|
||||
let expressionValue = this._getExpressionValue(updateExpression, true, changedModel);
|
||||
if (expressionValue instanceof Error) {
|
||||
@ -357,7 +357,7 @@ export class Binding {
|
||||
}
|
||||
}
|
||||
|
||||
this.prepareContextForExpression(context, expression);
|
||||
this.prepareContextForExpression(context, expression, addedProps);
|
||||
model[contextKey] = context;
|
||||
let result = exp.getValue(model, isBackConvert, changedModel ? changedModel : model);
|
||||
// clear added props
|
||||
@ -443,17 +443,20 @@ export class Binding {
|
||||
}
|
||||
}
|
||||
|
||||
private prepareContextForExpression(model: Object, expression: string) {
|
||||
private prepareContextForExpression(model: Object, expression: string, newProps: Array<string>) {
|
||||
let parentViewAndIndex: { view: viewModule.View, index: number };
|
||||
let parentView;
|
||||
let addedProps = newProps || [];
|
||||
if (expression.indexOf(bc.bindingValueKey) > -1) {
|
||||
model[bc.bindingValueKey] = model;
|
||||
addedProps.push(bc.bindingValueKey);
|
||||
}
|
||||
|
||||
if (expression.indexOf(bc.parentValueKey) > -1) {
|
||||
parentView = this.getParentView(this.target.get(), bc.parentValueKey).view;
|
||||
if (parentView) {
|
||||
model[bc.parentValueKey] = parentView.bindingContext;
|
||||
addedProps.push(bc.parentValueKey);
|
||||
}
|
||||
}
|
||||
|
||||
@ -464,6 +467,7 @@ export class Binding {
|
||||
if (parentViewAndIndex.view) {
|
||||
model[bc.parentsValueKey] = model[bc.parentsValueKey] || {};
|
||||
model[bc.parentsValueKey][parentViewAndIndex.index] = parentViewAndIndex.view.bindingContext;
|
||||
addedProps.push(bc.parentsValueKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,16 +2,26 @@
|
||||
import types = require("utils/types");
|
||||
import view = require("ui/core/view");
|
||||
import dependencyObservable = require("ui/core/dependency-observable");
|
||||
import proxy = require("ui/core/proxy");
|
||||
import utils = require("utils/utils");
|
||||
import style = require("ui/styling/style");
|
||||
import * as platformModule from "platform";
|
||||
var platform: typeof platformModule;
|
||||
import {PropertyChangeData, Property } from "ui/core/dependency-observable";
|
||||
import {PropertyMetadata } from "ui/core/proxy";
|
||||
|
||||
var clipToBoundsProperty = new Property(
|
||||
"clipToBounds",
|
||||
"LayoutBase",
|
||||
new PropertyMetadata(true, dependencyObservable.PropertyMetadataSettings.None));
|
||||
|
||||
function onClipToBoundsPropertyChanged(data: PropertyChangeData) {
|
||||
var layout = <LayoutBase>data.object;
|
||||
layout._onClipToBoundsChanged(data.oldValue, data.newValue);
|
||||
}
|
||||
|
||||
(<PropertyMetadata>clipToBoundsProperty.metadata).onSetNativeValue = onClipToBoundsPropertyChanged;
|
||||
|
||||
export class LayoutBase extends view.CustomLayoutView implements definition.LayoutBase, view.AddChildFromBuilder {
|
||||
|
||||
public static clipToBoundsProperty = new dependencyObservable.Property("clipToBounds", "LayoutBase",
|
||||
new proxy.PropertyMetadata(true, dependencyObservable.PropertyMetadataSettings.None, LayoutBase.onClipToBoundsPropertyChanged, null, LayoutBase.onClipToBoundsPropertyChanged));
|
||||
public static clipToBoundsProperty = clipToBoundsProperty;
|
||||
|
||||
private _subViews: Array<view.View> = new Array<view.View>();
|
||||
|
||||
@ -120,21 +130,8 @@ export class LayoutBase extends view.CustomLayoutView implements definition.Layo
|
||||
this._setValue(LayoutBase.clipToBoundsProperty, value);
|
||||
}
|
||||
|
||||
protected onClipToBoundsChanged(oldValue: boolean, newValue: boolean) {
|
||||
if (!this._nativeView) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!platform) {
|
||||
platform = require("platform");
|
||||
}
|
||||
|
||||
if (platform.device.os === platform.platformNames.ios) {
|
||||
this._nativeView.clipsToBounds = newValue;
|
||||
}
|
||||
else if (platform.device.os === platform.platformNames.android) {
|
||||
this._nativeView.setClipChildren(newValue);
|
||||
}
|
||||
public _onClipToBoundsChanged(oldValue: boolean, newValue: boolean) {
|
||||
//
|
||||
}
|
||||
|
||||
public _childIndexToNativeChildIndex(index?: number): number {
|
||||
@ -182,11 +179,6 @@ export class LayoutBase extends view.CustomLayoutView implements definition.Layo
|
||||
|
||||
}
|
||||
|
||||
private static onClipToBoundsPropertyChanged(data: dependencyObservable.PropertyChangeData): void {
|
||||
var layout = <LayoutBase>data.object;
|
||||
layout.onClipToBoundsChanged(data.oldValue, data.newValue);
|
||||
}
|
||||
|
||||
protected static adjustChildrenLayoutParams(layoutBase: LayoutBase, widthMeasureSpec: number, heightMeasureSpec: number): void {
|
||||
let availableWidth = utils.layout.getMeasureSpecSize(widthMeasureSpec);
|
||||
let widthSpec = utils.layout.getMeasureSpecMode(widthMeasureSpec);
|
||||
@ -255,3 +247,4 @@ export class LayoutBase extends view.CustomLayoutView implements definition.Layo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
16
ui/layouts/layout-base.android.ts
Normal file
16
ui/layouts/layout-base.android.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import common = require("./layout-base-common");
|
||||
|
||||
export class LayoutBase extends common.LayoutBase {
|
||||
public _onClipToBoundsChanged(oldValue: boolean, newValue: boolean) {
|
||||
// We can't implement this without calling setClipChildren(false) on every ancestor up in the visual tree,
|
||||
// which will kill performance. It will also lead to unwanted side effects such as other totally unrelated
|
||||
// views being affected by setting the parents' setClipChildren to false.
|
||||
// The problem in Android is that a ViewGroup either clips ALL of its children or it does not. Unlike iOS, the clipping
|
||||
// cannot be controlled on a per view basis. So clipToBounds=false will have to be somehow achieved with stacking different
|
||||
// views on top of one another in an AbsoluteLayout or GridLayout. There is always a workaround when playing with layouts.
|
||||
//
|
||||
// The following article explains this in detail:
|
||||
// http://stackoverflow.com/questions/25044085/when-drawing-outside-the-view-clip-bounds-with-android-how-do-i-prevent-underli
|
||||
console.warn(`clipToBounds with value false is not supported on Android. You can use this.android.getParent().setClipChildren(false) as an alternative`);
|
||||
}
|
||||
}
|
9
ui/layouts/layout-base.ios.ts
Normal file
9
ui/layouts/layout-base.ios.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import common = require("./layout-base-common");
|
||||
|
||||
export class LayoutBase extends common.LayoutBase {
|
||||
public _onClipToBoundsChanged(oldValue: boolean, newValue: boolean) {
|
||||
if (this._nativeView) {
|
||||
this._nativeView.clipsToBounds = newValue;
|
||||
}
|
||||
}
|
||||
}
|
@ -143,7 +143,12 @@ export class CssSelector {
|
||||
|
||||
class CssTypeSelector extends CssSelector {
|
||||
get specificity(): number {
|
||||
return TYPE_SPECIFICITY;
|
||||
let result = TYPE_SPECIFICITY;
|
||||
let dotIndex = this.expression.indexOf(DOT);
|
||||
if (dotIndex > -1) {
|
||||
result += CLASS_SPECIFICITY;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public matches(view: view.View): boolean {
|
||||
let result = matchesType(this.expression, view);
|
||||
|
@ -105,6 +105,13 @@ export class WebView extends common.WebView {
|
||||
this._android.setWebViewClient(this._webViewClient);
|
||||
}
|
||||
|
||||
public _onDetached(force?: boolean) {
|
||||
if (this.android) {
|
||||
this.android.destroy();
|
||||
}
|
||||
super._onDetached(force);
|
||||
}
|
||||
|
||||
public _loadUrl(url: string) {
|
||||
if (!this._android) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user