Fix state initialization (#1652)
* Add test-utils/components.js and its tests * Tests: group together tests with/without components * Tests: factory => closure components * Tests: add dummy forEach blocks around sections with components * Tests: render/test-components tweaks * Tests: Wrap some component definitions in `createComponent()` calls These are the ones that would have been tedious to automate. jscodeshift will handle the remaining ones * Tests: wrap the rest of the components definitions * Tests: enable the three kind of components in all related files but api/tests/test-route.js * Add test-utils/components.js to index.html where needed * Tests: Some more render/tests/test-component.js refactoring * Tests: enable tests for #1638 * fix #1638 * Test: ensure that recycled components get a fresh state * Tests: add a test for onbeforeupdate and recycled nodes * Fix recycled components initialization fix #1641
This commit is contained in:
parent
3786373b58
commit
60e8f307f1
15 changed files with 1615 additions and 1406 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