Merge remote-tracking branch 'origin/next' into es6-promise
Conflicts: mithril.js
This commit is contained in:
commit
ac4863ff7c
9 changed files with 172 additions and 34 deletions
|
|
@ -592,7 +592,6 @@ function testMithril(mock) {
|
|||
var firstBefore = root.childNodes[0]
|
||||
m.render(root, [m("a", {key: 2}), m("br"), m("a", {key: 1})])
|
||||
var firstAfter = root.childNodes[2]
|
||||
console.log(root.childNodes)
|
||||
return firstBefore == firstAfter && root.childNodes[0].key == 2 && root.childNodes.length == 3
|
||||
})
|
||||
test(function() {
|
||||
|
|
@ -1455,6 +1454,7 @@ function testMithril(mock) {
|
|||
}
|
||||
})
|
||||
root.childNodes[0].onclick({})
|
||||
mock.requestAnimationFrame.$resolve() //teardown
|
||||
return strategy == "diff" && root.childNodes[0].childNodes[0].nodeValue == "1"
|
||||
})
|
||||
test(function() {
|
||||
|
|
|
|||
|
|
@ -15,16 +15,10 @@ mock.window = new function() {
|
|||
insertBefore: function(node, reference) {
|
||||
node.parentNode = this
|
||||
var referenceIndex = this.childNodes.indexOf(reference)
|
||||
if (referenceIndex < 0) {
|
||||
var index = this.childNodes.indexOf(node)
|
||||
if (index > -1) this.childNodes.splice(index, 1)
|
||||
this.childNodes.push(node)
|
||||
}
|
||||
else {
|
||||
var index = this.childNodes.indexOf(node)
|
||||
if (index > -1) this.childNodes.splice(index, 1)
|
||||
this.childNodes.splice(referenceIndex, 0, node)
|
||||
}
|
||||
var index = this.childNodes.indexOf(node)
|
||||
if (index > -1) this.childNodes.splice(index, 1)
|
||||
if (referenceIndex < 0) this.childNodes.push(node)
|
||||
else this.childNodes.splice(referenceIndex, 0, node)
|
||||
},
|
||||
insertAdjacentHTML: function(position, html) {
|
||||
//todo: accept markup
|
||||
|
|
@ -99,8 +93,11 @@ mock.window = new function() {
|
|||
}
|
||||
window.requestAnimationFrame.$id = 1
|
||||
window.requestAnimationFrame.$resolve = function() {
|
||||
if (window.requestAnimationFrame.$callback) window.requestAnimationFrame.$callback()
|
||||
window.requestAnimationFrame.$callback = null
|
||||
if (window.requestAnimationFrame.$callback) {
|
||||
var callback = window.requestAnimationFrame.$callback
|
||||
window.requestAnimationFrame.$callback = null
|
||||
callback()
|
||||
}
|
||||
}
|
||||
window.XMLHttpRequest = new function() {
|
||||
var request = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue