本文整理汇总了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");
}