dimanche 29 octobre 2017

How do you use fixtures in jasmine-jquery

Running into an issue with using jasmine-jquery to test my jquery.

enter image description here

enter image description here

I've verified I have jasmine, jquery and jasmine-jquery. Here is my scripts from my example.html file.

<script src="http://ift.tt/2uTh1V7"></script>
<script type="text/javascript" src="jasmine/lib/jasmine-2.8.0/jasmine.js"></script>
<script type="text/javascript" src="jasmine/lib/jasmine-2.8.0/jasmine-html.js"></script>
<script type="text/javascript" src="jasmine/lib/jasmine-2.8.0/boot.js"></script>
<script type='text/javascript' src='jasmine/lib/jasmine-2.8.0/jasmine-jquery.js'></script>

Here is my specfile:

describe("testing fixtures", function(){


it("tests three crucial functions", function(){
    expect(readFixtures).toBeDefined();
    expect(setFixtures).toBeDefined();
    expect(loadFixtures).toBeDefined();
  })
})

describe("testing example.html", function(){
  var fixture;
  beforeEach(function(){
    loadFixtures('example.html');
    fixture = $('#testExample');
    fixture.testExample();
  })

  it('punchcard should be defined', function(){
    expect(fixture).toBeDefined();
  })

});

I was trying to test the fixtures before using them in my specfile but it seems they are really not defined. But according to my scripts jasmine-jquery is there so those methods should be usable. Not sure what is going on or if there is something simple I am missing. Any insight would be greatly appreciated.

Thanks for looking!

Aucun commentaire:

Enregistrer un commentaire