Skip to content

Commit

Permalink
Merge pull request #277 from jakerella/release-2.1.0
Browse files Browse the repository at this point in the history
Release 2.1.0
  • Loading branch information
jakerella committed Jan 23, 2016
2 parents 7c4dee0 + 0316134 commit f641a73
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sudo: false
language: node_js
node_js:
- "0.12"
- "4.2"
before_install: npm install -g grunt-cli
branches:
only:
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 2016-01-23
* Updated to version 2.1.0
* Removed unused testswarm files
* Added test step in build process for dist file
* Refactor tests to be easier to maintain and conform to current QUnit standards
* Added global URL namespace feature (thanks @danpaz)
* Added clearing of mocks by URL and regex (thanks @stas-vilchik)
* Use async setting for proxy data (thanks @udnisap)
* Update tests to jQuery 2.2.0 and fix for latest in jQuery git (thanks Simon and @gyoshev)
* Fixed #136: cross domain requests
* Updated contributing documentation to clearly state process for a release

## 2015-06-11
* Updated to version 2.0.1
* Fixed name in package.json for coordination among package management systems
Expand Down
17 changes: 17 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,20 @@ branch as well as `master` (if the bug exists in both).
You should also write a good PR message with information on why this feature or fix is
necesary or a good idea. For features, be sure to include information on _how to use_
the feature; and for bugs, information on how to reproduce the bug is helpful!

## Publishing a Release

Although individual contributors cannot publish a release, it's good to have
documentation on what goes into that in case anyone needs to take over the process.
Currently, @jakerella is the only one doing so.

1. Create a branch for the release (usually with the proposed version number in the name)
1. Ensure that all tests are passing in all supported browsers that you can (see below).
1. Update the `CHANGELOG.md`, `package.json` version, and any other necessary files.
(Note that these can be in a commit, but put them in that new branch.)
1. Make sure to generate fresh dist files if necessary and commit those.
1. Submit a PR for the branch, this will initiate the Travis CI checks.
1. Ask others for input on the PR (mostly testing in their own browsers).
1. *If all is well*, merge the branch into `master`
1. Create a release on Github with a tag matching the version number and proper info.
1. Run `npm publish` on `master` to push the new version up to npm.
20 changes: 16 additions & 4 deletions dist/jquery.mockjax.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* Version: 2.0.1
* Home: https://github.com/jakerella/jquery-mockjax
* Copyright (c) 2015 Jordan Kasper, formerly appendTo;
* Copyright (c) 2016 Jordan Kasper, formerly appendTo;
* NOTE: This repository was taken over by Jordan Kasper (@jakerella) October, 2014
*
* Dual licensed under the MIT or GPL licenses.
Expand Down Expand Up @@ -240,7 +240,7 @@
this.statusText = mockHandler.statusText;
}
// jQuery 2.0 renamed onreadystatechange to onload
onReady = this.onreadystatechange || this.onload;
onReady = this.onload || this.onreadystatechange;

// jQuery < 1.4 doesn't have onreadystate change for xhr
if ( $.isFunction( onReady ) ) {
Expand Down Expand Up @@ -280,6 +280,7 @@
url: mockHandler.proxy,
type: mockHandler.proxyType,
data: mockHandler.data,
async: requestSettings.async,
dataType: requestSettings.dataType === 'script' ? 'text/plain' : requestSettings.dataType,
complete: function(xhr) {
mockHandler.responseXML = xhr.responseXML;
Expand All @@ -291,7 +292,13 @@
if (isDefaultSetting(mockHandler, 'statusText')) {
mockHandler.statusText = xhr.statusText;
}
this.responseTimer = setTimeout(process, parseResponseTimeOpt(mockHandler.responseTime));

if ( requestSettings.async === false ) {
// TODO: Blocking delay
process();
} else {
this.responseTimer = setTimeout(process, parseResponseTimeOpt(mockHandler.responseTime));
}
}
});
} else {
Expand All @@ -303,6 +310,7 @@
this.responseTimer = setTimeout(process, parseResponseTimeOpt(mockHandler.responseTime));
}
}

}

// Construct a mocked XHR Object
Expand Down Expand Up @@ -588,7 +596,11 @@
}
}


// We are mocking, so there will be no cross domain request, however, jQuery
// aggressively pursues this if the domains don't match, so we need to
// explicitly disallow it. (See #136)
origSettings.crossDomain = false;

// Removed to fix #54 - keep the mocking data object intact
//mockHandler.data = requestSettings.data;

Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.mockjax.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jquery-mockjax",
"title": "jQuery Mockjax",
"version": "2.0.1",
"version": "2.1.0",
"main": "./src/jquery.mockjax.js",
"description": "The jQuery Mockjax Plugin provides a simple and extremely flexible interface for mocking or simulating ajax requests and responses.",
"url": "https://github.com/jakerella/jquery-mockjax",
Expand Down
1 change: 1 addition & 0 deletions test/dist-min.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ <h1 id='qunit-header'>
<a href='?jquery=1.11.3'>jQuery 1.11.3</a>
<a href='?jquery=2.0.3'>jQuery 2.0.3</a>
<a href='?jquery=2.1.4'>jQuery 2.1.4</a>
<a href='?jquery=2.2.0'>jQuery 2.2.0</a>
<a href='?jquery=git'>jQuery Latest (git)</a>
<button class='runall' disabled='disabled'>Run All Versions</button>
</h1>
Expand Down
1 change: 1 addition & 0 deletions test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ <h1 id='qunit-header'>
<a href='?jquery=1.11.3'>jQuery 1.11.3</a>
<a href='?jquery=2.0.3'>jQuery 2.0.3</a>
<a href='?jquery=2.1.4'>jQuery 2.1.4</a>
<a href='?jquery=2.2.0'>jQuery 2.2.0</a>
<a href='?jquery=git'>jQuery Latest (git)</a>
<button class='runall' disabled='disabled'>Run All Versions</button>
</h1>
Expand Down
12 changes: 6 additions & 6 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -679,23 +679,23 @@
var done = assert.async();

$.mockjax({
url: '/test',
url: '/foobar',
contentType: 'text/plain',
responseText: 'test'
});

$.ajax({
url: '/test',
url: '/foobar',
success: function(text) {
assert.equal(text, 'test', 'Test handler responded');
},
error: qunit.noErrorCallbackExpected,
complete: function() {
$.mockjax.clear('/test');
$.mockjax.clear('/foobar');

// Reissue the request expecting the error
$.ajax({
url: '/test',
url: '/foobar',
success: function() {
assert.ok(false, 'The mock was not cleared by url');
},
Expand Down Expand Up @@ -2457,7 +2457,7 @@
dataType: 'script',
url: 'http://jquery-mockjax-foobar.com/somefile.js',
error: qunit.noErrorCallbackExpected,
success: function(data) {
success: function() {
assert.strictEqual(window.mockjaxCrossDomain, true, 'mockjax call for script was mocked');
},
complete: done
Expand All @@ -2478,7 +2478,7 @@
dataType: 'script',
url: 'http://jquery-mockjax-foobar.com/somefile.js',
error: qunit.noErrorCallbackExpected,
success: function(data) {
success: function() {
assert.strictEqual(window.mockjaxCrossDomain, true, 'mockjax call for script was mocked');
},
complete: done
Expand Down

0 comments on commit f641a73

Please sign in to comment.