mirror of
https://github.com/affaan-m/ECC.git
synced 2026-09-30 21:45:13 +02:00
test(control-pane): assert the rollback redraws without waiting for a resize
The malformed-drawing rollback test took its marker baseline before the malformed poll but only checked it after resizeAgain(). Resize redraws the accepted view on its own, so the test still passed with the immediate rollback redraw removed and the canvas left blank until the operator resized. Record the log position alongside the baseline and assert the retained markers are on the canvas immediately after the malformed poll, before any resize. Scoped to the drawing case, since the events and lanes cases fail before draw() starts and correctly do not redraw. Mutating the implementation confirms the assertion bites: disabling the rollback draw and removing it entirely both fail it with the message "the rollback must redraw the retained markers immediately". Test-only change. control-plane-view-ui 27/27, control-plane-view 13/13, control-plane-view-ui-a11y 18/18, ESLint clean on the test file.
This commit is contained in:
@@ -539,11 +539,21 @@ let failures = 0;
|
||||
const eventsBefore = textOf(repaired.elements.get('events'));
|
||||
const lanesBefore = textOf(repaired.elements.get('lanes'));
|
||||
const markersBefore = markerShapes(repaired.context);
|
||||
const logBeforeMalformed = repaired.context.log.length;
|
||||
await repaired.pollAgain();
|
||||
assert.strictEqual(textOf(repaired.elements.get('events')), eventsBefore, `${name}: retain previous events`);
|
||||
assert.strictEqual(textOf(repaired.elements.get('lanes')), lanesBefore, `${name}: retain previous lanes`);
|
||||
assert.strictEqual(repaired.elements.get('status').textContent, 'offline');
|
||||
const drawStart = repaired.context.log.length;
|
||||
// When the malformed data fails after draw() started, the rollback
|
||||
// redraws immediately, so the retained markers must be on the canvas
|
||||
// before any resize. Checking only after resizeAgain() would pass even
|
||||
// with the immediate redraw removed, since resize redraws the accepted
|
||||
// view on its own.
|
||||
if (name === 'drawing') {
|
||||
assert.deepStrictEqual(markerShapes({ log: repaired.context.log.slice(logBeforeMalformed) }), markersBefore,
|
||||
`${name}: the rollback must redraw the retained markers immediately`);
|
||||
}
|
||||
assert.doesNotThrow(() => repaired.resizeAgain(), `${name}: resize must use the last accepted view`);
|
||||
assert.deepStrictEqual(markerShapes({ log: repaired.context.log.slice(drawStart) }), markersBefore);
|
||||
assert.match(repaired.labelOf('c'), /unavailable.*unknown/i);
|
||||
|
||||
Reference in New Issue
Block a user