我在Visual Studio 2017中遇到了Chutzpah的问题。我在浏览器(Firefox,Edge&amp; Chrome)中成功运行了jQuery代码,但在使用Chutzpah在VS中运行时失败了。< / p>
首先我的设置:
我的测试用Jasmin编写,扩展名为Jasmin-jQuery。
var progressbarHTML = '<a id="progressbarCaption"></a>' +
'<div id="progressContainer">' +
'<div id="progressArea">' +
'<div id="progressbar">' +
'<div id="progresslabel" class="progress-label">' +
'</div></div></div></div>';
describe("CSS Classes are loaded?", function() {
beforeEach(function() {
var html = '<div id="controlAddIn">' + progressbarHTML + '</div>';
setFixtures(html);
environment = {"Platform" : 0};
InitializeControl();
});
it("Is CSS for progressbarCaption set", function() {
expect($("#progressbarCaption")).toHaveClass("progressbarCaptionWidowsClient");
});
it("Is CSS for progressContainer set", function() {
expect($("#progressContainer")).toHaveClass("progressContainerWindowsClient");
});
it("Is CSS for progresslabel set", function() {
expect($("#progresslabel")).toHaveCss({'top': "1px"});
});
});
当我在浏览器中运行测试时,我得到了
这完全没问题。但是当我在VS中运行测试时,右键单击HTML文件并“运行JS测试”。我得到了
Test 'CSS Classes are loaded?:Is CSS for progresslabel set' failed
Expected ({ 0: HTMLNode, length: 1 }) to have css Object({ top: '1px' }).
buildExpectationResult@file:///C:/Temp/Progressbar/DEV%20DE%20CU00%2013682%20BL%203151/Control%20Add-Ins%20JS/ProgressBar/Progressbar/Resource/Tests/lib/jasmine-2.5.2/jasmine.js:1610:19
expectationResultFactory@file:///C:/Temp/Progressbar/DEV%20DE%20CU00%2013682%20BL%203151/Control%20Add-Ins%20JS/ProgressBar/Progressbar/Resource/Tests/lib/jasmine-2.5.2/jasmine.js:655:40
addExpectationResult@file:///C:/Temp/Progressbar/DEV%20DE%20CU00%2013682%20BL%203151/Control%20Add-Ins%20JS/ProgressBar/Progressbar/Resource/Tests/lib/jasmine-2.5.2/jasmine.js:342:58
addExpectationResult@file:///C:/Temp/Progressbar/DEV%20DE%20CU00%2013682%20BL%203151/Control%20Add-Ins%20JS/ProgressBar/Progressbar/Resource/Tests/lib/jasmine-2.5.2/jasmine.js:599:41
file:///C:/Temp/Progressbar/DEV%20DE%20CU00%2013682%20BL%203151/Control%20Add-Ins%20JS/ProgressBar/Progressbar/Resource/Tests/lib/jasmine-2.5.2/jasmine.js:1564:32
in C:\Temp\Progressbar\DEV DE CU00 13682 BL 3151\Control Add-Ins JS\ProgressBar\Progressbar\Resource\Tests\SpecRunner.html (line 0)
突然间,最后一次测试失败,我不明白为什么。