Skip to content

Commit

Permalink
Merge bef309f into 06779a1
Browse files Browse the repository at this point in the history
  • Loading branch information
tadatuta committed Aug 21, 2017
2 parents 06779a1 + bef309f commit 806227f
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion common.blocks/i-bem-dom/i-bem-dom.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,8 @@ describe('i-bem-dom', function() {
content : { block : 'block1', js : true }
});

bemDom.update(rootNode, BEMHTML.apply({ block : 'block2', js : true }));
bemDom.update(rootNode, BEMHTML.apply({ block : 'block2', js : true }))
.should.be.equal(rootNode);

spyBlock1Destructed.called.should.be.true;
spyBlock2Inited.called.should.be.true;
Expand All @@ -1433,6 +1434,35 @@ describe('i-bem-dom', function() {
});
});

describe('bemDom.before', function() {
it('should properly update tree', function() {
var spyBlock2Inited = sinon.spy(),
block2DomElem;

bemDom.declBlock('block2', {
onSetMod : {
js : {
inited : function() {
spyBlock2Inited();
block2DomElem = this.domElem;
}
}
}
});

rootNode = createDomNode({
tag : 'div',
content : { block : 'block1', js : true }
});

var newCtx = bemDom.before(rootNode.find('.block1'), BEMHTML.apply({ block : 'block2', js : true }));

newCtx.is(block2DomElem).should.be.true;
rootNode.children().eq(0).is(block2DomElem).should.be.true;
spyBlock2Inited.called.should.be.true;
});
});

describe('bemDom.replace', function() {
it('should properly replace tree', function() {
var spyBlock1Destructed = sinon.spy(),
Expand Down Expand Up @@ -1481,6 +1511,8 @@ describe('i-bem-dom', function() {
});
});

// don't add specs for other DOM changing methods as they are implemented the same way

describe('params', function() {
it('should properly join params', function(done) {
var Block = bemDom.declBlock('block', {
Expand Down

0 comments on commit 806227f

Please sign in to comment.