2013-03-30 22:55:37 +00:00
|
|
|
(function(context, $) {
|
|
|
|
|
|
|
|
|
|
context.JKTestUtils = {
|
|
|
|
|
loadFixtures: function(path) {
|
2013-05-20 01:54:24 +00:00
|
|
|
//path = 'file:///home/jonathon/dev/jamkazam/jam-web' + path;
|
|
|
|
|
//path = 'http://localhost:9876' + path;
|
|
|
|
|
var needTestFixtures = ($('#test-fixtures').length === 0);
|
|
|
|
|
if (needTestFixtures) {
|
|
|
|
|
$('body').append('<div id="test-fixtures"></div>');
|
|
|
|
|
}
|
2013-03-30 22:55:37 +00:00
|
|
|
$.ajax({
|
|
|
|
|
url:path,
|
|
|
|
|
async: false,
|
|
|
|
|
success: function(r) {
|
2013-05-20 01:54:24 +00:00
|
|
|
$('#test-fixtures').append(r);
|
2013-03-30 22:55:37 +00:00
|
|
|
},
|
|
|
|
|
error: function(jqXHR, textStatus, errorThrown) {
|
|
|
|
|
// Assumes we're in a jasmine context
|
2013-05-20 01:54:24 +00:00
|
|
|
throw 'loadFixtures error: ' + path + ': ' + errorThrown;
|
2013-03-30 22:55:37 +00:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
removeFixtures: function() {
|
|
|
|
|
$('#test-fixtures').remove();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
})(window, jQuery);
|