fix order issue when trusted content is mixed with other siblings,

fix js error when child is a random object
make home demo more minimalist
add explanation about modules in guide
This commit is contained in:
Leo Horie 2014-10-31 09:31:01 -04:00
parent c7d6b40575
commit c980fd9b66
7 changed files with 51 additions and 9 deletions

View file

@ -396,3 +396,15 @@ test('issue278 regression', function() {
equal(selected, 2)
})
test("mixing trusted content", function() {
m.render(dummyEl, [m.trust("<p>1</p><p>2</p>"), m("i", "foo")])
equal(dummyEl.childNodes[2].nodeName, "I")
})
test("mixing trusted content w/ text nodes", function() {
m.render(dummyEl, [m.trust("<p>1</p>123<p>2</p>"), m("i", "foo")])
equal(dummyEl.childNodes[3].nodeName, "I")
})
test("mixing trusted content w/ td", function() {
m.render(dummyEl, [m.trust("<td>1</td><td>2</td>"), m("i", "foo")])
equal(dummyEl.childNodes[1].nodeName, "I")
})

View file

@ -775,6 +775,11 @@ function testMithril(mock) {
m.render(root, new Field())
return root.childNodes.length == 1
})
test(function() {
var root = mock.document.createElement("div")
m.render(root, {foo: 123})
return root.childNodes.length == 0
})
//end m.render
//m.redraw

View file

@ -1,3 +1,6 @@
//make "use strict" and nodejs happy
var window = this
//test reporting for saucelabs
if (typeof window != "undefined") {
window.global_test_results = {
@ -19,7 +22,7 @@ function test(condition) {
var result = true
test.total++
if (this.performance != null && performance.now) {
if (typeof performance != "undefined" && performance.now) {
start = performance.now()
}
try {
@ -30,11 +33,11 @@ function test(condition) {
console.error(e)
test.failures.push(condition)
}
if (this.performance != null && performance.now) {
if (typeof performance != "undefined" && performance.now) {
duration = performance.now() - start
}
test_obj = {
window.test_obj = {
name: "" + test.total,
result: result,
duration: duration
@ -42,7 +45,7 @@ function test(condition) {
if (typeof window != "undefined") {
if (!result) {
window.global_test_results.tests.push(test_obj)
window.global_test_results.tests.push(window.test_obj)
}
window.global_test_results.duration += duration