我有一个功能,依赖于
Research.prototype._getLink = function(target, docLink) {
if ($(target).hasClass("some class")) {
return docLink;
} else {
return $(target).attr("href");
}
}

我在这里调用函数:
var linkToGo = self._getLink(e.target, "docLink1");

我不知道如何为它编写qunit测试。 我写了这个并且卡住了:
QUnit.test('Get link', function (assert) {
// target which has class 'some class'
var target1 =
// target which doesn't has class 'some class'
var target2 =
assert.equel(self._getLink(target1, "docLink1"), "docLink1");
assert.equel(self._getLink(target2, "docLink1"), "docLink2");
})