-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a8f21b
commit 947c836
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
body { | ||
line-height: var(--line-height); | ||
} | ||
h1 { | ||
font-family: var(--font-primary); | ||
} | ||
h2 { | ||
font-family: var(--font-secondary); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
const tap = require('tap'); | ||
const ClientKitCss = require('../'); | ||
const utils = require('./utils'); | ||
|
||
tap.test('variables', (t) => { | ||
const css = new ClientKitCss('vars', { | ||
vars: { | ||
'line-height': 1 | ||
} | ||
}); | ||
t.deepEqual(css.cssVars, { | ||
'line-height': 1 | ||
}); | ||
t.end(); | ||
}); | ||
|
||
tap.test('nested variables', (t) => { | ||
const css = new ClientKitCss('vars', { | ||
vars: { | ||
font: { | ||
primary: 'Arial', | ||
secondary: 'Helvetica' | ||
} | ||
} | ||
}); | ||
t.deepEqual(css.cssVars, { | ||
'font-primary': 'Arial', | ||
'font-secondary': 'Helvetica' | ||
}); | ||
t.end(); | ||
}); | ||
|
||
tap.test('variables in css', (t) => { | ||
const css = new ClientKitCss('css', { | ||
files: { | ||
'test/out/variables.css': 'test/fixtures/variables.css' | ||
}, | ||
vars: { | ||
'line-height': 1, | ||
font: { | ||
primary: 'Arial', | ||
secondary: 'Helvetica' | ||
} | ||
} | ||
}); | ||
css.execute((err, results) => { | ||
t.equal(err, null); | ||
utils.checkOutput(t, 'variables.css'); | ||
t.end(); | ||
}); | ||
}); |