Skip to content

Commit

Permalink
Misc: initial tests for compact
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexej Yaroshevich committed Jun 24, 2015
1 parent 8c72753 commit e299015
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions test/04.compact-object.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
describe('compact object', function () {

describe('for border-radius properties', function () {

it('should compact them with 1 value', function () {
SC.compact({
'border-top-left-radius': '9px',
'border-top-right-radius': '9px',
'border-bottom-right-radius': '9px',
'border-bottom-left-radius': '9px',
}).should.eql({
'border-radius': '9px',
});
});

it('should compact them partially', function () {
SC.compact({
'border-top-left-radius': '9px',
'border-bottom-left-radius': '9px',
}).should.eql({
'border-radius': '9px none none 9px',
});
});

it('should compact them with 2 different values', function () {
SC.compact({
'border-top-left-radius': '9px',
'border-top-right-radius': '12px',
'border-bottom-right-radius': '9px',
'border-bottom-left-radius': '12px',
}).should.eql({
'border-radius': '9px 12px',
});
});

it('should compact them with 3 different values', function () {
SC.compact({
'border-top-right-radius': '5px',
'border-bottom-right-radius': '10px',
'border-bottom-left-radius': '5px',
}).should.eql({
'border-radius': 'none 5px 10px',
});
});

});

describe('simplification of the same value', function () {

it('should simplify border-width value', function () {
SC.compact({
'border-width': '2px 2px 2px',
}).should.eql({
'border-width': '2px',
});
});

it('should simplify more complex border-width to 2 values', function () {
SC.compact({
'border-width': '0px 5px 0px 5px',
}).should.eql({
'border-width': '0px 5px',
});
});

it('should strip the last border-radius value to 3 values', function () {
SC.compact({
'border-radius': '0px 5px 10px 5px',
}).should.eql({
'border-radius': '0px 5px 10px',
});
});

});

});

1 comment on commit e299015

@awinogradov
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.