https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38550

--- Comment #47 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 200769
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200769&action=edit
Bug 38550: Cypress smoke spec and stylelint hex guard

Adds two guard rails so the dark-mode work doesn't regress and
future contributions don't accidentally re-introduce hardcoded
hex colours in tokenised areas.

Cypress: t/cypress/integration/Theme_spec.ts

* Verifies the FOUC-killer in doc-head-open.inc has set
  data-bs-theme synchronously by the time the page is interactive.
* Round-trips each of "light" / "dark" / "auto" preferences
  through localStorage + reload and asserts the resolved theme on
  <html> matches.
* Reads the actual computed --koha-surface and --koha-on-surface
  values in light vs dark mode and asserts they differ — i.e. the
  cascade really flips, not just the attribute.
* Drives the dropdown UI: clicks Light / Dark and asserts
  aria-pressed moves between buttons and data-bs-theme follows.
* Loads four representative pages (mainpage, patrons home,
  catalogue search, admin home) in each mode and asserts the
  attribute is correct on each. cy.screenshot() is wired but
  commented — uncomment once a snapshot plugin (e.g.
  cypress-image-snapshot) is added to make this a real visual
  regression suite.

Stylelint: .stylelintrc.json overrides

* New "color-no-hex" rule scoped to staff SCSS sources, with
  severity "warning" and a message pointing reviewers at
  _root.scss / --koha-* tokens. The rule does NOT fail builds —
  many existing files still contain hex tech debt — but every
  PR diff with a fresh hex literal in a tokenised file will get
  a visible warning in CI.
* The currently-tokenised files (_mixins.scss is implicit by
  having no hex; this list covers files that intentionally hold
  the colour values) are allowed via override:
    _variables.scss, _variables-dark.scss, _root.scss,
    _flatpickr_vars.scss
* The currently-still-dirty files are also listed in the same
  override so the rule stays quiet for them until they're
  audited:
    staff-global.scss, _tables.scss, _header.scss, _flatpickr.scss,
    _forms.scss, edifact_interchange.scss, installer.scss,
    calendar.scss, holds.scss, mainpage.scss
  As each file is migrated to tokens, its entry is deleted from
  this list and the rule begins guarding it.
* OPAC SCSS (koha-tmpl/opac-tmpl/...) is intentionally OUT of
  scope: dark-mode work for the OPAC is a separate effort.

Housekeeping: _root.scss reflowed to single-space declarations
to satisfy the existing declaration-colon-space-after rule, and
the leading multi-line block comments rewritten to drop the empty
"//" continuation lines that scss/comment-no-empty flagged.

Test plan:
1) Apply patch
2) Cypress: yarn cypress run --spec
   "t/cypress/integration/Theme_spec.ts"
   All assertions should pass against a freshly-built KTD instance.
3) Stylelint demo:
     echo '.foo { color: #BADA55; }' \
       > koha-tmpl/intranet-tmpl/prog/css/src/_demo.scss
     npx stylelint koha-tmpl/intranet-tmpl/prog/css/src/_demo.scss
   Expect ⚠ (warning) for the hex literal pointing at _root.scss.
4) Stylelint clean files:
     npx stylelint koha-tmpl/intranet-tmpl/prog/css/src/_root.scss
   Expect no color-no-hex warnings.
5) When auditing one of the still-dirty files: remove its path
   from the second override block in .stylelintrc.json, run
   stylelint, fix any new warnings.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to