Tests: add dummy forEach blocks around sections with components
This commit is contained in:
parent
a8e5189f0b
commit
f96319e6f6
7 changed files with 1268 additions and 1223 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
var o = require("../ospec/ospec")
|
||||
var browserMock = require("../test-utils/browserMock")
|
||||
var components = require("../test-utils/components")
|
||||
|
||||
o.spec("api", function() {
|
||||
var m
|
||||
|
|
@ -87,84 +88,90 @@ o.spec("api", function() {
|
|||
o(root.firstChild.nodeName).equals("DIV")
|
||||
})
|
||||
})
|
||||
o.spec("m.mount", function() {
|
||||
o("works", function() {
|
||||
var root = window.document.createElement("div")
|
||||
m.mount(root, {view: function() {return m("div")}})
|
||||
;[components[0]].forEach(function(cmp){
|
||||
o.spec(cmp.kind, function(){
|
||||
var createComponent = cmp.create
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(root.firstChild.nodeName).equals("DIV")
|
||||
o.spec("m.mount", function() {
|
||||
o("works", function() {
|
||||
var root = window.document.createElement("div")
|
||||
m.mount(root, {view: function() {return m("div")}})
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(root.firstChild.nodeName).equals("DIV")
|
||||
})
|
||||
})
|
||||
o.spec("m.route", function() {
|
||||
o("works", function(done) {
|
||||
var root = window.document.createElement("div")
|
||||
m.route(root, "/a", {
|
||||
"/a": {view: function() {return m("div")}}
|
||||
})
|
||||
|
||||
setTimeout(function() {
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(root.firstChild.nodeName).equals("DIV")
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
o("m.route.prefix", function(done) {
|
||||
var root = window.document.createElement("div")
|
||||
m.route.prefix("#")
|
||||
m.route(root, "/a", {
|
||||
"/a": {view: function() {return m("div")}}
|
||||
})
|
||||
|
||||
setTimeout(function() {
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(root.firstChild.nodeName).equals("DIV")
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
o("m.route.get", function(done) {
|
||||
var root = window.document.createElement("div")
|
||||
m.route(root, "/a", {
|
||||
"/a": {view: function() {return m("div")}}
|
||||
})
|
||||
|
||||
setTimeout(function() {
|
||||
o(m.route.get()).equals("/a")
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
o("m.route.set", function(done, timeout) {
|
||||
timeout(100)
|
||||
var root = window.document.createElement("div")
|
||||
m.route(root, "/a", {
|
||||
"/:id": {view: function() {return m("div")}}
|
||||
})
|
||||
|
||||
setTimeout(function() {
|
||||
m.route.set("/b")
|
||||
setTimeout(function() {
|
||||
o(m.route.get()).equals("/b")
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
})
|
||||
o.spec("m.redraw", function() {
|
||||
o("works", function(done) {
|
||||
var count = 0
|
||||
var root = window.document.createElement("div")
|
||||
m.mount(root, {view: function() {count++}})
|
||||
setTimeout(function() {
|
||||
m.redraw()
|
||||
|
||||
o(count).equals(2)
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
o.spec("m.route", function() {
|
||||
o("works", function(done) {
|
||||
var root = window.document.createElement("div")
|
||||
m.route(root, "/a", {
|
||||
"/a": {view: function() {return m("div")}}
|
||||
})
|
||||
|
||||
setTimeout(function() {
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(root.firstChild.nodeName).equals("DIV")
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
o("m.route.prefix", function(done) {
|
||||
var root = window.document.createElement("div")
|
||||
m.route.prefix("#")
|
||||
m.route(root, "/a", {
|
||||
"/a": {view: function() {return m("div")}}
|
||||
})
|
||||
|
||||
setTimeout(function() {
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(root.firstChild.nodeName).equals("DIV")
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
o("m.route.get", function(done) {
|
||||
var root = window.document.createElement("div")
|
||||
m.route(root, "/a", {
|
||||
"/a": {view: function() {return m("div")}}
|
||||
})
|
||||
|
||||
setTimeout(function() {
|
||||
o(m.route.get()).equals("/a")
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
o("m.route.set", function(done, timeout) {
|
||||
timeout(100)
|
||||
var root = window.document.createElement("div")
|
||||
m.route(root, "/a", {
|
||||
"/:id": {view: function() {return m("div")}}
|
||||
})
|
||||
|
||||
setTimeout(function() {
|
||||
m.route.set("/b")
|
||||
setTimeout(function() {
|
||||
o(m.route.get()).equals("/b")
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
})
|
||||
o.spec("m.redraw", function() {
|
||||
o("works", function(done) {
|
||||
var count = 0
|
||||
var root = window.document.createElement("div")
|
||||
m.mount(root, {view: function() {count++}})
|
||||
setTimeout(function() {
|
||||
m.redraw()
|
||||
|
||||
o(count).equals(2)
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue