Files
odysseus/tests/test_editor_swatches_hex.py
T
pewdiepie-archdaemonandClaude Opus 5.5 5fac693c1c feat(photo-editor): Ajax Image Editor client (Photoshop-parity tools)
Photoshop-parity editor client: layers, selection/masking, brushes,
smart filters, LUT import, Quick Edit, mobile gestures, workspaces,
batch operations, and the service-worker versioning (v978->v1006).

Source: vendor/photocraft (ad1cff44) photo-editor client files, merged
onto upstream/dev (a8c147b2). Conflict resolution documented in
pr_work/A_conflicts.md; editor files taken from vendor/photocraft
(upstream's editor is an earlier snapshot of the same feature).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 11:57:35 +00:00

68 lines
2.2 KiB
Python

"""Swatches panel: inline picker + hex field + suggestions/recent (no big swatch)."""
import re
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
def _read(rel):
return (ROOT / rel).read_text(encoding="utf-8")
def test_swatch_input_is_not_shown():
js = _read("static/js/editor/panels/panels.js")
assert "swatchBody.appendChild(colorInput);" not in js
# The popover trigger is gone with it.
assert "attachColorPicker(colorInput)" not in js
def test_hex_code_field_is_wired():
js = _read("static/js/editor/panels/panels.js")
assert "const hexRow = el('div', 'ge-hex-row');" in js
assert "const hexInput = el('input', 'ge-hex-input');" in js
assert "hexRow.append(hexHash, hexInput);" in js
assert "swatchBody.appendChild(hexRow);" in js
assert "const _setHex = (hex) => {" in js
assert "hexInput.addEventListener('input'," in js
def test_inline_picker_and_suggestions_still_present():
js = _read("static/js/editor/panels/panels.js")
assert "const picker = el('div', 'ge-inline-picker');" in js
assert "'ge-swatch-row ge-swatch-suggest'" in js
assert "'ge-swatch-row ge-swatch-recent'" in js
def test_hex_css_present():
css = _read("static/css/13-image-editor.css")
assert ".ge-hex-row {" in css
assert ".ge-hex-hash {" in css
assert ".ge-hex-input {" in css
def test_adjustment_grid_is_tightened():
css = _read("static/css/13-image-editor.css")
idx = css.index(".ge-adjustment-grid {")
block = css[idx:idx + 160]
assert "gap: 3px;" in block
assert "padding: 4px 6px;" in block
def test_colour_pickers_forced_round():
css = _read("static/css/documents-gallery-editor.css")
assert "input.ge-color-picker," in css
assert "input.ge-color-picker::-webkit-color-swatch {" in css
assert "border-radius: 50% !important;" in css
def test_dock_undock_controls_removed():
js = _read("static/js/editor/build/dock.js")
assert "ge-dock-tab-pop" not in js
assert "ge-dock-detach" not in js
def test_sw_cache_name_versioned():
m = re.search(r"CACHE_NAME = '([^']+)'", _read("static/sw.js"))
assert m and re.fullmatch(r"odysseus-v\d+-pr40-editor-precache", m.group(1))