-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(650): Added tests for friendly class names.
- Loading branch information
1 parent
fba8bb5
commit 72d7c8c
Showing
3 changed files
with
38 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { createStitches } from '../src/index.js' | ||
|
||
describe('Generate human-legible class names', () => { | ||
test('Class name includes "wrapper"', () => { | ||
const { css } = createStitches() | ||
|
||
const wrapper = css({}, "wrapper") | ||
expect(wrapper.className).toBe('c-wrapper-PJLV') | ||
}) | ||
|
||
test('Class name includes "heading"', () => { | ||
const { css } = createStitches() | ||
|
||
const heading = css({}, "heading") | ||
expect(heading.className).toBe('c-heading-PJLV') | ||
}) | ||
}) |
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,19 @@ | ||
import { createStitches } from '../src/index.js' | ||
|
||
describe('Generate human-legible class names', () => { | ||
test('Renders a DIV with "Wrapper" in its class name', () => { | ||
const { styled } = createStitches() | ||
|
||
const Wrapper = styled('div', {}, "Wrapper") | ||
const expression = Wrapper.render() | ||
expect(expression.props.className).toBe("c-Wrapper-PJLV") | ||
}) | ||
|
||
test('Renders an H1 with "Heading" in its class name', () => { | ||
const { styled } = createStitches() | ||
|
||
const Heading = styled('h1', {}, "Heading") | ||
const expression = Heading.render() | ||
expect(expression.props.className).toBe("c-Heading-PJLV") | ||
}) | ||
}) |