Commit f982fc02 by Иван Кубота

fix reactive property setter in DOM

added test for it
parent 274eb82d
......@@ -132,7 +132,7 @@ NS.apply = function(a,b) {
if( typeof style[ i ] === 'function' ){
style[ i ]( setters.style( s, i ) );
}else if(typeof style[ i ] === 'object'&& style[ i ] !== null && style[ i ].hook){
return style[ i ].hook(setters.style(s, i));
style[ i ].hook(setters.style(s, i));
}else{
setters.style( s, i )( style[ i ] );
}
......@@ -147,7 +147,7 @@ NS.apply = function(a,b) {
if( typeof attr[ i ] === 'function' ){
attr[ i ]( setters.attr( el, i ) );
}else if(typeof attr[ i ] === 'object'&& attr[ i ] !== null && attr[ i ].hook){
return attr[ i ].hook(setters.attr(el, i));
attr[ i ].hook(setters.attr(el, i));
}else{
setters.attr( el, i )( attr[ i ] );
}
......
......@@ -18,6 +18,16 @@ describe('DOM with Store', function(){
assert.equal(div.outerHTML, '<div data-hooked="yep">d</div>');
} );
it( 'should create simple a href with reactive values', function(){
var href = new Store.Value.String('href');
var val = new Store.Value.String('txt');
var div = D.h('a', {href: href}, val);
assert.equal(div.outerHTML, '<a href="href" data-hooked="yep">txt</a>');
href.set('href2');
val.set('txt2');
assert.equal(div.outerHTML, '<a href="href2" data-hooked="yep">txt2</a>');
} );
it( 'should set reactive cls', function(){
var val = new Store.Value.String('c'),
bool = new Store.Value.Boolean(false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment