diff --git a/lib/techs/v2/deps.js.js b/lib/techs/v2/deps.js.js index ce7a2ce3..45da13b1 100644 --- a/lib/techs/v2/deps.js.js +++ b/lib/techs/v2/deps.js.js @@ -242,7 +242,12 @@ var Deps = exports.Deps = INHERIT({ var depsItem = new DepsItem(item, ctx); - fn.call(_this, depsItem); // _this.add(rootItem, 'shouldDeps', depsItem); + if (Array.isArray(item.elem)) { + //add only elems and not block + forEachItem('elem', item.elem, depsItem); + } else { + fn.call(_this, depsItem); // _this.add(rootItem, 'shouldDeps', depsItem); + } _this.parse( item.mustDeps, @@ -490,12 +495,16 @@ var DepsItem = exports.DepsItem = INHERIT({ extendByCtx: function(ctx) { if(ctx && (ctx = ctx.item)) { - var ks = ['tech', 'block', 'elem', 'mod', 'val'], - k; + var keys = ['block', 'elem', 'mod', 'val'], + key; - while(k = ks.shift()) - if(this.item[k]) break; - else ctx[k] && (this.item[k] = ctx[k]); + if (!this.item.tech && ctx.tech) { + this.item.tech = ctx.tech; + } + while (key = keys.shift()) { + if(this.item[key]) break; + else ctx[key] && (this.item[key] = ctx[key]); + } } return this; }, diff --git a/test/v2-deps.js b/test/v2-deps.js index d1fedd58..da0aee50 100644 --- a/test/v2-deps.js +++ b/test/v2-deps.js @@ -109,8 +109,7 @@ describe('Deps', function() { ] } } )); - // TODO: https://github.com/bem/bem-tools/issues/401 - it.skip('block with elem array', assertDepsParse( + it('block with elem array', assertDepsParse( [ { block: 'b1', elem: ['e1', 'e2'] } ], { '': {'': [ {block: 'b1', elem: 'e1'}, @@ -151,8 +150,7 @@ describe('Deps', function() { } } )); - // TODO: https://github.com/bem/bem-tools/issues/413 - it.skip('block with tech shortcut', assertDepsParse( + it('block with tech shortcut', assertDepsParse( {block: 'b1', tech: 't1', shouldDeps: {tech: 't2'}}, { 't1': { 't1': [ { block: 'b1', tech: 't1'} ],