Skip to content

Commit bc85df1

Browse files
authored
bug: the /play seat row opens only when you click a mode or are in a lobby (#963)
1 parent 582b242 commit bc85df1

2 files changed

Lines changed: 40 additions & 3 deletions

File tree

‎components/play/PlayMatchmaking.vue‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,11 @@ const selectedCanQueue = computed(
100100
modes.value.find((mode) => mode.type === selectedType.value)?.canQueue ??
101101
false,
102102
);
103-
// The seat row follows the pick; before one, it shows the biggest format.
103+
// The seat row opens on a click on a mode, or right away in a lobby (before
104+
// a pick it shows the biggest format).
104105
const seatType = computed(
105-
() => selectedType.value ?? modes.value[0]?.type ?? null,
106+
() =>
107+
selectedType.value ?? (lobby.value ? modes.value[0]?.type : null) ?? null,
106108
);
107109
108110
// With nothing checked, Tab lands on the first mode it can pick, like a
@@ -555,7 +557,9 @@ const linkClasses =
555557
></span>
556558
</div>
557559

558-
<PlaySeatRow v-if="!isGuest && seatType" :type="seatType" />
560+
<Fold :open="!isGuest && !!seatType">
561+
<PlaySeatRow v-if="seatType" :type="seatType" />
562+
</Fold>
559563

560564
<div
561565
class="mt-4 flex items-center justify-between gap-x-6 gap-y-3.5 border-t border-border/70 pt-4 max-lg:flex-col max-lg:items-stretch max-sm:contents"

‎tests/components/play/PlayMatchmaking.spec.ts‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ afterEach(() => {
1616
useAuthStore().me = undefined as any;
1717
useApplicationSettingsStore().settings = [];
1818
useMatchmakingStore().joinedMatchmakingQueues = {} as any;
19+
useMatchmakingStore().lobbies = [] as any;
1920
});
2021

2122
describe("PlayMatchmaking", () => {
@@ -68,6 +69,38 @@ describe("PlayMatchmaking", () => {
6869
expect(findMatch?.attributes("disabled")).toBeDefined();
6970
});
7071

72+
it("opens the seat row once a solo player picks a mode", async () => {
73+
useAuthStore().me = {
74+
steam_id: "76561198000000001",
75+
role: "user",
76+
} as any;
77+
78+
const wrapper = await mountSuspended(PlayMatchmaking);
79+
80+
expect(wrapper.text()).not.toContain("Your side");
81+
await wrapper.findAll('[role="radio"]')[0].trigger("click");
82+
expect(wrapper.text()).toContain("Your side");
83+
});
84+
85+
it("shows the seats right away in a lobby, even one of just you", async () => {
86+
const me = { steam_id: "76561198000000001", role: "user" };
87+
useAuthStore().me = me as any;
88+
useMatchmakingStore().lobbies = [
89+
{
90+
id: "lobby-1",
91+
access: "Invite",
92+
players: [{ status: "Accepted", captain: true, player: me }],
93+
},
94+
] as any;
95+
96+
const wrapper = await mountSuspended(PlayMatchmaking);
97+
98+
expect(wrapper.find('[role="radio"][aria-checked="true"]').exists()).toBe(
99+
false,
100+
);
101+
expect(wrapper.text()).toContain("Your side");
102+
});
103+
71104
it("picks the mode when it's the only one", async () => {
72105
useAuthStore().me = {
73106
steam_id: "76561198000000001",

0 commit comments

Comments
 (0)