Monday, January 16, 2012

crafting set up and tear down steps for Jasmine tests and overriding options when using jasmine-jquery widgets

Set up and tear down like so:

jasmine.getFixtures().fixturesPath = './';

describe("Sorter controlling table", function () {

   var widget = null;

   var filterForm = null;

   beforeEach(function () {

      loadFixtures('fixture1.html');

      var target = $('#listingTableWrapper');

      filterForm = $('#filterForm');

      widget = target.SorterWidget({ form: filterForm });

   });

   afterEach(function () {

      widget.SorterWidget('destroy');

   filterForm = null;v
   });

   describe("
whatever...

 
 

Note: SorterWidget has the following options meaning that line 9 above is overriding the default for one of the options:

options: {

   form: null,

   container: null,

   sortBy: 'Id',

   sortOrder: 'ASC'

}

No comments:

Post a Comment