Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2064 from system-ui/develop
- Loading branch information
Showing
10 changed files
with
302 additions
and
894 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
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
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
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
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,62 @@ | ||
import { Theme } from '../src' | ||
import { makeColorsScale, makeStyles, makeTheme } from '../src/utils' | ||
import { AssertTrue, expecter, IsExact } from '@theme-ui/test-utils' | ||
|
||
const symbolPretendingToBeTheme = Symbol() as Theme | ||
|
||
describe(makeTheme, () => { | ||
it('returns input unchanged', () => { | ||
const actual = makeTheme(symbolPretendingToBeTheme) | ||
expect(actual).toEqual(symbolPretendingToBeTheme) | ||
}) | ||
|
||
it('preserves type of the argument', () => { | ||
const theme = makeTheme({ | ||
colors: { | ||
primary: 'tomato', | ||
}, | ||
}) | ||
|
||
type _ = AssertTrue< | ||
IsExact<typeof theme, { colors: { primary: 'tomato' } }> | ||
> | ||
}) | ||
|
||
it('is exposed from entrypoint /utils and validates Theme type', () => { | ||
expecter('import { makeTheme } from "@theme-ui/css/utils"')( | ||
'const t = makeTheme("banana")' | ||
).toFail(/Type '"banana"' has no properties in common with type 'Theme'./) | ||
}) | ||
}) | ||
|
||
describe(makeStyles, () => { | ||
it('returns input unchanged', () => { | ||
const actual = makeTheme(symbolPretendingToBeTheme) | ||
expect(actual).toEqual(symbolPretendingToBeTheme) | ||
}) | ||
|
||
it('preserves type of the argument', () => { | ||
const styles = makeStyles({ | ||
code: {}, | ||
}) | ||
|
||
type _ = AssertTrue<IsExact<typeof styles, { code: {} }>> | ||
}) | ||
}) | ||
|
||
describe(makeColorsScale, () => { | ||
it('returns input unchanged', () => { | ||
const actual = makeTheme(symbolPretendingToBeTheme) | ||
expect(actual).toEqual(symbolPretendingToBeTheme) | ||
}) | ||
|
||
it('preserves type of the argument', () => { | ||
const colors = makeColorsScale({ | ||
blue: { | ||
light: '#e6f7ff', | ||
}, | ||
}) | ||
|
||
type _ = AssertTrue<IsExact<typeof colors, { blue: { light: '#e6f7ff' } }>> | ||
}) | ||
}) |
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 |
---|---|---|
|
@@ -93,6 +93,6 @@ | |
"@babel/register": "^7.8.6" | ||
}, | ||
"resolutions": { | ||
"@emotion/react": "11.4.0" | ||
"@emotion/react": "11.7.1" | ||
} | ||
} |
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
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
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
/* istanbul ignore file */ | ||
|
||
import { Theme } from '@theme-ui/css' | ||
|
||
const KEY_MAPPING: { | ||
|
Oops, something went wrong.
ba70dde
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: