@ripple-ts/compat-react 0.2.170 → 0.2.172

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ripple-ts/compat-react",
3
- "version": "0.2.170",
3
+ "version": "0.2.172",
4
4
  "description": "Ripple compatibility layer for React",
5
5
  "main": "src/index.js",
6
6
  "author": "Dominic Gannaway",
@@ -17,7 +17,7 @@
17
17
  "dependencies": {
18
18
  "react": "^19.2.0",
19
19
  "react-dom": "^19.2.0",
20
- "ripple": "0.2.170"
20
+ "ripple": "0.2.172"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/react": "^19.2.2",
@@ -307,7 +307,7 @@ describe('compat-react', () => {
307
307
  expect(reactContent.textContent).toBe('Provided Value');
308
308
  });
309
309
 
310
- it('should handle a React errors', async () => {
310
+ it('should handle React errors', async () => {
311
311
  function ReactChild() {
312
312
  throw new Error('Test Error');
313
313
  }
@@ -333,7 +333,7 @@ describe('compat-react', () => {
333
333
  expect(reactContent.textContent).toBe('ReactChiild had an error');
334
334
  });
335
335
 
336
- it('should handle a React errors #2', async () => {
336
+ it('should handle React errors #2', async () => {
337
337
  function ReactChild() {
338
338
  throw new Error('Test Error');
339
339
  }
@@ -364,6 +364,43 @@ describe('compat-react', () => {
364
364
  expect(reactContent).toBeTruthy();
365
365
  expect(reactContent.textContent).toBe('ReactChiild had an error');
366
366
  });
367
+
368
+ it('Should handle React context', async () => {
369
+ const DemoContext = createContext(null);
370
+
371
+ function DeepReactChild() {
372
+ const contextValue = useContext(DemoContext);
373
+ return jsx('div', { children: `Deep child, context value is: ${contextValue}` });
374
+ }
375
+
376
+ component RippleChild() {
377
+ <tsx:react>
378
+ <DeepReactChild />
379
+ </tsx:react>
380
+ }
381
+
382
+ function ReactChild() {
383
+ return jsx(Ripple, {
384
+ component: RippleChild,
385
+ });
386
+ }
387
+
388
+ component App() {
389
+ <tsx:react>
390
+ <DemoContext.Provider value={"Hello from Context!"}>
391
+ <ReactChild />
392
+ </DemoContext.Provider>
393
+ </tsx:react>
394
+ }
395
+
396
+ await act(async () => {
397
+ render(App);
398
+ });
399
+
400
+ const deepChild = container.querySelector('div');
401
+ expect(deepChild).toBeTruthy();
402
+ expect(deepChild.textContent).toBe('Deep child, context value is: Hello from Context!');
403
+ });
367
404
  });
368
405
 
369
406
  describe('Ripple in React app', () => {