Comments (8)
Hi @edorivai you can check the third item now
from react-media.
Hey, I could work on tests for the hook. Is there anything specific that I should know of before starting?
from react-media.
@0ctothorp let me push a branch that I've been working on. Transliterating the existing tests shouldn't be difficult, but the thing that I was finding hard is that testing the SSR behavior.
from react-media.
Oh, I didn't know it was being worked on already 😅
from react-media.
I've stalled out :P I would very much appreciate the help if you're willing and able.
The big thing is that for testing SSR behavior, you want to watch three states and make sure that they're all consistent with each other:
- the server-rendered markup
- the first hydration pass
- the first full render pass
In a two-pass render, you want the first two to agree, and then for the change to happen between the second and third. I'm having trouble testing this, though, because the React Testing Library doesn't really account for a desire to see the middle state and be able to compare it to the first and third states. I was working on a workaround of some sort for that when I stalled out.
from react-media.
Here's a link to the branch I've been working on:
https://github.com/tstirrat15/react-media/tree/155-testing-and-implementing-two-pass-render
And here's a link to the diff between it and current master:
It's very much a work in progress - I started writing the hydration tests by copying and pasting a bunch of existing tests, then went and started trying to solve my problem above, and I didn't get much further than that.
Tests are "passing," but that's because they're not actually capturing the desired behavior.
from react-media.
Cool, I'm going to have a look. I'm definitely not an expert in such tests, but maybe I will be able to come up with something :)
from react-media.
Awesome. Thank you so much!
from react-media.
Related Issues (20)
- Deploy process broken due to npm auth issue
- Make query and queries both valid ways to reference the props HOT 2
- Problem with SSR + query HOT 3
- Add .editorconfig file
- React-media seems to nest the component within itself
- Which browsers are supported? HOT 2
- How to forward refs/make <Media> more transparent? HOT 8
- Update TS definitions for v1.10 HOT 1
- DropdownList hover should change rw-state-focus element HOT 3
- React v16.9 support HOT 6
- support typescript? HOT 2
- Media tries to update unmounted component HOT 22
- Is height supported? HOT 1
- Add hooks to API HOT 1
- Two-pass rendering is broken in the hooks implementation HOT 10
- query and queries prop HOT 1
- kotlin wrapper
- Babel Runtime dependency
- React-media
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-media.