generator: translate clickAndReadStyle() helper into dom-dispatch click
Upstream tests use clickAndReadStyle(evaluate, sel, prop) to click-and-read before asserting toHaveCSS(sel, prop, val). Emit just the click — downstream toHaveCSS checks then test the post-click state. Net: transition 6→13.
This commit is contained in:
@@ -901,6 +901,23 @@ def parse_dev_body(body, elements, var_names):
|
||||
ops.append(f'(dom-set-inner-html {target} "{val}")')
|
||||
continue
|
||||
|
||||
# clickAndReadStyle(evaluate, SEL, PROP) — upstream helper that
|
||||
# dispatches a click on SEL and returns its computed style[PROP].
|
||||
# Materialize the click; downstream toHaveCSS assertions then test
|
||||
# the post-click state. The helper call may appear embedded in a
|
||||
# larger statement (e.g. `const x = await clickAndReadStyle(...)`)
|
||||
# so we use `search`, not `match`.
|
||||
m = re.search(
|
||||
r"clickAndReadStyle\(\s*\w+\s*,\s*(['\"])([^'\"]+)\1\s*,\s*['\"][^'\"]+['\"]\s*\)",
|
||||
stmt_na,
|
||||
)
|
||||
if m and seen_html:
|
||||
sel = re.sub(r'^#work-area\s+', '', m.group(2))
|
||||
target = selector_to_sx(sel, elements, var_names)
|
||||
ops.append(f'(dom-dispatch {target} "click" nil)')
|
||||
# Fall through so any trailing assertions in the same split
|
||||
# statement still get picked up.
|
||||
|
||||
# evaluate(() => document.querySelector(SEL).click()) — dispatch click
|
||||
# on the matched element (bubbles so ancestors see it too).
|
||||
m = re.match(
|
||||
|
||||
Reference in New Issue
Block a user