Tests: add dummy forEach blocks around sections with components

This commit is contained in:
Pierre-Yves Gerardy 2017-02-19 00:33:01 +01:00
parent a8e5189f0b
commit f96319e6f6
7 changed files with 1268 additions and 1223 deletions

View file

@ -1,6 +1,7 @@
"use strict"
var o = require("../../ospec/ospec")
var components = require("../../test-utils/components")
var domMock = require("../../test-utils/domMock")
var m = require("../../render/hyperscript")
@ -32,6 +33,10 @@ o.spec("mount", function() {
o(threw).equals(true)
})
;[components[0]].forEach(function(cmp){
o.spec(cmp.kind, function(){
var createComponent = cmp.create
o("throws on invalid `root` DOM node", function() {
var threw = false
try {
@ -266,3 +271,5 @@ o.spec("mount", function() {
},40)
})
})
})
})

View file

@ -1,6 +1,7 @@
"use strict"
var o = require("../../ospec/ospec")
var components = require("../../test-utils/components")
var domMock = require("../../test-utils/domMock")
var vdom = require("../../render/render")
@ -13,6 +14,10 @@ o.spec("component", function() {
render = vdom($window).render
})
;[components[0]].forEach(function(cmp){
o.spec(cmp.kind, function(){
var createComponent = cmp.create
o.spec("basics", function() {
o("works", function() {
var component = {
@ -695,7 +700,9 @@ o.spec("component", function() {
}
})
})
o.spec("Alternative ways to specify componenents", function() {
})
})
o.spec("Alternative ways to specify components", function() {
o("Classes can be used as components", function() {
function MyComponent(vnode){
o(vnode.state).equals(null)

View file

@ -2,6 +2,7 @@
var o = require("../../ospec/ospec")
var callAsync = require("../../test-utils/callAsync")
var components = require("../../test-utils/components")
var domMock = require("../../test-utils/domMock")
var vdom = require("../../render/render")
var Promise = require("../../promise/promise")
@ -169,6 +170,9 @@ o.spec("onbeforeremove", function() {
done()
})
})
;[components[0]].forEach(function(cmp){
o.spec(cmp.kind, function(){
var createComponent = cmp.create
o("finalizes the remove phase asynchronously when promise is returned synchronously from both attrs- and tag.onbeforeremove", function(done) {
var onremove = o.spy()
var onbeforeremove = function(){return Promise.resolve()}
@ -206,3 +210,5 @@ o.spec("onbeforeremove", function() {
})
})
})
})
})

View file

@ -120,6 +120,10 @@ o.spec("onbeforeupdate", function() {
o(count).equals(1)
})
;[components[0]].forEach(function(cmp){
o.spec(cmp.kind, function(){
var createComponent = cmp.create
o("prevents update in component", function() {
var component = {
onbeforeupdate: function() {return false},
@ -288,3 +292,5 @@ o.spec("onbeforeupdate", function() {
o(count).equals(1)
})
})
})
})

View file

@ -113,6 +113,10 @@ o.spec("onremove", function() {
o(vnode.dom).notEquals(updated.dom)
})
;[components[0]].forEach(function(cmp){
o.spec(cmp.kind, function(){
var createComponent = cmp.create
o("calls onremove on nested component", function() {
var spy = o.spy()
var comp = {
@ -147,3 +151,5 @@ o.spec("onremove", function() {
o(spy.callCount).equals(1)
})
})
})
})

View file

@ -905,6 +905,10 @@ o.spec("updateNodes", function() {
o(vnode.dom).notEquals(updated.dom)
})
;[components[0]].forEach(function(cmp){
o.spec(cmp.kind, function(){
var createComponent = cmp.create
o("fragment child toggles from null when followed by null component then tag", function() {
var component = {view: function() {return null}}
var vnodes = [{tag: "[", children: [{tag: "a"}, {tag: component}, {tag: "b"}]}]
@ -938,3 +942,5 @@ o.spec("updateNodes", function() {
o(root.childNodes[1].nodeName).equals("S")
})
})
})
})

View file

@ -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,6 +88,10 @@ o.spec("api", function() {
o(root.firstChild.nodeName).equals("DIV")
})
})
;[components[0]].forEach(function(cmp){
o.spec(cmp.kind, function(){
var createComponent = cmp.create
o.spec("m.mount", function() {
o("works", function() {
var root = window.document.createElement("div")
@ -168,3 +173,5 @@ o.spec("api", function() {
})
})
})
})
})