developit / developit/preact-jsx-chai

Indentation works against `contains` test

Open
#43 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
56
Forks
7
PR merge metrics
No merged PRs in 30d

Description

I found myself testing a `component` with nested components which I decided to mock. The `component` also returns a "lot" of html. That is why I decided to test the component contains certain pieces instead of for equality.

This is a valid example of the issue:
```
class MyComponent extends Component {
render({imgUrl}) {
return (




)
}
}

expect().to.contain(

)
```
The test will fail due to rendering of `MyComponent` vs. the contained render indents differ. See:
`MyComponent` output:
```





```
Test JSX output:
```

```
I think the easiest fix is to prevent indentation when using `contains` test. Output will not look nice but would still allow to have the test passing.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.