bem / bem-xjst

bem-xjst (eXtensible JavaScript Templates): declarative template engine for the browser and server
https://bem.github.io/bem-xjst
Other
115 stars 47 forks source link

Test on reapply fails on BEMTREE #126

Closed tadatuta closed 8 years ago

tadatuta commented 8 years ago

https://github.com/bem/bem-xjst/blob/bemtree-nextgen/test/bemtree/runtime-test.js#L262-L279

tadatuta commented 8 years ago

@indutny ping?

indutny commented 8 years ago

Pong, looking

indutny commented 8 years ago

@tadatuta the problem with a test is following:

this.reapply() returns { block: 'b2', content: 'ok'} as it should be. Then it gets passed to .renderContent, but now with this of the b1, which has this.wtf set to fail. renderContent is obviously re-rendering it with a fail in content.

From what we have in code - this is quite expected behavior, isn't it? You are returning BEMJSON object and if content mode does this - templates will use it as BEMJSON to render the contents.

tadatuta commented 8 years ago

I still can't understand the difference with BEMHTML (see https://github.com/bem/bem-xjst/blob/bemtree-nextgen/test/bemhtml/runtime-test.js#L199-L210)?

indutny commented 8 years ago

The difference is that BEMHTML returns string instance and not BEMJSON when you call this.reapply().

tadatuta commented 8 years ago

ok, thank you, got it. will update tests.