mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Added automation text and tests
This commit is contained in:
@@ -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.");
|
||||
}
|
||||
@@ -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");
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
Reference in New Issue
Block a user