diff --git a/CrossPlatformModules.csproj b/CrossPlatformModules.csproj
index 89b37e2b2..d4cfc8abb 100644
--- a/CrossPlatformModules.csproj
+++ b/CrossPlatformModules.csproj
@@ -140,6 +140,8 @@
bindingContext_testPage.xml
+
+
time-picker-tests-native.d.ts
@@ -597,6 +599,8 @@
+
+
diff --git a/apps/tests/ui/bindable-tests.ts b/apps/tests/ui/bindable-tests.ts
index 09276a554..51ce2c5b9 100644
--- a/apps/tests/ui/bindable-tests.ts
+++ b/apps/tests/ui/bindable-tests.ts
@@ -11,6 +11,7 @@ import pageModule = require("ui/page");
import stackLayoutModule = require("ui/layouts/stack-layout");
import bindingBuilder = require("ui/builder/binding-builder");
import labelModule = require("ui/label");
+import textFieldModule = require("ui/text-field");
//
// For information and examples how to use bindings please refer to special [**Data binding**](../../../../bindings.md) topic.
@@ -472,5 +473,21 @@ export var test_TwoElementsBindingToSameBindingContext = function () {
TKUnit.assertEqual(upperStackLabel.text, label2.text);
}
- helper.navigateToModuleAndRunTest("./tests/ui/bindingContext_testPage", testFunc);
+ helper.navigateToModuleAndRunTest("./tests/ui/bindingContext_testPage", null, testFunc);
+}
+
+export var test_BindingContext_NavigatingForwardAndBack = function () {
+ var expectedValue = "Tralala";
+ var testFunc = function (page: pageModule.Page) {
+ var innerTestFunc = function (childPage: pageModule.Page) {
+ var testTextField: textFieldModule.TextField = (childPage.getViewById("testTextField"));
+ testTextField.text = expectedValue;
+ };
+
+ helper.navigateToModuleAndRunTest("./tests/ui/bindingContext_testPage2", page.bindingContext, innerTestFunc);
+ var testLabel: labelModule.Label = (page.getViewById("testLabel"));
+ TKUnit.assertEqual(testLabel.text, expectedValue);
+ }
+
+ helper.navigateToModuleAndRunTest("./tests/ui/bindingContext_testPage1", null, testFunc);
}
\ No newline at end of file
diff --git a/apps/tests/ui/bindingContext_testPage1.ts b/apps/tests/ui/bindingContext_testPage1.ts
new file mode 100644
index 000000000..670eac633
--- /dev/null
+++ b/apps/tests/ui/bindingContext_testPage1.ts
@@ -0,0 +1,15 @@
+import observable = require("data/observable");
+import pageModule = require("ui/page");
+
+function loadViewModel() {
+ viewModel.set("testProperty", "Alabala");
+}
+
+var viewModel = new observable.Observable();
+
+loadViewModel();
+
+export function pageLoaded(args: observable.EventData) {
+ var page = args.object;
+ page.bindingContext = viewModel;
+}
\ No newline at end of file
diff --git a/apps/tests/ui/bindingContext_testPage1.xml b/apps/tests/ui/bindingContext_testPage1.xml
new file mode 100644
index 000000000..0327a08bb
--- /dev/null
+++ b/apps/tests/ui/bindingContext_testPage1.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/apps/tests/ui/bindingContext_testPage2.ts b/apps/tests/ui/bindingContext_testPage2.ts
new file mode 100644
index 000000000..91c4cafd2
--- /dev/null
+++ b/apps/tests/ui/bindingContext_testPage2.ts
@@ -0,0 +1,6 @@
+import pageModule = require("ui/page");
+
+export function pageNavigatedTo(args: pageModule.NavigatedData) {
+ var page = args.object;
+ page.bindingContext = args.context;
+}
\ No newline at end of file
diff --git a/apps/tests/ui/bindingContext_testPage2.xml b/apps/tests/ui/bindingContext_testPage2.xml
new file mode 100644
index 000000000..c60d58270
--- /dev/null
+++ b/apps/tests/ui/bindingContext_testPage2.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/apps/tests/ui/helper.ts b/apps/tests/ui/helper.ts
index 33288f30f..04cff1d1b 100644
--- a/apps/tests/ui/helper.ts
+++ b/apps/tests/ui/helper.ts
@@ -143,8 +143,8 @@ export function buildUIAndRunTest(controlToTest, testFunction, pageCss?) {
}
}
-export function navigateToModuleAndRunTest(moduleName, testFunction) {
- navigateToModule(moduleName);
+export function navigateToModuleAndRunTest(moduleName, context, testFunction) {
+ navigateToModule(moduleName, context);
try {
testFunction(frame.topmost().currentPage);
}
@@ -201,9 +201,9 @@ export function navigate(pageFactory: () => page.Page) {
TKUnit.waitUntilReady(() => { return frame.topmost().currentPage !== currentPage; });
}
-export function navigateToModule(moduleName: string) {
+export function navigateToModule(moduleName: string, context?: any) {
var currentPage = frame.topmost().currentPage;
- frame.topmost().navigate({ moduleName: moduleName, animated: false });
+ frame.topmost().navigate({ moduleName: moduleName, context: context, animated: false });
TKUnit.waitUntilReady(() => { return frame.topmost().currentPage !== currentPage; });
TKUnit.assert(frame.topmost().currentPage.isLoaded, "Current page should be loaded!");
}