v0.2.2-rc.1

This commit is contained in:
Leo Horie 2015-12-20 09:14:28 -05:00
parent 484a9d6c70
commit 270b20a2b0
110 changed files with 17357 additions and 3070 deletions

View file

@ -5,6 +5,7 @@ describe("m.request()", function () {
function resolve() {
var xhr = mock.XMLHttpRequest.$instances.pop()
xhr.$resolve.apply(xhr, arguments)
xhr.onreadystatechange()
return xhr
}
@ -66,7 +67,7 @@ describe("m.request()", function () {
})().url).to.equal("http://domain.com:80/foo")
})
it("propogates errors through the promise (1)", function () {
it("propagates errors through the promise (1)", function () {
var error = m.prop()
var prop = m.request({
@ -80,7 +81,7 @@ describe("m.request()", function () {
expect(error().message).to.equal("error occurred")
})
it("propogates errors through the promise (2)", function () {
it("propagates errors through the promise (2)", function () {
var error = m.prop()
var prop = m.request({
@ -94,7 +95,7 @@ describe("m.request()", function () {
expect(error().message).to.equal("error occurred")
})
it("does not propogate results to `finally`", function () {
xit("does not propagate results to `finally`", function () {
// Data returned by then() functions do *not* propagate to finally().
var data = m.prop()
var prop = m.request({
@ -110,7 +111,7 @@ describe("m.request()", function () {
expect(data()).to.not.exist
})
it("does not propogate `finally` results to the next promise", function () {
it("does not propagate `finally` results to the next promise", function () {
var data = m.prop()
var prop = m.request({method: "GET", url: "test"})
@ -123,7 +124,7 @@ describe("m.request()", function () {
expect(data()).to.equal("foo")
})
it("propogates `finally` errors", function () {
it("propagates `finally` errors", function () {
var error = m.prop()
var prop = m.request({method: "GET", url: "test"})
@ -181,7 +182,8 @@ describe("m.request()", function () {
data: {foo: 1}
}).then(null, error)
var xhr = mock.XMLHttpRequest.$instances.pop().$resolve()
var xhr = mock.XMLHttpRequest.$instances.pop()
xhr.onreadystatechange()
expect(xhr.$headers).to.have.property(
"Content-Type",
@ -196,7 +198,8 @@ describe("m.request()", function () {
url: "test"
}).then(null, error)
var xhr = mock.XMLHttpRequest.$instances.pop().$resolve()
var xhr = mock.XMLHttpRequest.$instances.pop()
xhr.onreadystatechange()
expect(xhr.$headers).to.not.have.property("Content-Type")
})
@ -214,7 +217,7 @@ describe("m.request()", function () {
expect(initialValue).to.equal("foo")
})
it("correctly propogates initial value when not completed", function () {
it("correctly propagates initial value when not completed", function () {
var prop = m.request({
method: "POST",
url: "test",
@ -256,7 +259,7 @@ describe("m.request()", function () {
expect(prop().url).to.equal("test?foo=1&foo=2")
})
it("propogates initial value in call before request is completed", function () { // eslint-disable-line
it("propagates initial value in call before request is completed", function () { // eslint-disable-line
var value
var prop1 = m.request({method: "GET", url: "test", initialValue: 123})
expect(prop1()).to.equal(123)