Repository navigation
test: cover handler-free device row and sites filter markup - #395
Merged
Merged
Conversation
The coverage gate for #394 reported 0/5 changed lines in lib/mactrack_functions.php: the rescan icon in mactrack_format_device_row() and the filter selects in mactrack_site_filter(). Add unit tests that render both and assert the class/data-attribute hooks, the absence of inline onClick/onChange attributes, and the $(function() {}) bindings. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The remaining shared-stub placement concern is non-blocking, with no demonstrated functional failure.
1 open finding
What changed in this PR
Adds regression coverage for shared markup changed in #394’s inline-handler removal.
Changes:
- Tests rescan hooks for enabled devices and their absence for disabled devices.
- Checks sites-filter control IDs, event bindings, and absence of inline handlers.
| File | Description |
|---|---|
| tests/Unit/MactrackInlineHandlerMarkupTest.php | Adds three device-row and sites-filter markup tests. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
xmacan
approved these changes
Oct 16, 2026
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.

Follow-up to #394, whose "Enforce coverage of changed lines" check failed on all PHP versions with
Patch coverage: 0.00% (0/5 lines). The uncovered lines were inlib/mactrack_functions.php:mactrack_format_device_row()mactrack_site_filter()Adds
tests/Unit/MactrackInlineHandlerMarkupTest.php, which renders both and asserts:class='mactrackRescanDevice'anddata-device-id, with noonclickonchange/onclickattributes, all control ids are present, and the$(function() {})block binds thechange/clickhandlersThe page entry points are already in the patch-coverage allowlist, so no change to
patch-coverage.phpis needed.Validated locally with PHPUnit 10.5 in a scratch Cacti layout: the new test passes (3 tests), as do the other class-based tests (81 total). The Pest-style tests were not run locally; CI will run them.