-
Notifications
You must be signed in to change notification settings - Fork 2
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
Jon Q
committed
Nov 6, 2020
1 parent
e405ac8
commit 376f8d0
Showing
1 changed file
with
40 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,40 @@ | ||
/** | ||
* @jest-environment jsdom | ||
*/ | ||
|
||
import { stylisPluginCssVariables } from '../plugin'; | ||
|
||
describe('stylisPluginCssVariables', () => { | ||
beforeEach(() => { | ||
// Clear root HTML node styles | ||
document.documentElement.style = null; | ||
}); | ||
|
||
/* eslint-disable */ | ||
const baseArgs = { | ||
context: 2, | ||
content: '', | ||
selectors: ['.font'], | ||
parents: [], | ||
line: 80, | ||
column: 2, | ||
length: 10, | ||
type: 105, | ||
}; | ||
/* eslint-enable */ | ||
|
||
// in JSDOM, `window.CSS` is undefined (at least in the environment used here) | ||
// so we don't need to process supported browsers | ||
const createPlugin = () => stylisPluginCssVariables(); | ||
|
||
test('should return undefined if no fallbacks are available', () => { | ||
const plugin = createPlugin(); | ||
const args = { ...baseArgs }; | ||
args.selectors = [':root']; | ||
args.content = `--fontSize: 14px;`; | ||
|
||
const result = plugin(...Object.values(args)); | ||
|
||
expect(result).toBe(undefined); | ||
}); | ||
}); |