Skip to content

Commit

Permalink
Tools: Fixed Karma Ajax modifications.
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin19 authored and TorsteinHonsi committed Jul 7, 2021
1 parent 506668f commit 7a1a36f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/karma-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Highcharts.defaultOptionsRaw = JSON.stringify(Highcharts.defaultOptions);
Highcharts.callbacksRaw = Highcharts.Chart.prototype.callbacks.slice(0);

// Override Highcharts and jQuery ajax functions to load from local
Highcharts.wrap(Highcharts, 'ajax', function (proceed, attr) {
function ajax(proceed, attr) {
var success = attr.success;
attr.error = function (e) {
throw new Error('Failed to load: ' + attr.url);
Expand All @@ -142,7 +142,9 @@ Highcharts.wrap(Highcharts, 'ajax', function (proceed, attr) {
};
return proceed.call(this, attr);
}
});
}
Highcharts.wrap(Highcharts.HttpUtilities, 'ajax', ajax);
Highcharts.wrap(Highcharts, 'ajax', ajax);
if (window.$) {
$.getJSON = function (url, callback) { // eslint-disable-line no-undef
callback(window.JSONSources[url]);
Expand Down

0 comments on commit 7a1a36f

Please sign in to comment.