當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Button.ensureDomNode方法代碼示例

本文整理匯總了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");
}
開發者ID:sitefinitysteve,項目名稱:NativeScript,代碼行數:7,代碼來源:dom-node-tests.ts

示例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");
}
開發者ID:sitefinitysteve,項目名稱:NativeScript,代碼行數:7,代碼來源:dom-node-tests.ts

示例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");
}
開發者ID:sitefinitysteve,項目名稱:NativeScript,代碼行數:11,代碼來源:dom-node-tests.ts

示例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", "");
}
開發者ID:sitefinitysteve,項目名稱:NativeScript,代碼行數:14,代碼來源:dom-node-tests.ts

示例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");
}
開發者ID:sitefinitysteve,項目名稱:NativeScript,代碼行數:17,代碼來源:dom-node-tests.ts


注:本文中的tns-core-modules/ui/button.Button.ensureDomNode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。