Skip to content

Tests: unit coverage plus the unresolvable-reference e2e cases #758

Description

@romain-pm

Part of #749.

  • Vitest over getLinkProps and resolveContentLink: falsy target, "" and whitespace-only string, string target, scheme allow-list — accept http https mailto tel ftp / #, reject javascript: data: blob: vbscript:target validation and omission, rel on _blank, isCurrent vs isAncestor (including /home/news vs /home/newsletter, and two distinct proxies for the same node, which must compare equal), isCurrent override, label fallback, parameters + hash ordering on node and string targets, missing translation.
  • Unit test asserting no LinkState key (navigable, isCurrent, isAncestor, label) reaches the DOM.
  • Unit test asserting the label agrees with getDisplayableName() for jnt:page, nt:file and an untitled node.
  • Cypress: publish a link whose target is not published, assert the page renders the fallback and no <!-- Module error appears. No test exercises an unresolvable reference today — getNodePropsTest.cy.ts:109-111 only asserts the happy path for a weakreference.
  • Cypress: rename the target of a rendered link, assert the cached fragment is flushed.
  • Cypress: publish a previously-dangling target and assert the fallback fragment is flushed — this is what the { uuid } dependency form buys, and { node } cannot.
  • Cypress: render the same nav on two pages via an AbsoluteArea and assert aria-current follows the page (the cache.mainResource case).
  • Page-builder case: a <JLink> in the builder must emit an /cms/editframe/… href, so a click navigates the builder instead of opening a new tab. Assert on the delivered DOM, not the component output — EditModeFilter rewrites both the href and target.

Unit coverage landed in #751 (105 cases); the Cypress cases still need a running instance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featA new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions