我需要在 Backbone 的 event-hash
中应用“特殊”函数调用,其中相同的事件监听器在 Backbone View 中触发两个独立的方法。但是,当检查此 View 的代码覆盖率时,这个特定的代码片段未经测试。
我正在使用 mocha
、chai
和 sinonjs
。
我想知道是否有人知道如何测试这个特殊情况?
events: {
"focus #new-comment": function (e) {
this.revealButtons(e);
this._cancelZoom(e);
},
}
最佳答案
这有帮助吗?
events: {
"focus #new-comment": "_onFocusNewComment",
},
_onFocusNewComment: function (e) {
this.revealButtons(e);
this._cancelZoom(e);
}
关于javascript - 测试 Backbone 事件哈希,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29351597/