JS coverage csv + rereg-frontend (Sprint 1 — partial) - #180
Merged
Conversation
…rtial)
6 tests for the two largest remaining critical-path frontend files.
Both are large IIFEs (668 + 507 LOC) with extensive internal state and
many bail points; deep coverage requires fixtures matching every
querySelector. This sprint focuses on (a) load-side smoke and (b) the
clearest delegate handlers.
Coverage:
- ffc-csv-download.js: 0% → 24.70% lines.
- ffc-reregistration-frontend.js: 0% → 22.28% lines.
- Overall: 46.56% → 49.06%.
What's covered:
ffc-csv-download (3):
- Bails when .ffc-public-csv-download container is absent.
- Initialises against minimal fixture without throwing.
- Form submit interception fires $.ajax (ffc_public_csv_info call).
ffc-reregistration-frontend (3):
- Loads without throwing on a page with no banner buttons.
- .ffc-rereg-open-form click triggers $.post (loadForm AJAX).
- Loads cleanly when the page has rereg form fixtures.
Deferred: deeper batched-export flow (ffc_public_csv_start →
ffc_public_csv_batch → ffc_public_csv_download), cert preview modal,
form save-draft / submit / cancel handlers in reregistration-frontend.
Each needs targeted fixtures + AJAX state machinery.
The reregistration-frontend AJAX uses jQuery's `$.post(...).fail(...)`
chain — tests stub $.post with `{ done, fail, always }` chainable to
keep the call from blowing up.
https://claude.ai/code/session_01HiExaniSqvNBLpVTszCLNx
Sprint 1 added 6 tests for ffc-csv-download (0→25%) and ffc-reregistration-frontend (0→22%), taking overall line coverage 46.56% → 49.06%. Floor moves 44 → 47, preserving the ~2% buffer. https://claude.ai/code/session_01HiExaniSqvNBLpVTszCLNx
rpgmem
marked this pull request as ready for review
May 12, 2026 19:31
5 tasks
rpgmem
added a commit
that referenced
this pull request
May 12, 2026
#185) Lifts overall JS line coverage 59.30% → 66.61% by deep-covering the two largest public-facing scripts that previously had only load-side smoke tests from #180. Floor in lint.yml ratcheted 57 → 64 to lock the gain. Bugs found and fixed in production code: - assets/js/ffc-reregistration-frontend.js:304 — `$.trim()` was removed in jQuery 4 and threw TypeError on every blur. Replaced with native `String.prototype.trim()` via `($field.val() || '').trim()`. - assets/js/ffc-reregistration-frontend.js:471 — selector `[name^="fields["]` worked in jQuery 3 but jQuery 4's stricter attribute-value parser rejects the unescaped `[`. The selector silently returned an empty set, breaking save-draft and submit since `getFields()` returned `{}`. Switched to `[name^="fields"]` (every rereg field is named `fields[…]` so the bare prefix is sufficient). New tests: - tests/js/csv-download-deep.test.js (19 tests): onSubmitInfo (success / response-not-success / network error / disabled button while validating / no-end-date alert / disabled download button branches), download flow (start → batch → batch(done) → iframe + complete status / start fails / batch fails string + object data / batch network error), cert preview (success → modal + placeholder substitution / preview failure / network error / close on X / close on Escape), back button reload, CPF mask helper integration. ffc-csv-download.js: 24.7% → 90.26%. - tests/js/reregistration-frontend-deep.test.js (36 tests): loadForm AJAX flow (panel creation, dashboard prepend, body fallback, success / failure / fallback message / network error), input masks (cpf / phone / cep / rf / number / cin), blur validation (required / cpf / email / phone / custom_regex / invalid regex skip), divisão→setor cascade (valid map / no children / malformed JSON), acúmulo de cargos toggle, dependent selects (parent change populates child + hidden JSON / child change updates hidden / malformed JSON), save draft (success / failure / network), submit (required guard / success replaces form + slides banner / server errors mapped to fields / network error), cancel slides up + empties panel, working hours add/remove inside rereg form. ffc-reregistration-frontend.js: 22.28% → 96.09%. Tests: 411 → 466 (+55). lint.yml floor: 57 → 64. Co-authored-by: Claude <noreply@anthropic.com>
rpgmem
pushed a commit
that referenced
this pull request
May 13, 2026
Bumps:
- ffcertificate.php plugin header `Version` → 6.5.3
- FFC_VERSION constant → 6.5.3
- readme.txt Stable tag → 6.5.3
CHANGELOG: collapses the Unreleased block into a 6.5.3 (2026-05-13)
section and adds the items merged since 6.5.2 that the prior diff was
missing:
Changed:
- thumbmarkjs 1.8.1 → 1.9.0 (this PR)
- jQuery UI theme 1.14.1 → 1.14.2 (this PR)
- Recruitment CSV import: CPF/RF normalisation at parse time
(#172, shipped via #182).
Fixed:
- Form-editor groups 7/8 toggle-off persistence (already on
Unreleased; kept).
- Form-editor public CSV CPF "No" reverting to "Audit" (already on
Unreleased; kept).
- Reregistration form: $.trim() TypeError under jQuery 4 (#185).
- Reregistration form: [name^="fields["] selector rejected under
jQuery 4, getFields() returned {} (#185).
Internal:
- JS coverage uplift 7.37% → 72.84% across multiple sprints
(#162 / #164 / #166 / #168-#171 / #174-#180 / #183-#186),
floor ratcheted 3 → 70.
- Coverage job timeout 15 → 20 min (#181).
- The 9 pre-existing ESLint no-unused-vars warnings cleared (#188).
- CLAUDE.md added documenting auto-merge convention + CI gates +
test-infrastructure notes (#187).
rpgmem
added a commit
that referenced
this pull request
May 13, 2026
…1 → 1.14.2 (#189) * chore(deps): bump thumbmarkjs 1.8.1 → 1.9.0 and jQuery UI theme 1.14.1 → 1.14.2 Two upstream patch bumps that keep the API/CSS surface this plugin relies on: thumbmarkjs 1.8.1 → 1.9.0: - New vendored bundle: `libs/js/thumbmark-1.9.0.umd.js` (33 KB). - Old bundle removed. - `FFC_THUMBMARK_VERSION` bumped; `Frontend::enqueue_*` resolves the filename from the constant so the enqueue call updates automatically. - Surface used by `assets/js/ffc-device-signals.js` (`window.ThumbmarkJS.setOption('logging', false)`, `stableStringify`, `getFingerprintData()`) verified present in the new bundle and exercised by the existing JS suites (device-signals-deep.test.js / device-signals-and-frontend.test.js) — both still pass. - `DeviceSignalsLoggingOffTest::test_vendored_thumbmarkjs_present_at_pinned_path` path + redownload-URL hint updated to track the new bundle. jQuery UI theme 1.14.1 → 1.14.2: - `libs/css/jquery-ui-smoothness.css` replaced with the 1.14.2 release. - The CSS payload is byte-identical between the two upstream releases; the diff is just the file-header comment moving to `v1.14.2 - 2026-01-28`. Visible change for users is the cache-bust version string `wp_enqueue_style` emits. - `FFC_JQUERY_UI_VERSION` bumped to `'1.14.2'`. Tests: 3893 PHP + 487 JS still green. * release: 6.5.2 → 6.5.3, consolidate CHANGELOG for the maintenance cut Bumps: - ffcertificate.php plugin header `Version` → 6.5.3 - FFC_VERSION constant → 6.5.3 - readme.txt Stable tag → 6.5.3 CHANGELOG: collapses the Unreleased block into a 6.5.3 (2026-05-13) section and adds the items merged since 6.5.2 that the prior diff was missing: Changed: - thumbmarkjs 1.8.1 → 1.9.0 (this PR) - jQuery UI theme 1.14.1 → 1.14.2 (this PR) - Recruitment CSV import: CPF/RF normalisation at parse time (#172, shipped via #182). Fixed: - Form-editor groups 7/8 toggle-off persistence (already on Unreleased; kept). - Form-editor public CSV CPF "No" reverting to "Audit" (already on Unreleased; kept). - Reregistration form: $.trim() TypeError under jQuery 4 (#185). - Reregistration form: [name^="fields["] selector rejected under jQuery 4, getFields() returned {} (#185). Internal: - JS coverage uplift 7.37% → 72.84% across multiple sprints (#162 / #164 / #166 / #168-#171 / #174-#180 / #183-#186), floor ratcheted 3 → 70. - Coverage job timeout 15 → 20 min (#181). - The 9 pre-existing ESLint no-unused-vars warnings cleared (#188). - CLAUDE.md added documenting auto-merge convention + CI gates + test-infrastructure notes (#187). --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sprint 1 of the JS coverage roadmap — last critical-path frontend block.
Summary
6 tests for the two largest remaining 0%-covered files:
ffc-csv-download.js(668 LOC): public CSV download flow — bail/init smoke + form-submit interception.ffc-reregistration-frontend.js(507 LOC): reregistration form load + open-form delegate.Below the original ~40-test target because both IIFEs have extensive internal state with many bail points; deep coverage requires fixtures matching every querySelector. Sprint focuses on smoke + the cleanest delegate handlers, deferring batched-export AJAX flow + form save/submit handlers.
Coverage delta
ffc-csv-download.jsffc-reregistration-frontend.jsJS_COVERAGE_FLOOR_LINESWhat's covered
.ffc-rereg-open-formclick →$.post(loadForm); rereg-form fixture loads cleanly.Test plan
npm run test:js— 292 / 292 OK (was 286).npm run test:js:coverage— line coverage 49.06%, gate (floor 47) passes.npm run lint:js— clean.Roadmap status
This closes the roadmap user requested (4 → 3 → 2 → 1):
JS coverage went from 30.09% (post-#174) to 49.06% — almost a 20-point jump across the four sprints. Tests grew from 208 to 292.
What's deferred (future PRs)
ffc-csv-download.jsdeeper paths: cert preview modal, batched export AJAX state machine, download-iframe trigger.ffc-reregistration-frontend.jsdeeper paths: input masks, dependent selects, form save-draft / submit / cancel.ffc-pdf-generatoretc. (already excluded via Sprint L: exclude architecturally-untestable JS from coverage (#165) #166).https://claude.ai/code/session_01HiExaniSqvNBLpVTszCLNx
Generated by Claude Code