2015-11-05 54 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!" }); }

相关问题