Skip to content

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

@ZebulanStanphill

Description

@ZebulanStanphill

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. 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs DevReady for, and needs developer efforts[Block] Table of contents (experimental)Affects the Table of contents Block[Type] TaskIssues or PRs that have been broken down into an individual action to take

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions