Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table of Contents block: add end-to-end tests for complex behaviors #41032

Open
9 tasks
ZebulanStanphill opened this issue May 12, 2022 · 1 comment
Open
9 tasks
Labels
[Block] Table of contents (experimental) Affects the Table of contents Block Needs Dev Ready for, and needs developer efforts [Type] Task Issues or PRs that have been broken down into an individual action to take

Comments

@ZebulanStanphill
Copy link
Member

The Table of Contents block is rather complex, and it would be wise to add some end-to-end tests to prevent any regressions in the future.

Behaviors in need of a test:

  • Inserting a ToC in a post already containing Heading blocks cause the ToC to be filled with the pre-existing headings.
  • Heading blocks inserted into a post with a ToC automatically update the list of headings in the ToC.
  • Changing the text, anchor, or order of any headings listed in the ToC should automatically update it.
  • Altering Headings in a post with a ToC should not break the Undo behavior. (Note that technically, it currently does sorta break the behavior; see Table of Contents: fix undo history quirk #41031.)
  • Inserting a ToC in a post already containing Heading blocks cause the Heading blocks to be given auto-generated anchors/ids, regardless of whether the option to always use those is enabled or not.
  • Heading blocks inserted into a post with a ToC automatically get an auto-generated anchor/id, regardless of whether the editor preference to always use those is enabled.
  • The links generated by a ToC in an unpaginated post should match the expected format.
  • The links generated by a ToC in a paginated post (one containing Page Breaks separating Headings) should match the expected format.
  • The "Only include current page" option should limit the ToC's list to the headings on the same page of the post as the ToC.

If anyone wants to tackle these, then thank you, and I'll make sure to help review and merge the PRs. 🙂

@ZebulanStanphill ZebulanStanphill added [Type] Task Issues or PRs that have been broken down into an individual action to take Needs Dev Ready for, and needs developer efforts [Block] Table of contents (experimental) Affects the Table of contents Block labels May 12, 2022
@mahnunchik
Copy link

I have the same question as a year ago: how to enable still experimental Table of Contents block?

I'm running wordpress 6.1.1 but there is no ToC block in post editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Table of contents (experimental) Affects the Table of contents Block Needs Dev Ready for, and needs developer efforts [Type] Task Issues or PRs that have been broken down into an individual action to take
Projects
None yet
Development

No branches or pull requests

2 participants