2015-11-05 52 views

回答

1

經過一番調試,我發現在IconTabFilter工程中的圖標上觸發僞事件saptouchend

return this.waitFor({ 
    id: "mySecondTab-icon", 
    viewName: sViewName, 
    success: function (control) { 
     control.$().trigger("saptouchend"); 
    }, 
    errorMessage: "Second IconTabFilter not found in IconTabBar" 
}); 
0

我喜歡你的解決方案

通常我看QUnit試驗控制,並希望他們做了類似的事情

// Press SPACE key on second IconTabFilter to expand 
sap.ui.test.qunit.triggerKeydown(oControl.$(), jQuery.sap.KeyCodes.SPACE); 

UPDATE: 剛剛發現一個在TEST Tutorial解決方案 - 不知道我喜歡它,因爲它不模擬用戶交互

iPressOnTheTabWithTheKey: function (sKey) { 
    return this.waitFor({ 
     id: "iconTabBar", 
     viewName : sViewName, 
     success: function (oIconTabBar) { 
      oIconTabBar.setSelectedKey(sKey); 
     }, 
     errorMessage: "Cannot find the icon tab bar" 
    }); 

} 
0

一個簡單的方法可以做到這一點,我們可以使用id /圖標來選擇你想要的iconTab,然後添加一個動作,在你的情況下,這將是一個新聞。

iClickOnSecondIconTabBAr: function() { return this.waitFor({ controlType: "sap.m.IconTabFilter", matchers: new sap.ui.test.matchers.Properties({ icon: "sap-icon://inspection" }), actions: new Press(), errorMessage: "Did not find the IconTabBar Button!" }); }

相關問題