-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: failing test for color modifier references
- Loading branch information
1 parent
3c9a53e
commit ccf01c3
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
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 @@ | ||
import { expect } from '@esm-bundle/chai'; | ||
import StyleDictionary from 'style-dictionary'; | ||
import { promises } from 'fs'; | ||
import path from 'path'; | ||
import { cleanup, init } from './utils.js'; | ||
|
||
const outputDir = 'test/integration/tokens/'; | ||
const outputFileName = 'vars.css'; | ||
const outputFilePath = path.resolve(outputDir, outputFileName); | ||
|
||
const cfg = { | ||
source: ['test/integration/tokens/color-modifier-references.tokens.json'], | ||
platforms: { | ||
css: { | ||
transformGroup: 'tokens-studio', | ||
prefix: 'sd', | ||
buildPath: outputDir, | ||
files: [ | ||
{ | ||
destination: outputFileName, | ||
format: 'css/variables', | ||
}, | ||
], | ||
}, | ||
}, | ||
}; | ||
|
||
let dict: StyleDictionary.Core | undefined; | ||
|
||
describe('typography references', () => { | ||
beforeEach(() => { | ||
if (dict) { | ||
cleanup(dict); | ||
} | ||
dict = init(cfg); | ||
}); | ||
|
||
afterEach(() => { | ||
if (dict) { | ||
cleanup(dict); | ||
} | ||
}); | ||
|
||
it('supports references inside color modifiers', async () => { | ||
const file = await promises.readFile(outputFilePath, 'utf-8'); | ||
expect(file).to.include( | ||
`--sdAlpha: 0.3; | ||
--sdColor: #FFFFFF4d;`, | ||
); | ||
}); | ||
}); |
20 changes: 20 additions & 0 deletions
20
test/integration/tokens/color-modifier-references.tokens.json
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,20 @@ | ||
{ | ||
"alpha": { | ||
"value": 0.3, | ||
"type": "other" | ||
}, | ||
"color": { | ||
"value": "#FFFFFF", | ||
"type": "color", | ||
"$extensions": { | ||
"studio.tokens": { | ||
"modify": { | ||
"type": "alpha", | ||
"value": "{alpha}", | ||
"space": "srgb", | ||
"format": "hex" | ||
} | ||
} | ||
} | ||
} | ||
} |