jquery-mockjax
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -0,1 +1,7 @@ | ||
## 2016-09-15 v2.2.1 | ||
* Add tests for jQuery 3.x | ||
* Add tests for Browserify usage and documentation on that subject | ||
* Updated dependencies for webpack, etc usage (thanks @hotoo) | ||
* Updated keywords to be picked up by jQuery plugin registry | ||
## 2016-06-08 v2.2.0 | ||
@@ -2,0 +8,0 @@ * Fix bower dependency on jQuery to allow any supported version |
/*! jQuery Mockjax | ||
* A Plugin providing simple and flexible mocking of ajax requests and responses | ||
* | ||
* Version: 2.2.0 | ||
* Version: 2.2.1 | ||
* Home: https://github.com/jakerella/jquery-mockjax | ||
@@ -6,0 +6,0 @@ * Copyright (c) 2016 Jordan Kasper, formerly appendTo; |
/*! jQuery Mockjax | ||
* A Plugin providing simple and flexible mocking of ajax requests and responses | ||
* | ||
* Version: 2.2.0 | ||
* Version: 2.2.1 | ||
* Home: https://github.com/jakerella/jquery-mockjax | ||
@@ -6,0 +6,0 @@ * Copyright (c) 2016 Jordan Kasper, formerly appendTo; |
@@ -47,11 +47,11 @@ module.exports = function(grunt) { | ||
}, | ||
all: { | ||
src: [ | ||
'./src/**/*.js', | ||
'./Gruntfile.js', | ||
'test/test.js', | ||
'test/requirejs/*.js', | ||
'test/nodejs/*.js' | ||
] | ||
} | ||
all: [ | ||
'src/**/*.js', | ||
'Gruntfile.js', | ||
'test/test.js', | ||
'test/requirejs/*.js', | ||
'test/nodejs/*.js', | ||
'test/browserify/main.js', | ||
'test/browserify/test.js' | ||
] | ||
}, | ||
@@ -72,3 +72,5 @@ qunit: { all: [] }, // NOTE: these tests are all run by the `test` task below to run against each jQuery version supported | ||
'2.1.4', | ||
'2.2.4' | ||
'2.2.4', | ||
'3.0.0', | ||
'3.1.0' | ||
] | ||
@@ -86,3 +88,5 @@ }, | ||
'2.1.4', | ||
'2.2.4' | ||
'2.2.4', | ||
'3.0.0', | ||
'3.1.0' | ||
] | ||
@@ -93,3 +97,4 @@ }, | ||
'1.12.4', | ||
'2.2.4' | ||
'2.2.4', | ||
'3.1.0' | ||
] | ||
@@ -102,3 +107,3 @@ }, | ||
'2.1.4', | ||
'2.2.4' | ||
'3.1.0' | ||
] | ||
@@ -122,5 +127,11 @@ }, | ||
'2.1.4', | ||
'2.2.4' | ||
'2.2.4', | ||
'3.0.0', | ||
'3.1.0' | ||
] | ||
} | ||
}, | ||
browserify: { | ||
file: 'browserify/index.html', | ||
jQueryVersions: ['not-applicable'] | ||
} | ||
}, | ||
@@ -132,2 +143,8 @@ mochaTest: { | ||
}, | ||
browserify: { | ||
test: { | ||
src: 'test/browserify/main.js', | ||
dest: 'test/browserify/bundle.js' | ||
} | ||
}, | ||
watch: { | ||
@@ -146,3 +163,3 @@ gruntfile: { | ||
grunt.registerTask('dev', ['jshint', 'test:all', 'test:requirejs', 'mochaTest']); | ||
grunt.registerTask('dev', ['jshint', 'test:all', 'test:requirejs', 'browserify', 'test:browserify', 'mochaTest']); | ||
grunt.registerTask('build', ['dev', 'concat', 'uglify', 'test:dist']); | ||
@@ -149,0 +166,0 @@ grunt.registerTask('default', ['dev']); |
{ | ||
"name": "jquery-mockjax", | ||
"title": "jQuery Mockjax", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"main": "./src/jquery.mockjax.js", | ||
@@ -16,3 +16,4 @@ "description": "The jQuery Mockjax Plugin provides a simple and extremely flexible interface for mocking or simulating ajax requests and responses.", | ||
"testing", | ||
"jquery-plugin" | ||
"jquery-plugin", | ||
"ecosystem:jquery" | ||
], | ||
@@ -53,8 +54,10 @@ "author": { | ||
"dependencies": { | ||
"jquery": "^2.1.3" | ||
"jquery": ">=1.5.2" | ||
}, | ||
"devDependencies": { | ||
"browserify": "^13.1.0", | ||
"grunt": "^0.4.5", | ||
"grunt-browserify": "^5.0.0", | ||
"grunt-contrib-concat": "^0.5.0", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"grunt-contrib-jshint": "^0.12.0", | ||
"grunt-contrib-qunit": "^0.5.2", | ||
@@ -61,0 +64,0 @@ "grunt-contrib-uglify": "^0.6.0", |
@@ -45,2 +45,3 @@ # jQuery Mockjax: Ajax request mocking # | ||
* [Browsers Tested](#browsers-tested) | ||
* [Using Mockjax in Other Ways (Node, require, browserify, etc)](#using-mockjax-in-other-ways) | ||
* [Logging](#logging) | ||
@@ -762,2 +763,33 @@ * [Release History](#release-history) | ||
### Using Mockjax in Other Ways ### | ||
You can use Mockjax as a Node module, with require.js, or with Browserify... and | ||
presumably in other ways as well. We have tests for each of the methods above. | ||
When using Mockjax as a Node module (including with Browserify), **you must | ||
provide the module with the jQuery library and a `window`**. Here is an example | ||
using a module intended for use as a "browserified" module: | ||
```js | ||
var jquery = require('jquery'); | ||
var mockjax = require('jquery.mockjax')(jquery, window); | ||
// Note that we expect `window` to be defined once this file is browserified and | ||
// used in a browser. If it isn't Mockjax will have a problem! | ||
mockjax({ | ||
url: '/resource', | ||
responseText: 'content' | ||
}); | ||
function getResource(cb) { | ||
jquery.ajax({ | ||
url: '/resource', | ||
success: cb, | ||
error: cb | ||
}); | ||
} | ||
``` | ||
### Logging ### | ||
@@ -764,0 +796,0 @@ |
@@ -1,5 +0,6 @@ | ||
(function() { | ||
"use strict"; | ||
var parts = document.location.search.slice( 1 ).split( "&" ), | ||
(function(QUnit, basePath) { | ||
'use strict'; | ||
var parts = document.location.search.slice( 1 ).split( '&' ), | ||
length = parts.length, | ||
@@ -12,8 +13,8 @@ i = 0, | ||
nextIndex = (currIndex && Number(currIndex[1]) || 0) + 1, // +1 because QUnit makes the h1 text a link | ||
version = "1.5.2", | ||
file = "http://code.jquery.com/jquery-git.js"; | ||
version = '1.5.2', | ||
file = 'http://code.jquery.com/jquery-git.js'; | ||
for ( ; i < length; i++ ) { | ||
current = parts[ i ].split( "=" ); | ||
if ( current[ 0 ] === "jquery" ) { | ||
current = parts[ i ].split( '=' ); | ||
if ( current[ 0 ] === 'jquery' ) { | ||
version = current[ 1 ]; | ||
@@ -24,8 +25,8 @@ break; | ||
if (version != "git") { | ||
file = "../lib/jquery-" + version + ".js"; | ||
if (version !== 'git') { | ||
file = basePath + 'lib/jquery-' + version + '.js'; | ||
} | ||
document.write( "<script id='jquery' src='" + file + "'></script>" ); | ||
document.write( '<script id=\'jquery\' src=\'' + file + '\'></script>' ); | ||
@@ -40,13 +41,13 @@ | ||
// Set up the "run all" button once jQuery is loaded | ||
document.getElementById("jquery").onload = function() { | ||
// Set up the 'run all' button once jQuery is loaded | ||
document.getElementById('jquery').onload = function() { | ||
$(document).ready(function() { | ||
// Sigh... QUnit "rebuilds" the header, so we have to wait for that before | ||
// Sigh... QUnit 'rebuilds' the header, so we have to wait for that before | ||
// attaching our click event, otherwise we lose the handler in the rebuild | ||
setTimeout(function() { | ||
var btn = $(".runall"); | ||
var btn = $('.runall'); | ||
if (currIndex) { | ||
// We're already in a run... | ||
btn.attr("disabled", "disabled"); | ||
btn.attr('disabled', 'disabled'); | ||
setupNextRedirect(); | ||
@@ -56,3 +57,3 @@ | ||
// Set up a new run... | ||
btn.removeAttr("disabled").click(function(e) { | ||
btn.removeAttr('disabled').click(function(e) { | ||
e.preventDefault(); | ||
@@ -68,6 +69,6 @@ setupNextRedirect(); | ||
var nextLink = null, | ||
nextLinkNode = $("#qunit-header a:eq(" + nextIndex + ")"); | ||
nextLinkNode = $('#qunit-header a:eq(' + nextIndex + ')'); | ||
if (nextLinkNode && nextLinkNode.length) { | ||
nextLink = nextLinkNode.attr("href") + "&v=" + nextIndex; | ||
nextLink = nextLinkNode.attr('href') + '&v=' + nextIndex; | ||
} | ||
@@ -98,2 +99,2 @@ return nextLink; | ||
})(); | ||
})(window.QUnit, window.testJQPath || '../'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4427686
64
123343
889
14
+ Addedjquery@3.7.1(transitive)
- Removedjquery@2.2.4(transitive)
Updatedjquery@>=1.5.2