Comments (6)
I don't suppose you could post the test you're using? That would be helpful.
from jasmine-dom.
Tried to reproduce using small sample (test.js)
describe('jasmine-dom', function(){
it('should load the fixture without errors', function() {
loadFixtures('fixture.html');
});
});
fixture.html content
<div id="testdiv">123</div>
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
NETWORK_ERR: NETWORK_ERR: XMLHttpRequest Exception 101
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:
it('should load the fixture without errors', function() {
loadFixtures('fixture.html');
var div = document.getElementById('testdiv');
expect(div).toHaveId('testdiv');
});
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.
from jasmine-dom.
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.
from jasmine-dom.
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.
from jasmine-dom.
It should be noted that, according to the previously-linked discussion, this should work if you launch Chrome with the --allow-file-access-from-files
flag.
You might want to add this information to the README.
from jasmine-dom.
Updated README.
from jasmine-dom.
Related Issues (7)
- Using jasmine-dom with Karma
- toBeHidden() and toBeVisible() should check CSS visibility HOT 1
- loadFixtures does not wait for async call HOT 5
- exception throw when using jasmine-maven-plugin HOT 1
- fixtures: document.body is undefined when using Jasmine 1.2 HOT 2
- Array.prototype.indexOf not supported on IE8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jasmine-dom.