Skip to content

Commit

Permalink
Added spacing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroPerezMartin committed Jan 4, 2018
1 parent b7da9d7 commit 34a8055
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/expected/spacing.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions test/fixtures/spacing.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
body {
padding: var(--spacing-sm) var(--spacing-md) var(--spacing-lg) var(--spacing-xl);
margin: var(--spacing-xs);
width: var(--spacing-none);
}
55 changes: 55 additions & 0 deletions test/spacing.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const tap = require('tap');
const ClientKitCss = require('../');
const utils = require('./utils');

tap.test('spacing vars', (t) => {
const css = new ClientKitCss('spacing', {
spacing: {
default: {
xl: '40px',
lg: '30px',
md: '25px',
sm: '20px',
xs: '10px'
},
mobile: {
xl: '41px',
lg: '31px',
md: '25px',
sm: '21px',
xs: '11px'
}
}
});
t.deepEqual(css.cssVars, {
'spacing-xl': '40px',
'spacing-lg': '30px',
'spacing-md': '25px',
'spacing-sm': '20px',
'spacing-xs': '10px'
});
t.end();
});

tap.test('spacing vars in css', (t) => {
const css = new ClientKitCss('spacing', {
files: {
'test/out/spacing.css': 'test/fixtures/spacing.css'
},
spacing: {
default: {
none: 0,
xl: '40px',
lg: '30px',
md: '25px',
sm: '20px',
xs: '10px'
}
}
});
css.execute((err, results) => {
t.equal(err, null);
utils.checkOutput(t, 'spacing.css');
t.end();
});
});

0 comments on commit 34a8055

Please sign in to comment.