Skip to content

Commit

Permalink
Merge 05f8567 into 7ca3278
Browse files Browse the repository at this point in the history
  • Loading branch information
belozer committed Jun 19, 2018
2 parents 7ca3278 + 05f8567 commit fbc7e8f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion common.blocks/i-bem-dom/i-bem-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function initEntity(entityName, domElem, params, ignoreLazyInit, callback) {

entityCls._processInit();

if(!entityCls.lazyInit || ignoreLazyInit || params.lazyInit === false) {
if(ignoreLazyInit || params.lazyInit === false || !entityCls.lazyInit && !params.lazyInit) {
ignoreLazyInit && domElem.addClass(BEM_CLASS_NAME); // add css class for preventing memory leaks in further destructing

entity = new entityCls(uniqIdToDomElems[uniqId], params, !!ignoreLazyInit);
Expand Down
21 changes: 21 additions & 0 deletions common.blocks/i-bem-dom/i-bem-dom.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1686,6 +1686,27 @@ describe('i-bem-dom', function() {
spy.should.have.been.called;
});

it('should be possible to force lazy initialization', function() {
spy = sinon.spy();

bemDom.declBlock('block', {
onSetMod : {
'js' : {
'inited' : spy
}
}
}, {
lazyInit : false
});

rootNode = initDom({
block : 'block',
js : { lazyInit : true }
});

spy.should.have.not.been.called;
});

describe('on DOM events', function() {
beforeEach(function() {
spy = sinon.spy();
Expand Down

0 comments on commit fbc7e8f

Please sign in to comment.