-
Notifications
You must be signed in to change notification settings - Fork 9
loadFixture doesn't work in Chrome when use file:///... URL. #1
Comments
I don't suppose you could post the test you're using? That would be helpful. |
Tried to reproduce using small sample (test.js)
fixture.html content
Used URL file:///C:/home/projects/jasmine-dom-test/runner.html with for default jasmine test runner. Files runner.hml, test.js, feature.html are located in the same directory. The test pass only in Safary and FF but in Chrome and IE8 it fails with error like that
As i now understand it shouldn't work in any browser because jasmine-dom uses XHR to get a fixture so a web server is must... In fact, even in Safary and FF adding check, if the fixture has been loaded, broke the test:
So loadFixtures doesn't load html into DOM, just not throws an exception in these browsers... looks a bit inconsistent... Obvious work around - use web server, but sometimes it would be very convenient just click on runner.html and get test results. I'm not sure but loading markup using iframe should work with such file://... URLs. |
Thanks for digging into that. I'll see what I can do. I know I use XHR with file URLs all the time, so there must be more to it. |
Chrome has a bug that prevents XHR from loading anything when loaded from a file URL. Based on the discussions on the ticket, this is unlikely to change any time soon. However, I believe I've fixed this for the other browsers. I've tested this now for Firefox and Safari on my Mac and it worked fine. Please let me know if you have trouble with IE. In Firefox, the XHR was never calling the onreadystatechange callback, because the request was synchronous. |
It should be noted that, according to the previously-linked discussion, this should work if you launch Chrome with the You might want to add this information to the README. |
Updated README. |
The test contains only loadFixtures() call.
It works fine in Firefox but throws the following error in Chrome:
I opened test runner using file:// URL
file:///.../runner.html
If it's possible, it would be great to have ability to run tests without web server in all browsers.
The text was updated successfully, but these errors were encountered: