fix(chat): ao fechar a conversa, a sala geral volta a ser o destino
O fechamento da aba não avisava a seleção da sala, então o menu e o texto continuavam os do peer. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
9610c07675
commit
beaf9190c9
2 files changed
+22
-1
No files matched your search
@@ -201,7 +201,8 @@ public final class ClosableTabbedPane {
|
|||||||
next = firstTabKey();
|
next = firstTabKey();
|
||||||
}
|
}
|
||||||
if (next != null) {
|
if (next != null) {
|
||||||
selectTab(next);
|
selectTabSilently(next);
|
||||||
|
onTabSelected.accept(next);
|
||||||
} else if (!suppressSelectionEvents) {
|
} else if (!suppressSelectionEvents) {
|
||||||
onTabSelected.accept(null);
|
onTabSelected.accept(null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package pitiupi.presentation.shell;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
@@ -78,4 +80,22 @@ class SessionTabBarStripTest {
|
|||||||
assertEquals(1, bar.getTabCount());
|
assertEquals(1, bar.getTabCount());
|
||||||
assertEquals(false, bar.hasTab(wifi));
|
assertEquals(false, bar.hasTab(wifi));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void closingPeerTabNotifiesRoomEvenWhenItWasAlreadyUnderneath() {
|
||||||
|
SessionTabBar bar = new SessionTabBar();
|
||||||
|
List<String> selected = new ArrayList<>();
|
||||||
|
bar.setOnTabSelected(selected::add);
|
||||||
|
bar.addOrSelectTab(PluginSessionKeys.ROOM, "Sala geral", new JPanel(), false);
|
||||||
|
String peer = PluginSessionKeys.peer("192.168.3.131");
|
||||||
|
bar.addOrSelectTab(peer, "Vostro", "192.168.3.131", new JPanel(), true);
|
||||||
|
bar.selectTab(PluginSessionKeys.ROOM);
|
||||||
|
bar.selectTab(peer);
|
||||||
|
selected.clear();
|
||||||
|
|
||||||
|
bar.closeTab(peer);
|
||||||
|
|
||||||
|
assertEquals(PluginSessionKeys.ROOM, bar.selectedKey());
|
||||||
|
assertEquals(List.of(PluginSessionKeys.ROOM), selected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user