Skip to content

Commit 6ef8655

Browse files
authored
Merge pull request #337 from jakerella/v2.4.0
Update to v2.4.0
2 parents c85c003 + 44c6bad commit 6ef8655

7 files changed

+32
-12
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 2018-06-17 v2.4.0
2+
* Added support for an array of status codes in mocked response (thanks @reinrl)
3+
* Updated broken Codacy badge
4+
* Added jQuery 3.3.1 to test suite
5+
* Switched to using Chrome headless (with puppeteer) for all tests
6+
* No longer testing in Opera, and added Edge to the browser test list
7+
18
## 2018-01-07 v2.3.0
29
* Added new `handlers()` method
310
* Add basic support for 301 and 302 status codes with auto-redirection

Gruntfile.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

2-
const testRunner = require('./qunit-puppeteer.js');
2+
/* jshint ignore:start */
3+
var testRunner = require('./qunit-puppeteer.js');
4+
/* jshint ignore:end */
35

46
module.exports = function(grunt) {
57
'use strict';
@@ -172,7 +174,9 @@ module.exports = function(grunt) {
172174
grunt.registerTask('build', ['dev', 'concat', 'uglify', 'test:dist']);
173175
grunt.registerTask('default', ['dev']);
174176

177+
/* jshint ignore:start */
175178
grunt.registerTask('test', 'Executes QUnit tests with all supported jQuery versions', async function() {
179+
/* jshint ignore:end */
176180
var done = this.async();
177181

178182
var i, l,
@@ -201,15 +205,19 @@ module.exports = function(grunt) {
201205
}
202206

203207
console.log(versionUrls);
204-
for (let i=0; i<versionUrls.length; ++i) {
205-
console.log('LOADING', versionUrls[i]);
208+
for (i=0; i<versionUrls.length; ++i) {
206209
try {
210+
console.log('LOADING', versionUrls[i]);
211+
/* jshint ignore:start */
207212
await testRunner(versionUrls[i], PORT);
213+
/* jshint ignore:end */
208214
} catch(err) {
209215
return done(err);
210216
}
211217
}
212218
done();
219+
/* jshint ignore:start */
213220
});
221+
/* jshint ignore:end */
214222

215223
};

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,10 +765,10 @@ We use virtual machines to test current versions of the browsers below. In addit
765765
we test the specific versions of IE specified.
766766

767767
* Internet Explorer 8-11
768+
* Edge
768769
* Firefox
769770
* Safari
770771
* Chrome
771-
* Opera
772772

773773
_Please note that while we strive to keep `master` as bug free as possible, we do
774774
not necessarily run tests in all of the above browsers for every single commit. We

dist/jquery.mockjax.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*! jQuery Mockjax
22
* A Plugin providing simple and flexible mocking of ajax requests and responses
33
*
4-
* Version: 2.3.0
4+
* Version: 2.4.0
55
* Home: https://github.com/jakerella/jquery-mockjax
66
* Copyright (c) 2018 Jordan Kasper, formerly appendTo;
77
* NOTE: This repository was taken over by Jordan Kasper (@jakerella) October, 2014
@@ -286,9 +286,14 @@
286286
} else {
287287
this.responseText = mockHandler.responseText;
288288
}
289-
if( typeof mockHandler.status === 'number' || typeof mockHandler.status === 'string' ) {
289+
290+
if ($.isArray(mockHandler.status)) {
291+
var idxStatus = Math.floor(Math.random() * mockHandler.status.length);
292+
this.status = mockHandler.status[idxStatus];
293+
} else if (typeof mockHandler.status === 'number' || typeof mockHandler.status === 'string') {
290294
this.status = mockHandler.status;
291295
}
296+
292297
if( typeof mockHandler.statusText === 'string') {
293298
this.statusText = mockHandler.statusText;
294299
}

dist/jquery.mockjax.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "jquery-mockjax",
33
"title": "jQuery Mockjax",
4-
"version": "2.3.0",
4+
"version": "2.4.0",
55
"main": "./src/jquery.mockjax.js",
66
"description": "The jQuery Mockjax Plugin provides a simple and extremely flexible interface for mocking or simulating ajax requests and responses.",
77
"url": "https://github.com/jakerella/jquery-mockjax",

src/jquery.mockjax.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,14 @@
275275
} else {
276276
this.responseText = mockHandler.responseText;
277277
}
278-
278+
279279
if ($.isArray(mockHandler.status)) {
280-
var idxStatus = Math.floor(Math.random() * mockHandler.status.length)
281-
this.status = mockHandler.status[idxStatus];
280+
var idxStatus = Math.floor(Math.random() * mockHandler.status.length);
281+
this.status = mockHandler.status[idxStatus];
282282
} else if (typeof mockHandler.status === 'number' || typeof mockHandler.status === 'string') {
283283
this.status = mockHandler.status;
284284
}
285-
285+
286286
if( typeof mockHandler.statusText === 'string') {
287287
this.statusText = mockHandler.statusText;
288288
}

0 commit comments

Comments
 (0)