Merge branch 'next' of https://github.com/isiahmeadows/mithril.js into prop-fix

This commit is contained in:
impinball 2015-12-10 19:14:32 -05:00
commit 2a47a8e77d
20 changed files with 941 additions and 111 deletions

View file

@ -26,7 +26,7 @@ function test(sel) {
m.module(document.getElementById("test"), {
controller: function() {
this.title = m.prop("hello world");
this.title = m.prop("hello world")
},
view: function (ctrl) {
@ -55,7 +55,7 @@ m.module(document.getElementById("test"), {
m("div[contenteditable]", {
style: {border: "1px solid #888"},
onkeyup: m.withAttr("innerHTML", ctrl.title)
}, ctrl.title()),
}, ctrl.title())
]),
m("li", [
@ -64,10 +64,10 @@ m.module(document.getElementById("test"), {
m("div[contenteditable]", {
style: {border: "1px solid #888"},
onkeyup: m.withAttr("innerHTML", ctrl.title)
}, m.trust(ctrl.title())),
}, m.trust(ctrl.title()))
])
])
]);
])
}
});
})
</script>

View file

@ -469,7 +469,6 @@ describe("m.mount()", function () {
expect(spy).to.have.been.called
})
it("calls config with truthy init only once", function () {
mock.requestAnimationFrame.$resolve()

View file

@ -911,7 +911,6 @@ describe("m.render()", function () {
expect(root.childNodes[0].nodeName).to.equal("DIV")
})
// https://github.com/lhorie/mithril.js/issues/157
it("renders nodes with new keys correctly", function () {
var root = mock.document.createElement("div")
@ -1318,7 +1317,7 @@ describe("m.render()", function () {
// FIXME: implement document.createRange().createContextualFragment() in the
// mock document to fix this test
xit("keeps unkeyed identity if mixed with elements/trusted text and identity can be inferred", function () { // eslint-disable-line
it("keeps unkeyed identity if mixed with elements/trusted text and identity can be inferred", function () { // eslint-disable-line
var root = mock.document.createElement("div")
m.render(root, m("div", [

View file

@ -345,4 +345,40 @@ describe("m.request()", function () {
expect(req()).to.eql({foo: "bar1"})
})
})
it("ends the computation when a SyntaxError is thrown from `options.extract`", function () { // eslint-disable-line max-len
var root = mock.document.createElement("div")
var viewSpy = sinon.spy(function () { return m("div") })
var resolved = sinon.spy()
var rejected = sinon.spy()
m.mount(root, {
controller: function () {
m.request({
url: "/test",
extract: function () {
throw new SyntaxError()
}
}).then(resolved, rejected)
},
view: viewSpy
})
// For good measure
mock.requestAnimationFrame.$resolve()
expect(function () {
resolve()
}).to.throw()
expect(resolved).to.not.have.been.called
expect(rejected).to.not.have.been.called
// The controller should throw, but the view should still render.
expect(viewSpy).to.have.been.called
// For good measure
mock.requestAnimationFrame.$resolve()
})
})

View file

@ -102,7 +102,7 @@ describe("m.route()", function () {
expect(route2).to.equal("/test13")
})
// FIXME: this causes others to fail
// FIXME: this causes others to fail, even though it passes
xdit("skips route change if component ctrl.onunload calls preventDefault", function (root) { // eslint-disable-line
mode("search")
var spy = sinon.spy()
@ -130,7 +130,7 @@ describe("m.route()", function () {
expect(spy).to.not.have.been.called
})
// FIXME: this causes others to fail
// FIXME: this causes others to fail, even though it passes
xdit("skips route change if subcomponent ctrl.onunload calls preventDefault", function (root) { // eslint-disable-line
mode("search")
@ -161,7 +161,7 @@ describe("m.route()", function () {
expect(spy).to.not.have.been.called
})
// FIXME: this causes others to fail
// FIXME: this causes others to fail, even though it passes
xdit("skips route change if non-curried component ctrl.onunload calls preventDefault", function (root) { // eslint-disable-line
mode("search")
@ -190,7 +190,7 @@ describe("m.route()", function () {
expect(spy).to.not.have.been.called
})
// FIXME: this causes others to fail
// FIXME: this causes others to fail, even though it passes
xdit("skips route change if non-curried subcomponent ctrl.onunload calls preventDefault", function (root) { // eslint-disable-line
mode("search")

View file

@ -43,7 +43,7 @@ describe("m.trust()", function () {
// FIXME: this is a bug (trusted string's contents rendered as just
// textual contents)
xit("works with mixed trusted content in td", function () {
it("works with mixed trusted content in td", function () {
var root = document.createElement("table")
root.appendChild(root = document.createElement("tr"))
@ -52,7 +52,7 @@ describe("m.trust()", function () {
m("td", "foo")
])
expect(root.childNodes[2].tagName).to.equal("td")
expect(root.childNodes[2].tagName).to.equal("TD")
})
})
})