【发布时间】:2016-08-20 08:10:15
【问题描述】:
当我通过 grunt-contrib-jasmine 运行这个 Jasmine 规范时,我收到错误 TypeError: Attempted to assign to readonly property. 指向我设置 selectedIndex 属性的行:
it('does something', function () {
setFixtures('<select id="selectId"><option>Text</option></select>');
var selectDOM = document.getElementById('selectId');
selectDOM.selectedIndex = 0;
// stripped some code here...
});
有人知道我在这里缺少什么吗? 我使用 phantomjs v1.9.8、grunt-cli v0.1.13 和 grunt-contrib-jasmine v0.9.2。
【问题讨论】:
-
在这个例子中我没有打错字,所以这个例子可以正常运行。如果您似乎有同样的问题,请阅读下面的答案。
标签: javascript jasmine grunt-contrib-jasmine