Skip to content

Commit

Permalink
mix: tests update
Browse files Browse the repository at this point in the history
  • Loading branch information
mishanga committed Mar 16, 2015
1 parent 5dbc80b commit 019d45c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions test/test.mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ describe('ctx.mix()', function() {
});

it('should return mix', function() {
var mix = [{ block: 'mix' }];
var mix = { block: 'mix' };
bh.match('button', function(ctx) {
ctx.mix().should.equal(mix);
});
bh.apply({ block: 'button', mix: mix });
});

it('should set mix', function() {
it('should set single mix', function() {
bh.match('button', function(ctx) {
ctx.mix([{ block: 'mix' }]);
ctx.mix({ block: 'mix' });
});
bh.apply({ block: 'button' }).should.equal('<div class="button mix"></div>');
});

it('should set single mix', function() {
it('should set array mix', function() {
bh.match('button', function(ctx) {
ctx.mix({ block: 'mix' });
ctx.mix([{ block: 'mix' }]);
});
bh.apply({ block: 'button' }).should.equal('<div class="button mix"></div>');
});
Expand All @@ -37,7 +37,7 @@ describe('ctx.mix()', function() {
.should.equal('<div class="button mix1 mix2"></div>');
});

it('should extend user mix', function() {
it('should extend user array mix', function() {
bh.match('button', function(ctx) {
ctx.mix([{ block: 'mix' }]);
});
Expand All @@ -47,29 +47,29 @@ describe('ctx.mix()', function() {

it('should extend later declarations', function() {
bh.match('button', function(ctx) {
ctx.mix([{ block: 'mix2' }]);
ctx.mix({ block: 'mix2' });
});
bh.match('button', function(ctx) {
ctx.mix([{ block: 'mix1' }]);
ctx.mix({ block: 'mix1' });
});
bh.apply({ block: 'button' }).should.equal('<div class="button mix1 mix2"></div>');
});

it('should override later declarations with force flag', function() {
bh.match('button', function(ctx) {
ctx.mix([{ block: 'mix2' }], true);
ctx.mix({ block: 'mix2' }, true);
});
bh.match('button', function(ctx) {
ctx.mix([{ block: 'mix1' }]);
ctx.mix({ block: 'mix1' });
});
bh.apply({ block: 'button' }).should.equal('<div class="button mix2"></div>');
});

it('should override user declarations with force flag', function() {
bh.match('button', function(ctx) {
ctx.mix([{ block: 'mix' }], true);
ctx.mix({ block: 'mix' }, true);
});
bh.apply({ block: 'button', mix: [{ block: 'user-mix' }] })
bh.apply({ block: 'button', mix: { block: 'user-mix' } })
.should.equal('<div class="button mix"></div>');
});

Expand Down

0 comments on commit 019d45c

Please sign in to comment.