kentcdodds / kentcdodds/jest-glamor-react

Is there any ways to get style for pseudo-class?

Open
#35 6 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
JavaScript
Stars
97
Forks
21
PR merge metrics
No merged PRs in 30d

Description

* `jest-glamor-react` version: v4.2.1
* `node` version: v8.9.4
* `npm` (or `yarn`) version: v5.6.0

Relevant code or config

```javascript
const TestComp = glamorous.div({
'::after': {
backgroundColor: 'white',
},
});

it('should have white background', () => {
const component = enzyme.shallow();
expect(component).toHaveStyleRule(/* What should I do ??? */);
});
```

What you did:
Try to test pseudo-class style

What happened:
No way to test it

Problem description:

Suggested solution:
Add some matchers? or add functions to the matcher?

Contributor guide

Open the contributing guide

Research direction

Start from the shown toHaveStyleRule matcher call and the glamorous.div example using ::after. Trace how style rules are currently asserted, then define and verify a pseudo-class or pseudo-element assertion whose expected result is demonstrated by a passing test for the white background.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.