Ok, got it. JsTestDriver adds a βtestβ to the path to your fixtures.
In addition, jasmine-jquery gets attributes using ajax.
So these steps finally helped me:
In jsTestDriver.conf:
serve: - trunk/wwwroot/fixtures/*.html load: - trunk/wwwroot/js/libs/jquery-1.7.1.min.js - jstd/jasmine/standalone-1.2.0/lib/jasmine-1.2.0/jasmine.js - jstd/jasmine-jstd-adapter/src/JasmineAdapter.js - jstd/jasmine-jquery/lib/jasmine-jquery.js - trunk/wwwroot/js/main.js test: - trunk/wwwroot/js/main.test.js
In my test file:
describe("main", function(){ beforeEach(function(){ jasmine.getFixtures().fixturesPath = '/test/trunk/wwwroot/fixtures'; jasmine.getFixtures().load('main.html'); }); describe("when main.js is loaded", function(){ it('should have a div', function(){ expect($('div').length).toBe(1); }); }); });
Note that the beforeEach() call uses an absolute URL for the HTML device.
source share