本文整理匯總了TypeScript中tns-core-modules/ui/button.Button.ensureDomNode方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Button.ensureDomNode方法的具體用法?TypeScript Button.ensureDomNode怎麽用?TypeScript Button.ensureDomNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類tns-core-modules/ui/button.Button
的用法示例。
在下文中一共展示了Button.ensureDomNode方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test_property_is_reported_in_dom_node
export function test_property_is_reported_in_dom_node() {
const btn = new Button();
btn.text = "test_value";
btn.ensureDomNode();
const domNode = btn.domNode;
assertAttribute(domNode, "text", "test_value");
}
示例2: test_custom_attribute_is_reported_in_dom_node
export function test_custom_attribute_is_reported_in_dom_node() {
const btn = new Button();
btn["test_prop"] = "test_value";
btn.ensureDomNode();
const domNode = btn.domNode;
assertAttribute(domNode, "test_prop", "test_value");
}
示例3: test_falsy_property_is_reported_in_dom_node
export function test_falsy_property_is_reported_in_dom_node() {
const btn = new Button();
btn.text = null;
btn.ensureDomNode();
const domNode = btn.domNode;
assertAttribute(domNode, "text", "null");
btn.text = undefined;
domNode.loadAttributes();
assertAttribute(domNode, "text", "undefined");
}
示例4: test_custom__falsy_attribute_is_reported_in_dom_node
export function test_custom__falsy_attribute_is_reported_in_dom_node() {
const btn = new Button();
btn["test_prop_null"] = null;
btn["test_prop_0"] = 0;
btn["test_prop_undefined"] = undefined;
btn["test_prop_empty_string"] = "";
btn.ensureDomNode();
const domNode = btn.domNode;
assertAttribute(domNode, "test_prop_null", null + "");
assertAttribute(domNode, "test_prop_0", 0 + "");
assertAttribute(domNode, "test_prop_undefined", undefined + "");
assertAttribute(domNode, "test_prop_empty_string", "");
}
示例5: test_property_reset_calls_attributeRemoved
export function test_property_reset_calls_attributeRemoved() {
const btn = new Button();
btn.text = "some value";
btn.ensureDomNode();
const domNode = btn.domNode;
let callbackCalled = false;
currentInspector.attributeRemoved = (nodeId: number, attrName: string) => {
assertEqual(nodeId, domNode.nodeId, "nodeId");
assertEqual(attrName, "text", "attrName");
callbackCalled = true;
}
btn.text = unsetValue;
assert(callbackCalled, "attributeRemoved not called");
}