bem / bem-xjst

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

Throw on apply undefined modes #487

Closed qfox closed 7 years ago

qfox commented 7 years ago

Input code or something about issue background

Since: https://github.com/bem/bem-xjst/commit/9d230c552f0f5fd46cf2a8f90f7ed987c4391836 Because of: https://github.com/bem/bem-xjst/blob/master/lib/bemxjst/index.js#L519

https://goo.gl/2Nx5M1

[{
    block: 'test',
    cols: ['a', 'b']
}];
block('test')(
    content()(() => apply('cols')
        .map(c => ({ block: c }))))

Expected Behavior

Unknown mode exception

Actual Behavior

<div class="test">
    <div class="a"></div>
    <div class="b"></div>
</div>

Possible Solution

Throw somewhere here: https://github.com/bem/bem-xjst/blob/master/lib/bemxjst/index.js#L519

Your Environment

Current master

miripiruni commented 7 years ago

Fixed in #488