Permalink
Browse files

Inital add of lg functions with column logic

  • Loading branch information...
peterramsing committed Nov 11, 2016
1 parent 98f1993 commit 9699bfc7e092ff6e2df00fc7861ac5a50c636c8b
Showing with 37 additions and 0 deletions.
  1. +15 −0 lib/_lg-logic.js
  2. +22 −0 test/lg-logic.js
View
@@ -0,0 +1,15 @@
module.exports = {
columnLogic: function(columnFraction, gutter, rounder) {
let widthValue = '';
let gutterLogic = '';
if (gutter !== 0) {
gutterLogic = ` - (${gutter} - ${gutter} * ${columnFraction})`;
}
widthValue = `calc(${rounder}% * ${columnFraction}${gutterLogic})`;
return widthValue
}
};
View
@@ -0,0 +1,22 @@
'use strict'
const expect = require('chai').expect;
const lgLogic = require('../lib/_lg-logic.js');
describe('columnLogic works as it should', () => {
it('gutter and rounder ✅', () => {
const foo = lgLogic.columnLogic('1/3', 30, 100);
const expectedResult = `calc(100% * 1/3 - (30 - 30 * 1/3))`;
expect(foo).to.equal(expectedResult);
});
it('no gutter ✅', () => {
const foo = lgLogic.columnLogic('1/3', 0, 99.9);
const expectedResult = `calc(99.9% * 1/3)`;
expect(foo).to.equal(expectedResult);
});
});

0 comments on commit 9699bfc

Please sign in to comment.