diff --git a/src/cameraHandoff.test.mjs b/src/cameraHandoff.test.mjs index d4f60e99f..87454e61a 100644 --- a/src/cameraHandoff.test.mjs +++ b/src/cameraHandoff.test.mjs @@ -302,10 +302,16 @@ test('newer navigation, reset, Cockpit, and teardown share one generation', () = const dispose = body(ui, /async dispose\(\) \{([\s\S]*?)\n \}/, 'dispose'); ordered(dispose, [ 'this._disposed = true;', - 'this._layerBindings.stop();', - 'this._navigation.destroy(', - 'await this._contextControls.restoreForDisposal();', + 'await this.detachScene(', + 'this._navigation.stop();', ], 'dispose invalidation'); + // An engine switch retires the outgoing globe's navigation the same way. + const detach = body(ui, /async detachScene\(\{[\s\S]*?\} = \{\}\) \{([\s\S]*?)\n \}/, 'detach'); + ordered(detach, [ + 'this._navigation.setScene(', + 'this._layerBindings.stop();', + 'await this._contextControls.restoreForDisposal();', + ], 'detach invalidation'); assert.match(shellMethod('destroy').toString(), /this\._stampNavigation\(\{\s*cancelPendingSelection: !retainScene\s*\}\)/); }); @@ -313,9 +319,13 @@ test('teardown synchronously closes immediate camera entry points', () => { const dispose = body(ui, /async dispose\(\) \{([\s\S]*?)\n \}/, 'dispose'); ordered(dispose, [ 'this._disposed = true;', + 'await this.detachScene(', + ], 'synchronous teardown barrier'); + const detach = body(ui, /async detachScene\(\{[\s\S]*?\} = \{\}\) \{([\s\S]*?)\n \}/, 'detach'); + ordered(detach, [ 'this._layerBindings.stop();', 'await this._contextControls.restoreForDisposal();', - ], 'synchronous teardown barrier'); + ], 'synchronous detach barrier'); ordered(LayerBindings.prototype.stop.toString(), [ 'this._disposed = true;', 'this._removeCctvRequestFocusListener?.();', diff --git a/src/loadingFeedback.test.mjs b/src/loadingFeedback.test.mjs index d892ddf1c..4740ac333 100644 --- a/src/loadingFeedback.test.mjs +++ b/src/loadingFeedback.test.mjs @@ -210,7 +210,11 @@ test('universal notice lifecycle clears on dispose and uses the one top-center l const dispose = ui.slice(disposeStart, disposeEnd); assert.match(dispose, /this\._feedback\.clearLoadingStatus\(\);/); - assert.match(dispose, /this\._shareRestoration\.destroy\(\)/); + // The globe-bound parts, share restoration included, go with the scene. + assert.match(dispose, /await this\.detachScene\(/); + const detachStart = ui.indexOf(' async detachScene({'); + const detach = ui.slice(detachStart, ui.indexOf('\n }\n', detachStart)); + assert.match(detach, /this\._shareRestoration\.destroy\(\)/); assert.match(ShareRestoration.prototype.destroy.toString(), /this\._shareTrackingNoticeGeneration \+= 1;/); assert.match(html, /