bem / bem-xjst

bem-xjst (eXtensible JavaScript Templates): declarative template engine for the browser and server
https://bem.github.io/bem-xjst
Other
115 stars 47 forks source link

Strange test for handling of elemMods #112

Closed tadatuta closed 8 years ago

tadatuta commented 8 years ago

Here is a test which is quite strange:

it('should restore elemMods', function() {
      test(function() {
        block('b2').content()(function() {
          return this.elemMods.a || 'yes'; // it'll always be 'yes' as b1 also has `_a_yes`
        });
      }, {
        block: 'b1',
        elemMods: {
          a: 'yes'
        },
        content: {
          block: 'b2'
        }
// why we have `b1_a_yes` while in BEMJSON it was `elemMods` (not mods)? see https://github.com/bem/bem-xjst/issues/88
      }, '<div class="b1 b1_a_yes"><div class="b2">yes</div></div>');
    });
  });

cc @veged

qfox commented 8 years ago

Guess it's a copy paste bug. ;-(

tadatuta commented 8 years ago
{
        block: 'b1',
        elemMods: {
          a: 'yes' // replace with 'no' to resolve this issue
        },
        content: {
          block: 'b2'
        }