Skip to content

Commit

Permalink
runtime: fix mix overwriting jsParams
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny committed Apr 27, 2015
1 parent 8b8ab29 commit adf3216
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/bemhtml/runtime/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ BEMHTML.prototype.render = function render(context,
if (mix) {
var m = this.renderMix(entity, totalMix, jsParams, addJSInitClass);
out += m.out;
jsParams = out.jsParams;
addJSInitClass = out.addJSInitClass;
jsParams = m.jsParams;
addJSInitClass = m.addJSInitClass;
}

if (cls)
Expand Down
21 changes: 21 additions & 0 deletions test/runtime-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,27 @@ describe('BEMHTML compiler/Runtime', function() {
}, '<a class="b1 b1_x_10 b2 b2_modname_modval b3__e3 b3__e3_modname_1">' +
'</a>');
});

it('should check that mix do not overwrite jsParams', function() {
test(function() {
block('b1')(
js()(true),
mix()([ { block: 'b2' } ])
);
}, {
block: 'b1'
}, '<div class="b1 b2 i-bem" data-bem="{&quot;b1&quot;:{}}"></div>');
});

it('should support singular mix', function() {
test(function() {
block('b1')(
mix()({ block: 'b2' })
);
}, {
block: 'b1'
}, '<div class="b1 b2"></div>');
});
});

describe('position in Context', function() {
Expand Down

0 comments on commit adf3216

Please sign in to comment.