Skip to content

Commit f641a73

Browse files
committed
Merge pull request #277 from jakerella/release-2.1.0
Release 2.1.0
2 parents 7c4dee0 + 0316134 commit f641a73

9 files changed

+57
-14
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
sudo: false
22
language: node_js
33
node_js:
4-
- "0.12"
4+
- "4.2"
55
before_install: npm install -g grunt-cli
66
branches:
77
only:

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## 2016-01-23
2+
* Updated to version 2.1.0
3+
* Removed unused testswarm files
4+
* Added test step in build process for dist file
5+
* Refactor tests to be easier to maintain and conform to current QUnit standards
6+
* Added global URL namespace feature (thanks @danpaz)
7+
* Added clearing of mocks by URL and regex (thanks @stas-vilchik)
8+
* Use async setting for proxy data (thanks @udnisap)
9+
* Update tests to jQuery 2.2.0 and fix for latest in jQuery git (thanks Simon and @gyoshev)
10+
* Fixed #136: cross domain requests
11+
* Updated contributing documentation to clearly state process for a release
12+
113
## 2015-06-11
214
* Updated to version 2.0.1
315
* Fixed name in package.json for coordination among package management systems

CONTRIBUTING.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,20 @@ branch as well as `master` (if the bug exists in both).
122122
You should also write a good PR message with information on why this feature or fix is
123123
necesary or a good idea. For features, be sure to include information on _how to use_
124124
the feature; and for bugs, information on how to reproduce the bug is helpful!
125+
126+
## Publishing a Release
127+
128+
Although individual contributors cannot publish a release, it's good to have
129+
documentation on what goes into that in case anyone needs to take over the process.
130+
Currently, @jakerella is the only one doing so.
131+
132+
1. Create a branch for the release (usually with the proposed version number in the name)
133+
1. Ensure that all tests are passing in all supported browsers that you can (see below).
134+
1. Update the `CHANGELOG.md`, `package.json` version, and any other necessary files.
135+
(Note that these can be in a commit, but put them in that new branch.)
136+
1. Make sure to generate fresh dist files if necessary and commit those.
137+
1. Submit a PR for the branch, this will initiate the Travis CI checks.
138+
1. Ask others for input on the PR (mostly testing in their own browsers).
139+
1. *If all is well*, merge the branch into `master`
140+
1. Create a release on Github with a tag matching the version number and proper info.
141+
1. Run `npm publish` on `master` to push the new version up to npm.

dist/jquery.mockjax.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Version: 2.0.1
55
* Home: https://github.com/jakerella/jquery-mockjax
6-
* Copyright (c) 2015 Jordan Kasper, formerly appendTo;
6+
* Copyright (c) 2016 Jordan Kasper, formerly appendTo;
77
* NOTE: This repository was taken over by Jordan Kasper (@jakerella) October, 2014
88
*
99
* Dual licensed under the MIT or GPL licenses.
@@ -240,7 +240,7 @@
240240
this.statusText = mockHandler.statusText;
241241
}
242242
// jQuery 2.0 renamed onreadystatechange to onload
243-
onReady = this.onreadystatechange || this.onload;
243+
onReady = this.onload || this.onreadystatechange;
244244

245245
// jQuery < 1.4 doesn't have onreadystate change for xhr
246246
if ( $.isFunction( onReady ) ) {
@@ -280,6 +280,7 @@
280280
url: mockHandler.proxy,
281281
type: mockHandler.proxyType,
282282
data: mockHandler.data,
283+
async: requestSettings.async,
283284
dataType: requestSettings.dataType === 'script' ? 'text/plain' : requestSettings.dataType,
284285
complete: function(xhr) {
285286
mockHandler.responseXML = xhr.responseXML;
@@ -291,7 +292,13 @@
291292
if (isDefaultSetting(mockHandler, 'statusText')) {
292293
mockHandler.statusText = xhr.statusText;
293294
}
294-
this.responseTimer = setTimeout(process, parseResponseTimeOpt(mockHandler.responseTime));
295+
296+
if ( requestSettings.async === false ) {
297+
// TODO: Blocking delay
298+
process();
299+
} else {
300+
this.responseTimer = setTimeout(process, parseResponseTimeOpt(mockHandler.responseTime));
301+
}
295302
}
296303
});
297304
} else {
@@ -303,6 +310,7 @@
303310
this.responseTimer = setTimeout(process, parseResponseTimeOpt(mockHandler.responseTime));
304311
}
305312
}
313+
306314
}
307315

308316
// Construct a mocked XHR Object
@@ -588,7 +596,11 @@
588596
}
589597
}
590598

591-
599+
// We are mocking, so there will be no cross domain request, however, jQuery
600+
// aggressively pursues this if the domains don't match, so we need to
601+
// explicitly disallow it. (See #136)
602+
origSettings.crossDomain = false;
603+
592604
// Removed to fix #54 - keep the mocking data object intact
593605
//mockHandler.data = requestSettings.data;
594606

dist/jquery.mockjax.min.js

Lines changed: 2 additions & 2 deletions
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.0.1",
4+
"version": "2.1.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",

test/dist-min.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ <h1 id='qunit-header'>
2222
<a href='?jquery=1.11.3'>jQuery 1.11.3</a>
2323
<a href='?jquery=2.0.3'>jQuery 2.0.3</a>
2424
<a href='?jquery=2.1.4'>jQuery 2.1.4</a>
25+
<a href='?jquery=2.2.0'>jQuery 2.2.0</a>
2526
<a href='?jquery=git'>jQuery Latest (git)</a>
2627
<button class='runall' disabled='disabled'>Run All Versions</button>
2728
</h1>

test/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ <h1 id='qunit-header'>
2222
<a href='?jquery=1.11.3'>jQuery 1.11.3</a>
2323
<a href='?jquery=2.0.3'>jQuery 2.0.3</a>
2424
<a href='?jquery=2.1.4'>jQuery 2.1.4</a>
25+
<a href='?jquery=2.2.0'>jQuery 2.2.0</a>
2526
<a href='?jquery=git'>jQuery Latest (git)</a>
2627
<button class='runall' disabled='disabled'>Run All Versions</button>
2728
</h1>

test/test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -679,23 +679,23 @@
679679
var done = assert.async();
680680

681681
$.mockjax({
682-
url: '/test',
682+
url: '/foobar',
683683
contentType: 'text/plain',
684684
responseText: 'test'
685685
});
686686

687687
$.ajax({
688-
url: '/test',
688+
url: '/foobar',
689689
success: function(text) {
690690
assert.equal(text, 'test', 'Test handler responded');
691691
},
692692
error: qunit.noErrorCallbackExpected,
693693
complete: function() {
694-
$.mockjax.clear('/test');
694+
$.mockjax.clear('/foobar');
695695

696696
// Reissue the request expecting the error
697697
$.ajax({
698-
url: '/test',
698+
url: '/foobar',
699699
success: function() {
700700
assert.ok(false, 'The mock was not cleared by url');
701701
},
@@ -2457,7 +2457,7 @@
24572457
dataType: 'script',
24582458
url: 'http://jquery-mockjax-foobar.com/somefile.js',
24592459
error: qunit.noErrorCallbackExpected,
2460-
success: function(data) {
2460+
success: function() {
24612461
assert.strictEqual(window.mockjaxCrossDomain, true, 'mockjax call for script was mocked');
24622462
},
24632463
complete: done
@@ -2478,7 +2478,7 @@
24782478
dataType: 'script',
24792479
url: 'http://jquery-mockjax-foobar.com/somefile.js',
24802480
error: qunit.noErrorCallbackExpected,
2481-
success: function(data) {
2481+
success: function() {
24822482
assert.strictEqual(window.mockjaxCrossDomain, true, 'mockjax call for script was mocked');
24832483
},
24842484
complete: done

0 commit comments

Comments
 (0)