Use the same options object in handle-response as in send-request (#148)

Instead of cloning this.options again in handle-response.js, pass the options object from send-request.js. This way, pjax.state.options will also have the request options.
This commit was merged in pull request #148.
This commit is contained in:
BehindTheMath authored and GitHub committed 2018-04-26 09:27:50 -04:00
1 parent 358b6f6836
commit 7d26a75fdf
5 files changed
+20 -14

No files matched your search

+6 -2
View File
@@ -37,7 +37,9 @@ tape("test events triggered when handleResponse(false) is called", function(t) {
tape("test when handleResponse() is called normally", function(t) {
var pjax = {
options: {},
options: {
test: 1
},
loadContent: noop,
state: {}
}
@@ -55,7 +57,9 @@ tape("test when handleResponse() is called normally", function(t) {
scrollPos: [0, 0]
}, "window.history.state is set correctly")
t.equals(pjax.state.href, "href", "this.state.href is set correctly")
t.same(pjax.state.options, pjax.options, "this.state.options is set correctly")
t.equals(Object.keys(pjax.state.options).length, 2, "this.state.options is set correctly")
t.same(pjax.state.options.request, request, "this.state.options is set correctly")
t.equals(pjax.state.options.test, 1, "this.state.options is set correctly")
t.end()
})