Skip to content

Add a CLI flag for click-to-highlight BOM rows - #598

Open
louisss1016 wants to merge 1 commit into
openscopeproject:masterfrom
louisss1016:fix/597-highlight-row-on-click
Open

louisss1016 wants to merge 1 commit into
openscopeproject:masterfrom
louisss1016:fix/597-highlight-row-on-click

Conversation

@louisss1016

Copy link
Copy Markdown

Problem

The generated BOM already lets readers switch from hover to click highlighting, but a CLI export cannot set the initial mode.

Change

--highlight-row-on-click sets click highlighting as the default for the generated page. The existing hover default applies when the flag is omitted, including for config data that lacks the new key. Saved browser preferences still take precedence.

Refs #597 for the CLI request.

Verification

  • Ubuntu 24.04, Python 3.12.3, KiCad 7.0.11, wxPython 4.2.1. python3 -m pytest -vv tests passed 16/16 before and 18/18 after. With only the new tests applied, the flagged export failed with argparse's unrecognized-argument error.
  • Chromium 156 checked generated BOMs with the flag, without it, with a missing config key, and with saved preferences in both directions. The click and hover row handlers, the live checkbox, and its value after reloading matched the expected behavior.
  • Ruff correctness checks, node --check InteractiveHtmlBom/web/util.js, git diff --check, and the Hatchling wheel build passed. A full mypy comparison reported the same 37 existing diagnostics before and after.

AI assistance was used for implementation and verification.

nargs='?',
help='Highlight first pin.')
parser.add_argument('--highlight-row-on-click',
help='Highlight BOM rows on click by default.',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change help string to indicate what default behavior is:
Highlight BOM rows on click (default is highlight on hover).

Comment thread tests/test_module.py
import InteractiveHtmlBom # noqa


@pytest.mark.parametrize('args, expected', [([], False), (['--highlight-row-on-click'], True)])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is misplaced and is more like an integration test.

Add test_config.py and write it as a proper unit test that doesnt start any child processes.

This branch has not been deployed

No deployments
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