Added automation text and tests

This commit is contained in:
Hristo Hristov
2016-01-19 16:22:41 +02:00
parent 699a0be83f
commit af78e79561
7 changed files with 74 additions and 90 deletions

View File

@@ -705,4 +705,9 @@ export var testBackgroundImage = function () {
page.css = ".myClass { background-image: url('~/logo.png') }";
TKUnit.assertEqual(definition.checkNativeBackgroundImage(lbl), true, "Style background-image not loaded correctly.");
});
}
export function test_automation_text_default_value() {
let view = new button.Button();
TKUnit.assertTrue(view.automationText === undefined, "AutomationText default value should be UNDEFINED.");
}

View File

@@ -195,6 +195,17 @@ export var test_cachedProperties_Applied_WhenNativeWidged_IsCreated = function (
helper.do_PageTest_WithStackLayout_AndButton(test);
}
export function test_automation_text_set_to_native() {
var test = function (views: Array<view.View>) {
var newButton = new button.Button();
newButton.automationText = "Button1";
(<stack.StackLayout>views[1]).addChild(newButton);
TKUnit.assertEqual((<android.widget.Button>newButton.android).getContentDescription(), "Button1", "contentDescription not set to native view.");
}
helper.do_PageTest_WithStackLayout_AndButton(test);
}
export var test_event_onContextChanged_IsNotRaised_WhenAttachedToSameContext = function () {
var test = function (views: Array<view.View>) {
var listener = new Listener("_onContextChanged");

View File

@@ -6,6 +6,7 @@ import color = require("color");
import helper = require("../helper");
import page = require("ui/page");
import TKUnit = require("../../TKUnit");
import button = require("ui/button");
global.moduleMerge(commonTests, exports);
@@ -85,3 +86,9 @@ export function testBackgroundInternalChangedOnceOnResize() {
helper.goBack();
}
}
export function test_automation_text_set_to_native() {
var newButton = new button.Button();
newButton.automationText = "Button1";
TKUnit.assertEqual((<UIView>newButton.ios).accessibilityIdentifier, "Button1", "accessibilityIdentifier not set to native view.");
}