-
-
Save mxriverlynn/1288292 to your computer and use it in GitHub Desktop.
hacking jasmine-jquery setFixtures
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addFixture(html){ | |
var fixtures = jasmine.getFixtures(); | |
if (!fixtures.fixtureList){ | |
fixtures.fixtureList = []; | |
} | |
fixtures.fixtureList.push(html); | |
fixtures.set(fixtures.fixtureList.join()); | |
} | |
function clearMyFixtures(){ | |
delete jasmine.getFixtures().fixtureList; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe("something", function(){ | |
beforeEach(fucntion(){ | |
addFixture("<div id='something'></div>"); | |
addFixture("<ul></ul>"); | |
}); | |
afterEach(function(){ | |
clearMyFixtures(); | |
}); | |
it("does that thing", function{ | |
// ... your test that uses a fixture, here | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment