fix: WCEnd editor modal pre-loads correct colour and errno value
- Default colour now checks dataset.exitError instead of tagName === 'WC-END', so success (exit 0) END blocks default to blue, error END blocks to red - _selectByCode now also sets the HTML value attribute via setAttribute(), ensuring cloneNode(true) preserves the formatted display value - Add 4 regression tests for colour defaults, attribute sync, and clone value
This commit is contained in:
+6
-2
@@ -118,11 +118,15 @@ class WCEnd extends WCBlock {
|
||||
this._selectedCode = code;
|
||||
const item = this._errnoItems.find(i => i.code === code);
|
||||
if (item) {
|
||||
this._el.input.value = code + " " + item.name;
|
||||
const display = code + " " + item.name;
|
||||
this._el.input.value = display;
|
||||
this._el.input.setAttribute("value", display);
|
||||
this._el.desc.textContent = item.desc;
|
||||
this.dataset.exitError = code !== 0 ? "true" : "";
|
||||
} else {
|
||||
this._el.input.value = code + " error";
|
||||
const display = code + " error";
|
||||
this._el.input.value = display;
|
||||
this._el.input.setAttribute("value", display);
|
||||
this._el.desc.textContent = "unknown error";
|
||||
this.dataset.exitError = "true";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user