Skip to content

Commit

Permalink
Simplify 'bsClass' classes mapping and validation
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKVal committed Jul 24, 2015
1 parent 69093e6 commit 96e69e4
Showing 1 changed file with 17 additions and 69 deletions.
86 changes: 17 additions & 69 deletions test/BootstrapMixinSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,76 +27,24 @@ describe('BootstrapMixin', function () {
assert.deepEqual(instance.getBsClassSet(), {});
});

it('should return "col"', function () {
let instance = ReactTestUtils.renderIntoDocument(
<Component bsClass='column'>
content
</Component>
);
assert.deepEqual(instance.getBsClassSet(), {'col': true});
});

it('should return "btn"', function () {
let instance = ReactTestUtils.renderIntoDocument(
<Component bsClass='button'>
content
</Component>
);
assert.deepEqual(instance.getBsClassSet(), {'btn': true});
});

it('should return "btn-group"', function () {
let instance = ReactTestUtils.renderIntoDocument(
<Component bsClass='button-group'>
content
</Component>
);
assert.deepEqual(instance.getBsClassSet(), {'btn-group': true});
});

it('should return "label"', function () {
let instance = ReactTestUtils.renderIntoDocument(
<Component bsClass='label'>
content
</Component>
);
assert.deepEqual(instance.getBsClassSet(), {'label': true});
});

it('should return "alert"', function () {
let instance = ReactTestUtils.renderIntoDocument(
<Component bsClass='alert'>
content
</Component>
);
assert.deepEqual(instance.getBsClassSet(), {'alert': true});
});

it('should return "input-group"', function () {
let instance = ReactTestUtils.renderIntoDocument(
<Component bsClass='input-group'>
content
</Component>
);
assert.deepEqual(instance.getBsClassSet(), {'input-group': true});
});

it('should return "form"', function () {
let instance = ReactTestUtils.renderIntoDocument(
<Component bsClass='form'>
content
</Component>
);
assert.deepEqual(instance.getBsClassSet(), {'form': true});
});
it('maps and validates OK default classes', function () {
function instanceClassSet(bsClass) {
let instance = ReactTestUtils.renderIntoDocument(
<Component bsClass={bsClass}>
content
</Component>
);
return instance.getBsClassSet();
}

it('should return "panel"', function () {
let instance = ReactTestUtils.renderIntoDocument(
<Component bsClass='panel'>
content
</Component>
);
assert.deepEqual(instance.getBsClassSet(), {'panel': true});
assert.deepEqual(instanceClassSet('column'), {'col': true});
assert.deepEqual(instanceClassSet('button'), {'btn': true});
assert.deepEqual(instanceClassSet('button-group'), {'btn-group': true});
assert.deepEqual(instanceClassSet('label'), {'label': true});
assert.deepEqual(instanceClassSet('alert'), {'alert': true});
assert.deepEqual(instanceClassSet('input-group'), {'input-group': true});
assert.deepEqual(instanceClassSet('form'), {'form': true});
assert.deepEqual(instanceClassSet('panel'), {'panel': true});
});

describe('Predefined Bootstrap styles', function () {
Expand Down

0 comments on commit 96e69e4

Please sign in to comment.