【发布时间】:2014-11-27 00:45:57
【问题描述】:
我无法使用 Jasmine 在单元测试中获取 html 元素值。
JavaScript 代码:
$scope.close = function () {
$scope.success = false;
$('#current, #new').val(''); // Need to test this
};
茉莉码:
it('close method', function() {
scope.close();
expect($('#current')).toContain(''); //unable to get the value ->return undefined
});
错误:
TypeError: 'undefined' 不是函数(评估 'haystack.indexOf(needle)')
请帮我解决这个问题。
【问题讨论】:
标签: javascript jquery jasmine jasmine-jquery