diff --git a/blocks-common/i-bem/__html/i-bem__html.bemhtml b/blocks-common/i-bem/__html/i-bem__html.bemhtml index 4c047246..8e3ac1bd 100644 --- a/blocks-common/i-bem/__html/i-bem__html.bemhtml +++ b/blocks-common/i-bem/__html/i-bem__html.bemhtml @@ -388,13 +388,13 @@ default: { var mixItem = mix[i]; if (!mixItem) continue; - - var hasItem = mixItem.block || mixItem.elem, + var hasItem = (mixItem.block && (this.block !== v.block || mixItem.block !== this.block)) + || (this.elem && (!mixItem.elemMods && !mixItem.mods)) + || mixItem.elem , block = mixItem.block || mixItem._block || this.block, elem = mixItem.elem || mixItem._elem || this.elem, mods = mixItem.mods || this.mods, elemMods = mixItem.elemMods || {}; - hasItem && buf.push(' '); BEM_.INTERNAL[hasItem? 'buildClasses' : 'buildModsClasses']( block, diff --git a/blocks-common/i-bem/__html/test/files/i-bem/gh-core-804.bemhtml b/blocks-common/i-bem/__html/test/files/i-bem/gh-core-804.bemhtml new file mode 100644 index 00000000..e69de29b diff --git a/blocks-common/i-bem/__html/test/files/i-bem/gh-core-804.html b/blocks-common/i-bem/__html/test/files/i-bem/gh-core-804.html new file mode 100644 index 00000000..c61a5c6a --- /dev/null +++ b/blocks-common/i-bem/__html/test/files/i-bem/gh-core-804.html @@ -0,0 +1 @@ +
diff --git a/blocks-common/i-bem/__html/test/files/i-bem/gh-core-804.json b/blocks-common/i-bem/__html/test/files/i-bem/gh-core-804.json new file mode 100644 index 00000000..3c9f2dd0 --- /dev/null +++ b/blocks-common/i-bem/__html/test/files/i-bem/gh-core-804.json @@ -0,0 +1,60 @@ +[ +{ + "block": "b1", + "mix": { + "block": "b1", + "mods": { "m1": "v1" } + } +}, +{ + "block": "b1", + "mix": {"mods": {"m1": "v1"}} +}, +{ + "block": "b1", + "mix": { + "block": "b2", + "mods": { "m1": "v1" } + } +}, +{ + "block": "b1", + "elem": "e1", + "mix": [{ "block": "b1" }] +}, +{ + "block": "b2", + "mix": [{ "block": "b1", "elem": "e1" }] +}, +{ + "block": "b1", + "mix": {"elem": "e1"} +}, +{ + "block": "b1", + "elem": "e1", + "mix": {"elemMods": {"m1": "v1"}} +}, +{ + "block": "b1", + "elem": "e1", + "mix": {"mods": {"m1": "v1"}} +}, +{ + "block": "b1", + "elem": "e1", + "mix": {"elem": "e2", "elemMods": {"m2": "v2"}} +}, +{ + "block": "b1", + "elem": "e1", + "elemMods": {"m1": "v1"}, + "mix": {"elem": "e2", "elemMods": {"m2": "v2"}} +}, +{ + "block": "b1", + "elem": "e1", + "elemMods": {"m1": "v1"}, + "mix": {"elem": "e2"} +} +] diff --git a/blocks-common/i-bem/__html/test/i-bem-test.js b/blocks-common/i-bem/__html/test/i-bem-test.js index ec3462a0..5b6a01ff 100644 --- a/blocks-common/i-bem/__html/test/i-bem-test.js +++ b/blocks-common/i-bem/__html/test/i-bem-test.js @@ -47,6 +47,7 @@ suite('i-bem block and others', function() { unit('simple types regression #254', 'gh-254'); unit('applyNext in content regression #289', 'gh-289'); unit('mods redefinition #550', 'gh-550'); + unit('mix elem on same block', 'gh-core-804'); unit('block with escaping this', 'escaping-this'); test('re-entrance', function() {