package nativewindow import ( "strings" "testing" ) func TestBridgeWindowIDUsesChildIdentity(t *testing.T) { bridge := newBridge(ChildOptions{ID: "workbench:query-1"}) if got := bridge.WindowID(); got != "workbench:query-1" { t.Fatalf("WindowID() = %q, want %q", got, "workbench:query-1") } } func TestRuntimeCommandsDoNotReloadBootstrapForWindowIdentity(t *testing.T) { script := detachedRuntimeBridgeScript() if !strings.Contains(script, "bridge.WindowID()") { t.Fatal("runtime bridge does not read the lightweight window identity") } if strings.Contains(script, "detached.loadBootstrap().then(function (bootstrap)") { t.Fatal("runtime command routing still reloads the full bootstrap payload") } } func TestRuntimeExposesParentWindowManagerInsideDetachedChildren(t *testing.T) { script := detachedRuntimeBridgeScript() for _, expected := range []string{ "Manager: parentWindowManager", "bridge.OpenWindow(request || {})", "bridge.FocusWindow", "bridge.CloseWindow", } { if !strings.Contains(script, expected) { t.Fatalf("runtime bridge is missing %q", expected) } } }