jasmine-jquery fixtures not loading

蹲街弑〆低调 提交于 2019-12-23 18:19:29

问题


Problem is that jasmine-jquery in not loading my fixtures from spec/fixtures folder. Now when I look at jasmine-jquery source code default path for fixtures is spec/javascripts/fixtures. In a version that I have, there is no spec/javascripts/fixtures folder. It seems it is something for Ruby gem. I also tried to create that javascripts folder but still it can't load it. When I place my fixture fragment inside of SpecRunner.html body - it works.

Here is my html fragment:

<ul class="fr">
    <li></li>
</ul>

Spec file:

describe("something to describe", function() {

    it("should see a DOM element", function() {
        loadFixtures("custom.html");
        expect($(".fr")).toExist();
    });
});

Is that a bug or something with the path ?

Solved: It is a problem with google-chrome. By default it doesn't allow access to other domain by same origin policy. Solution is to run app from local server, or to use firefox.


回答1:


It indeed has to do with Chrome. This is a security concept called Same-Origin Policy.

Instead of running Firefox or the app from local server, you can still use Chrome with that security check disabled.

Just run Chrome/Chromium with the command-line argument --allow-file-access-from-files:

google-chrome --allow-file-access-from-files

Remember! Since this is a security feature, by disabling it you are putting your computer at risk. It is recommended to only use this parameter when testing local websites/apps (via a different shortcut/alias).



来源:https://stackoverflow.com/questions/15589560/jasmine-jquery-fixtures-not-loading

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!