fix(js): preserve pending indicator state
Track pending class and indicator state with small reference counts so overlapping requests do not hide indicators early or strip a class that existed before the request. req: convention/007 req: convention/008
This commit is contained in:
@@ -55,9 +55,14 @@ fn runtime_toggles_pending_conventions_around_requests() {
|
||||
|
||||
assert!(source.contains("function showPending(el, on)"));
|
||||
assert!(source.contains("el.getAttribute(\"data-slhx-pending-class\")"));
|
||||
assert!(source.contains("el.classList.toggle(klass, on)"));
|
||||
assert!(source.contains("forEachElement(root, (i) => { if (i.hasAttribute(\"data-slhx-indicator\")) i.hidden = !on; })"));
|
||||
assert!(source.contains("i.hidden = !on"));
|
||||
assert!(source.contains("const pendingClassStates = new WeakMap()"));
|
||||
assert!(source.contains("function togglePendingClass(el, klass, on)"));
|
||||
assert!(source.contains("hadClass: el.classList.contains(klass)"));
|
||||
assert!(source.contains("if (state.hadClass) el.classList.add(state.className)"));
|
||||
assert!(source.contains("const indicatorStates = new WeakMap()"));
|
||||
assert!(source.contains("function toggleIndicator(indicator, on)"));
|
||||
assert!(source.contains("toggleIndicator(i, on)"));
|
||||
assert!(source.contains("indicator.hidden = state.hidden"));
|
||||
assert!(source.contains("el.hasAttribute(\"data-slhx-disable-while-pending\")"));
|
||||
assert!(source.contains("if (isDisableControl(el)) controls.push(el)"));
|
||||
assert!(source.contains("forEachElement(el, (child) => { if (isDisableControl(child)) controls.push(child); })"));
|
||||
|
||||
Reference in New Issue
Block a user