Add test-utils/components.js and its tests
This commit is contained in:
parent
1a6554423d
commit
eccea68212
3 changed files with 83 additions and 0 deletions
27
test-utils/components.js
Normal file
27
test-utils/components.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
module.exports = [
|
||||
{
|
||||
kind: 'POJO',
|
||||
create: function(methods) {
|
||||
var res = {view: function() {return {tag:'div'}}}
|
||||
Object.keys(methods || {}).forEach(function(m){res[m] = methods[m]})
|
||||
return res
|
||||
}
|
||||
}, {
|
||||
kind: 'constructible',
|
||||
create: function(methods) {
|
||||
function res(){}
|
||||
res.prototype.view = function() {return {tag:'div'}}
|
||||
Object.keys(methods || {}).forEach(function(m){res.prototype[m] = methods[m]})
|
||||
return res
|
||||
}
|
||||
}, {
|
||||
kind: 'closure',
|
||||
create: function(methods) {
|
||||
return function() {
|
||||
var res = {view: function() {return {tag:'div'}}}
|
||||
Object.keys(methods || {}).forEach(function(m){res[m] = methods[m]})
|
||||
return res
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue