diff --git a/test/bemcontext-position-test.js b/test/bemcontext-position-test.js index bd9ac612..75554ddb 100644 --- a/test/bemcontext-position-test.js +++ b/test/bemcontext-position-test.js @@ -129,4 +129,53 @@ describe('BEMContext this.position', function() { '
' + '
'); }); + + + it('should calc position with appendContent()', function() { + test(function() { + block('a').appendContent()({ block: 'b', mix: 'added' }); + + block('b')( + match(function(self) { return self.isFirst(); }) + .addMods()({ first: 'yes' }), + + match(function(self) { return self.isLast(); }) + .addMods()({ last: 'yes' }), + + cls()(function() { + return 'p_' + this.position; + }) + ); + }, + { block: 'a', content: [ { block: 'b' }, { block: 'b' } ] }, + '
' + + '
' + + '
' + + '
' + + '
'); + }); + + it('should calc position with prependContent()', function() { + test(function() { + block('a').prependContent()({ block: 'b', mix: 'added' }); + + block('b')( + match(function(self) { return self.isFirst(); }) + .addMods()({ first: 'yes' }), + + match(function(self) { return self.isLast(); }) + .addMods()({ last: 'yes' }), + + cls()(function() { + return 'p_' + this.position; + }) + ); + }, + { block: 'a', content: [ { block: 'b' }, { block: 'b' } ] }, + '
' + + '
' + + '
' + + '
' + + '
'); + }); });