Commit 6e8898d
committed
test(layout): strengthen alternateHeaders tests and thread flag via resolver
Review round 2 follow-ups on PR #2804.
Tests
- Footer test now goes through sectionMetadata.footerRefs + footerContentHeightsByRId
(the real path) and asserts page.margins.bottom. The old test only checked body-top
y, which is footer-independent — stubbing getFooterHeightForPage to always return 0
left that assertion passing. Mutation-tested: forcing getVariantTypeForPage to
always return 'default' now breaks it.
- Default-only fallback test now exercises the production path (headerRefs.default +
per-rId heights) and asserts the correct outcome (y ~= 90 via the step-3 default
fallback). Old assertion of y ~= 50 codified a code path that never runs in
production because document imports always supply section refs. Mutation-tested:
removing the step-3 fallback breaks this test.
- New combined test: multi-section + titlePg + alternateHeaders, where section 2
has titlePg=true and starts on an even document page. Guards both the titlePg
interaction across a section boundary AND the documentPageNumber (not
sectionPageNumber) rule on pages 5 and 6. Mutation-tested: reverting to
sectionPageNumber breaks this test alongside the original multi-section case.
Layout engine
- getVariantTypeForPage now takes a named-params object. Two adjacent `number`
params (sectionPageNumber, documentPageNumber) are swap-vulnerable.
- JSDoc on LayoutOptions.alternateHeaders cross-references
getHeaderFooterTypeForSection in layout-bridge — the two sides must agree on
variant selection and the pointer helps future maintainers keep them in sync.
PresentationEditor
- alternateHeaders is now populated inside #resolveLayoutOptions, alongside the
other paginated-only fields (columns, sectionMetadata). The render-site spread
collapses back to the single ternary it was before, and the
`as EditorWithConverter` cast there disappears. types.ts didn't need changes —
the field was already declared on the paginated variant of ResolvedLayoutOptions
but unpopulated; it's now legitimately set by the resolver.1 parent 1cbd9bc commit 6e8898d
3 files changed
Lines changed: 131 additions & 44 deletions
File tree
- packages
- layout-engine/layout-engine/src
- super-editor/src/editors/v1/core/presentation-editor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5768 | 5768 | | |
5769 | 5769 | | |
5770 | 5770 | | |
| 5771 | + | |
| 5772 | + | |
| 5773 | + | |
| 5774 | + | |
| 5775 | + | |
5771 | 5776 | | |
5772 | 5777 | | |
5773 | 5778 | | |
5774 | 5779 | | |
5775 | | - | |
5776 | | - | |
5777 | | - | |
5778 | | - | |
| 5780 | + | |
| 5781 | + | |
| 5782 | + | |
| 5783 | + | |
| 5784 | + | |
5779 | 5785 | | |
5780 | 5786 | | |
5781 | 5787 | | |
5782 | 5788 | | |
5783 | 5789 | | |
5784 | 5790 | | |
5785 | | - | |
5786 | | - | |
5787 | | - | |
5788 | | - | |
5789 | | - | |
5790 | | - | |
5791 | | - | |
5792 | | - | |
5793 | | - | |
5794 | | - | |
5795 | | - | |
5796 | | - | |
5797 | | - | |
| 5791 | + | |
| 5792 | + | |
| 5793 | + | |
| 5794 | + | |
| 5795 | + | |
| 5796 | + | |
5798 | 5797 | | |
5799 | 5798 | | |
5800 | 5799 | | |
| 5800 | + | |
| 5801 | + | |
| 5802 | + | |
| 5803 | + | |
5801 | 5804 | | |
5802 | 5805 | | |
5803 | 5806 | | |
5804 | 5807 | | |
5805 | | - | |
5806 | | - | |
5807 | | - | |
| 5808 | + | |
| 5809 | + | |
5808 | 5810 | | |
5809 | 5811 | | |
5810 | 5812 | | |
5811 | 5813 | | |
5812 | 5814 | | |
5813 | 5815 | | |
5814 | | - | |
5815 | | - | |
5816 | | - | |
| 5816 | + | |
| 5817 | + | |
5817 | 5818 | | |
5818 | 5819 | | |
5819 | | - | |
5820 | | - | |
| 5820 | + | |
| 5821 | + | |
| 5822 | + | |
| 5823 | + | |
| 5824 | + | |
| 5825 | + | |
| 5826 | + | |
| 5827 | + | |
| 5828 | + | |
| 5829 | + | |
| 5830 | + | |
| 5831 | + | |
| 5832 | + | |
| 5833 | + | |
| 5834 | + | |
| 5835 | + | |
| 5836 | + | |
| 5837 | + | |
| 5838 | + | |
| 5839 | + | |
| 5840 | + | |
| 5841 | + | |
| 5842 | + | |
| 5843 | + | |
| 5844 | + | |
| 5845 | + | |
| 5846 | + | |
| 5847 | + | |
| 5848 | + | |
| 5849 | + | |
| 5850 | + | |
| 5851 | + | |
| 5852 | + | |
| 5853 | + | |
| 5854 | + | |
| 5855 | + | |
| 5856 | + | |
| 5857 | + | |
| 5858 | + | |
| 5859 | + | |
| 5860 | + | |
| 5861 | + | |
| 5862 | + | |
| 5863 | + | |
| 5864 | + | |
| 5865 | + | |
| 5866 | + | |
| 5867 | + | |
| 5868 | + | |
| 5869 | + | |
| 5870 | + | |
| 5871 | + | |
| 5872 | + | |
| 5873 | + | |
| 5874 | + | |
| 5875 | + | |
| 5876 | + | |
| 5877 | + | |
| 5878 | + | |
| 5879 | + | |
| 5880 | + | |
| 5881 | + | |
| 5882 | + | |
| 5883 | + | |
| 5884 | + | |
| 5885 | + | |
| 5886 | + | |
| 5887 | + | |
| 5888 | + | |
| 5889 | + | |
| 5890 | + | |
| 5891 | + | |
| 5892 | + | |
| 5893 | + | |
| 5894 | + | |
| 5895 | + | |
| 5896 | + | |
5821 | 5897 | | |
5822 | 5898 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
533 | 533 | | |
534 | 534 | | |
535 | 535 | | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
536 | 540 | | |
537 | 541 | | |
538 | 542 | | |
| |||
676 | 680 | | |
677 | 681 | | |
678 | 682 | | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
679 | 686 | | |
680 | 687 | | |
681 | 688 | | |
682 | 689 | | |
683 | 690 | | |
684 | 691 | | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
691 | 698 | | |
692 | | - | |
| 699 | + | |
693 | 700 | | |
694 | 701 | | |
695 | 702 | | |
696 | 703 | | |
697 | | - | |
698 | | - | |
| 704 | + | |
| 705 | + | |
699 | 706 | | |
700 | 707 | | |
701 | 708 | | |
| |||
1308 | 1315 | | |
1309 | 1316 | | |
1310 | 1317 | | |
1311 | | - | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
1312 | 1324 | | |
1313 | 1325 | | |
1314 | 1326 | | |
| |||
Lines changed: 8 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4238 | 4238 | | |
4239 | 4239 | | |
4240 | 4240 | | |
4241 | | - | |
4242 | | - | |
| 4241 | + | |
| 4242 | + | |
4243 | 4243 | | |
4244 | | - | |
4245 | | - | |
4246 | | - | |
4247 | | - | |
4248 | | - | |
4249 | | - | |
4250 | | - | |
| 4244 | + | |
4251 | 4245 | | |
4252 | 4246 | | |
4253 | 4247 | | |
| |||
5416 | 5410 | | |
5417 | 5411 | | |
5418 | 5412 | | |
| 5413 | + | |
| 5414 | + | |
| 5415 | + | |
| 5416 | + | |
5419 | 5417 | | |
5420 | 5418 | | |
5421 | 5419 | | |
5422 | 5420 | | |
5423 | 5421 | | |
5424 | 5422 | | |
| 5423 | + | |
5425 | 5424 | | |
5426 | 5425 | | |
5427 | 5426 | | |
| |||
0 commit comments