diff --git a/.jshintrc b/.jshintrc index 67318e29..6d34aef7 100644 --- a/.jshintrc +++ b/.jshintrc @@ -29,7 +29,7 @@ "unused" : true, // true: Require all defined variables be used "strict" : false, // true: Requires all functions run in ES5 Strict Mode "maxparams" : false, // {int} Max number of formal params allowed per function - "maxdepth" : 3, // {int} Max depth of nested blocks (within functions) + "maxdepth" : 4, // {int} Max depth of nested blocks (within functions) "maxstatements" : false, // {int} Max number statements per function "maxcomplexity" : false, // {int} Max cyclomatic complexity per function "maxlen" : false, // {int} Max number of characters per line diff --git a/lib/bemhtml/runtime/index.js b/lib/bemhtml/runtime/index.js index c98042cd..cc1c9411 100644 --- a/lib/bemhtml/runtime/index.js +++ b/lib/bemhtml/runtime/index.js @@ -606,6 +606,8 @@ BEMHTML.prototype.renderMix = function renderMix(entity, if (!nestedItem.block && !nestedItem.elem || !visited[classBuilder.build(nestedItem.block, nestedItem.elem)]) { + if (nestedItem.block) continue; + nestedItem._block = block; nestedItem._elem = elem; mix = mix.slice(0, i + 1).concat( diff --git a/test/runtime-test.js b/test/runtime-test.js index 89c1cac9..37c53f98 100644 --- a/test/runtime-test.js +++ b/test/runtime-test.js @@ -401,6 +401,26 @@ describe('BEMHTML compiler/Runtime', function() { ''); }); + it('should render both mix from templates and from bemjson', function() { + test(function() { + block('b').elem('e').replace()(function() { + var mix = [ + { block: this.block, elem: this.elem }, + { block: 'sprite', mods: { test: 'opa' } } + ].concat(this.ctx.mix); + + return { + block: 'replace', + mix: mix + }; + }); + }, { + block: 'b', + elem: 'e', + mix: { block: 'bemjson' } + }, '
'); + }); + it('should check that mix do not overwrite jsParams', function() { test(function() { block('b1')(