{"id":2428,"date":"2013-02-04T10:34:10","date_gmt":"2013-02-04T15:34:10","guid":{"rendered":"http:\/\/blogs.terrorware.com\/geoff\/?p=2428"},"modified":"2013-02-04T10:34:10","modified_gmt":"2013-02-04T15:34:10","slug":"running-jasmine-tests-with-jasmine-jquery-html-fixtures-in-google-chrome","status":"publish","type":"post","link":"https:\/\/blogs.terrorware.com\/geoff\/2013\/02\/04\/running-jasmine-tests-with-jasmine-jquery-html-fixtures-in-google-chrome\/","title":{"rendered":"Running jasmine tests with jasmine-jquery HTML fixtures in Google Chrome"},"content":{"rendered":"<p>I use Jasmine to test the Backbone code for the software behind Floodlight. My Handlebars templates for the Backbone views are in a separate file, included by the Django templates, which allows me to use the same templates when testing the Backbone views. To load the Handlebars templates for the Jasmine tests, I use the <a title=\"jasmine-jquery\" href=\"https:\/\/github.com\/velesin\/jasmine-jquery\">jasmine-jquery<\/a> library.<\/p>\n<p>This was working fine for me in Firefox, but I found that the tests were failing in Chrome.<\/p>\n<p>It seems that the reason for this is that Chrome, by default, prevents JavaScript from loading local files. You can override this by starting Chrome with the <code>--allow-file-access-from-files<\/code> switch. This is the command that I run from my shell in Ubuntu:<\/p>\n<blockquote><p><code>google-chrome --allow-file-access-from-file<\/code><\/p><\/blockquote>\n<p>Here is the <a href=\"https:\/\/github.com\/velesin\/jasmine-jquery\/issues\/4\">issue<\/a> that describes this behavior and where I found the workaround. I found it through <a href=\"http:\/\/agilewarrior.wordpress.com\/2011\/08\/26\/chrome-not-loading-jasmine-fixtures\/\">this blog post<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I use Jasmine to test the Backbone code for the software behind Floodlight. My Handlebars templates for the Backbone views are in a separate file, included by the Django templates, which allows me to use the same templates when testing the Backbone views. To load the Handlebars templates for the Jasmine tests, I use the&hellip; <a class=\"more-link\" href=\"https:\/\/blogs.terrorware.com\/geoff\/2013\/02\/04\/running-jasmine-tests-with-jasmine-jquery-html-fixtures-in-google-chrome\/\">Continue reading <span class=\"screen-reader-text\">Running jasmine tests with jasmine-jquery HTML fixtures in Google Chrome<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-2428","post","type-post","status-publish","format-standard","hentry","category-uncategorized","entry"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4wnIz-Da","_links":{"self":[{"href":"https:\/\/blogs.terrorware.com\/geoff\/wp-json\/wp\/v2\/posts\/2428","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.terrorware.com\/geoff\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.terrorware.com\/geoff\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.terrorware.com\/geoff\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.terrorware.com\/geoff\/wp-json\/wp\/v2\/comments?post=2428"}],"version-history":[{"count":2,"href":"https:\/\/blogs.terrorware.com\/geoff\/wp-json\/wp\/v2\/posts\/2428\/revisions"}],"predecessor-version":[{"id":2430,"href":"https:\/\/blogs.terrorware.com\/geoff\/wp-json\/wp\/v2\/posts\/2428\/revisions\/2430"}],"wp:attachment":[{"href":"https:\/\/blogs.terrorware.com\/geoff\/wp-json\/wp\/v2\/media?parent=2428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.terrorware.com\/geoff\/wp-json\/wp\/v2\/categories?post=2428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.terrorware.com\/geoff\/wp-json\/wp\/v2\/tags?post=2428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}