-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements #17
Improvements #17
Conversation
index.js
Outdated
* @returns {exports} | ||
*/ | ||
reset: function() { | ||
MockXMLHttpRequest.handlers = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this just proxy to lib/MockXMLHttpRequest.js
's reset()
rather than re-implementing the logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're at it can you update teardown()
+ setup()
to reuse it too. ty
index.js
Outdated
if (arguments.length === 3) { | ||
matcher = function(req) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RegEx. Neat feature!
@@ -68,6 +75,9 @@ function MockXMLHttpRequest() { | |||
this.reset(); | |||
this._eventListeners = []; | |||
this.timeout = 0; | |||
// some libraries (like Mixpanel) use the presence of this field to check if XHR is properly supported |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
}, | ||
"devDependencies": { | ||
"browserify": "^11.0.1", | ||
"browserify": "^14.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ty ty
* Get/set the parsed URL query | ||
* @returns {Object} | ||
*/ | ||
MockRequest.prototype.query = function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like how the query data will be duplicated between .url()
and .query()
.... but I can see how its useful having it accessible as a map
test/index.js
Outdated
xhr.send(); | ||
}) | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you do another test for handlers not matching?
Thanks for taking the time and effort to submit this PR! I've got a few minor comments/requests above. |
Oh, and can you update the doco to reflect the possibility of using a regexp. and the changelog. thanks! |
Updated |
💄 Beautiful, thanks! Doesn't look like any breaking changes, version |
Yeah, I think 1.8.0
…On Tue, Feb 7, 2017 at 4:16 AM James Newell ***@***.***> wrote:
Merged #17 <#17>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#17 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAgGCG1M-8Oj_b-atc1o14NceH02i5Xqks5rZ8XegaJpZM4L1DQC>
.
|
This overlaps with #16. Please feel free to reject if you find that approach better fitting your goals, or let me know if you want me to update it after merging that PR.
Basically, I've been following two goals: