Conversation
|
Ha wow! Great! Sorry that I missed it for all this time but I will check it out right away! |
There was a problem hiding this comment.
I see a failing test. I am pretty sure they were all working before.
Maybe there is a very good reason for this test failing. Presumably it works in your program... Can you review the test and let me know if you understand why it's failing and if that is to be expected and why?
EDIT: I think maybe the test is failing on some irrelevant extra 'junk' that is in the VNodes that was not there in older versions... It seems it might be harmless. Still I would like you to investigate and let me know.
Did you run the tests? Be honest! 😉
stijn@Stijns-MacBook-Pro preact-layout % npm run test
...
FAIL test/Layout.spec.jsx
● preact-layout › getSections(vnode) › accepts a vnode (or array of vnodes) and returns any sections found in it
expect(received).toEqual(expected)
Expected value to equal:
{"main": {"__": null, "__b": 0, "__c": null, "__d": undefined, "__e": null, "__h": null, "__k": null, "__v": 524, "constructor": undefined, "key": undefined, "props": {"children": undefined}, "ref": undefined, "type": [Function Section]}, "sections": [{"__": null, "__b": 0, "__c": null, "__d": undefined, "__e": null, "__h": null, "__k": null, "__v": 521, "constructor": undefined, "key": undefined, "props": {"children": {"__": null, "__b": 0, "__c": null, "__d": undefined, "__e": null, "__h": null, "__k": null, "__v": 520, "constructor": undefined, "key": undefined, "props": {"children": "header"}, "ref": undefined, "type": "b"}, "type": [Function Header]}, "ref": undefined, "type": [Function Section]}, {"__": null, "__b": 0, "__c": null, "__d": undefined, "__e": null, "__h": null, "__k": null, "__v": 523, "constructor": undefined, "key": undefined, "props": {"children": {"__": null, "__b": 0, "__c": null, "__d": undefined, "__e": null, "__h": null, "__k": null, "__v": 522, "constructor": undefined, "key": undefined, "props": {"children": "footer"}, "ref": undefined, "type": "i"}, "type": [Function Footer]}, "ref": undefined, "type": [Function Section]}]}
Received:
{"main": {"__": null, "__b": 0, "__c": null, "__d": undefined, "__e": null, "__h": null, "__k": null, "__v": 514, "constructor": undefined, "key": undefined, "props": {"children": undefined}, "ref": undefined, "type": [Function Section]}, "sections": [{"__": null, "__b": 0, "__c": null, "__d": undefined, "__e": null, "__h": null, "__k": null, "__v": 512, "constructor": undefined, "key": undefined, "props": {"children": {"__": null, "__b": 0, "__c": null, "__d": undefined, "__e": null, "__h": null, "__k": null, "__v": 511, "constructor": undefined, "key": undefined, "props": {"children": "header"}, "ref": undefined, "type": "b"}, "type": [Function Header]}, "ref": undefined, "type": [Function Section]}, {"__": null, "__b": 0, "__c": null, "__d": undefined, "__e": null, "__h": null, "__k": null, "__v": 516, "constructor": undefined, "key": undefined, "props": {"children": {"__": null, "__b": 0, "__c": null, "__d": undefined, "__e": null, "__h": null, "__k": null, "__v": 515, "constructor": undefined, "key": undefined, "props": {"children": "footer"}, "ref": undefined, "type": "i"}, "type": [Function Footer]}, "ref": undefined, "type": [Function Section]}]}
...
preact-layout
✓ exports `Layout`, `Section`, `getSections`, `isContribution` and `processNode`
Layout & Section
✓ allows children from the main section to contribute components to other sections of the layout (1ms)
✓ allows for the layout to be componentized separately
✓ allows contributions from nested children (1ms)
✓ recurses 9 levels by default
✓ allows the recursion depth to be set on the layout (1ms)
✓ allows contribution functions to be used across multiple layouts
✓ works with component classes as well
getSections(vnode)
❌ accepts a vnode (or array of vnodes) and returns any sections found in it (3ms)
✓ does not render any components found (shallow search)
isContribution(vnode, sections)
✓ accepts a single vnode and an array of sections
✓ returns true if the vnode is a contribution for any of the given sections
Test Suites: 1 failed, 1 total
Tests: 1 failed, 11 passed, 12 total
Snapshots: 0 total
Time: 0.549s
Ran all test suites.
...|
Hello! I can confirm that the tests were all working before. I used the tests while I was developing to make sure I was on the right track. I wasn't able to get 100% of them passing but it is very close. I think you might be right about the VNodes appearing places they might not have in earlier versions -- I'll do some digging |
added changes to make preact-layout compatible with preact 10.x