本文介绍了未定义Jasmine-jQuery loadFixtures的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对整个茉莉花还是很陌生,在过去的几个小时里,我陷入了这个问题.我试图使用loadFixture()加载外部灯具文件.我使用Jasmine 2.0.0和Jasmine-jQuery 2.0.5.

I'm still new to the whole jasmine things and in past few hours I stuck in this problem.I tried to load an external fixture file using loadFixture().I use Jasmine 2.0.0 and Jasmine-jQuery 2.0.5.

ReferenceError: loadFixtures is not defined
  at Suite.<anonymous> (--appname--/app/assets/Tester/spec/ChannelSpec.js:5:6)
  at Env.describe (--appname--/app/assets/Tester/lib/jasmine-2.0.0/jasmine.js:613:25)
  at jasmineInterface.describe (--appname--/app/assets/Tester/lib/jasmine-2.0.0/boot.js:37:18)
  at Suite.<anonymous>  (--appname--/app/assets/Tester/spec/ChannelSpec.js:2:3)
  at Env.describe (--appname--/app/assets/Tester/lib/jasmine-2.0.0/jasmine.js:613:25)
  at jasmineInterface.describe (--appname--/app/assets/Tester/lib/jasmine-2.0.0/boot.js:37:18)
  at --appname--/app/assets/Tester/spec/ChannelSpec.js:1:1

在Chromium控制台中

while in Chromium console

Uncaught TypeError: Cannot set property 'spiedEventsKey' of undefined

这是ChannelSpec.js中的行

this is the line in ChannelSpec.js

1. describe('Channel', function() {
2.  describe('Test Restriction', function() {
3.     var $httpBackend,service;
4.     // jasmine.getFixtures().proxyCallTo_('load', 'fixtures.html')
5.     loadFixtures('fixtures.html');

我在Ubuntu 14.04上工作,主要使用Chromium,但是我在Firefox上进行了尝试,因为有人暗示它是同源政策" ,但产生了类似的错误.

I work on Ubuntu 14.04 and primarily use Chromium but I tried on Firefox as some people suggested that it's Same-Origin Policy, but it produced similar error.

---已解决---

可以通过最后加载jasmine-jquery来解决

It's solved by loading jasmine-jquery last

<script type="text/javascript" src="lib/jasmine-2.0.0/jasmine.js"></script>
<script type="text/javascript" src="lib/jasmine-2.0.0/jasmine-html.js"></script>
<script type="text/javascript" src="lib/jasmine-2.0.0/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="lib/jasmine-2.0.0/boot.js"></script>
<script type="text/javascript" src="lib/jasmine-2.0.0/jasmine-jquery.js"></script>

推荐答案

在加载Jasmine-jQuery库之前,请确保先加载Jasmine.

Make sure that you are loading Jasmine before you load the Jasmine-jQuery library.

这篇关于未定义Jasmine-jQuery loadFixtures的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 09:45