Skip to content

test: drop the removed shortlink field from the seo.js tests - #74

Merged
Fredxd merged 1 commit into
AppoloDev:mainfrom
Vondry:test/drop-shortlink-from-js-fixture
Oct 25, 2026
Merged

Fredxd merged 1 commit into
AppoloDev:mainfrom
Vondry:test/drop-shortlink-from-js-fixture

Conversation

@Vondry

@Vondry Vondry commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #72, which removed the Shortlink field. Since that merge, npm test fails on main:

✖ typing in the SEO shortlink input persists it
  AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
  + ''
  - 'shortlink value'

Root cause

#72 removed the Shortlink input from templates/seo.html.twig and assets/seo/seo.js, but tests/js/seo.test.mjs builds its own copy of the field's markup in jsdom. That copy still rendered #seofields-shortlink and still expected typing in it to be persisted. seo.js no longer listens to that input, so the stored value stays empty.

The PHP test added in #72 (SeoFieldScriptTest) didn't catch it because it only checks one direction: every input seo.js uses must be rendered by the template. It doesn't check that the JS test fixture matches the template.

Changes

  • tests/js/seo.test.mjs: remove shortlink from the fixture markup, the empty SEO data and the per-input "typing … persists it" tests.
  • Add a test that a shortlink value already stored in a record's SEO JSON is kept on the next save, as refactor(field): remove the Shortlink field #72 says ("Values already stored in a record's SEO JSON are kept and ignored").

No change to the extension's behaviour. The leftover shortlink line in the commented allow: example in config/config.yaml is left to #71, which removes that whole block.

Tests

AppoloDev#72 removed the Shortlink input from seo.html.twig and seo.js, but the
jsdom tests in tests/js/seo.test.mjs build their own copy of the field's
markup and still rendered #seofields-shortlink and expected typing in it
to be persisted. seo.js no longer listens to that input, so
`npm test` failed on "typing in the SEO shortlink input persists it".

SeoFieldScriptTest didn't catch this: it checks that every input the
script uses is rendered by the template, not that the JS test fixture
matches the template.

Remove shortlink from the fixture and the per-input persistence tests,
and add a test that a shortlink value already stored in a record's SEO
JSON is kept on the next save, as AppoloDev#72 promised.
@Vondry
Vondry force-pushed the test/drop-shortlink-from-js-fixture branch from 1e728ae to 30b54ea Compare October 24, 2026 19:59
@Fredxd
Fredxd merged commit f16c1dd into AppoloDev:main Oct 25, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants