Show bank rewards, bids and waiting cargo in player-colored harbors

This commit is contained in:
coyotte508 2026-11-18 22:52:56 +00:00
commit 2782601446
6 changed files with 328 additions and 91 deletions

View file

@ -73,10 +73,15 @@ player colors, buttons and bid calculator as the base game. The Offshore board
adds a lower bank area without shifting the classic board coordinates. On mobile,
the **Bank** navigation button brings that area into view.
Click a lot to offer cash or select stored cargo, then confirm the offer. Required
repricing, default and payment choices appear beside the lots; holdings can be
clicked to load on arrival. Large cargo lots and decision lists are paginated.
There is no separate expansion banner or collapsible card panel.
Each lot separates its reward from the current bidder's token and bid. Click a
lot to offer cash or select stored cargo, then confirm the offer. During payment,
click a container below the lots; a connecting line and highlighted lot show its
fixed destination. Repricing and default choices appear beside the bank.
Each player's colored bank harbor row contains separate ship and waiting-cargo
spaces. Won containers remain in that row until clicked to load on arrival.
Empty harbor rows stay visible, and large cargo lists are paginated. There is no
separate expansion banner or collapsible card panel.
## Developer testing

View file

@ -163,6 +163,11 @@ try {
for (const action of cargoBid) state = engine.move(state, action, player);
await push();
await page.locator('.board-scroll').evaluate((el) => {
el.scrollLeft = 0;
});
await page.waitForTimeout(1200);
await page.screenshot({ path: `/tmp/container-offshore-bid-zones-${width}.png`, fullPage: true });
// The decision is on-board too: no HTML cards, forms, expansion eyebrow or toggle.
assert.equal(await page.locator('.bank-toggle, #offshore-title, .bank-decision form').count(), 0);
const own = state.players[player];
@ -229,7 +234,8 @@ try {
state.players[player].lastMove = null;
state.players[player].actions = 2;
const pickup = state.containersLeft.pop();
state.players[player].bankHolding.push(pickup);
state.players[player].bankHolding.push(pickup, ...state.containersLeft.splice(-7));
state.players[(player + 1) % 3].bankHolding.push(state.containersLeft.pop());
state.newTurn = true;
await push();
await page
@ -245,6 +251,22 @@ try {
for (const action of sailing) state = engine.move(state, action, player);
assert.equal(state.players[player].ship.shipPosition, 'offshoreBank');
await push();
// Ship and waiting cargo share a player-colored berth, never the same space.
await page.waitForTimeout(1200);
const ownBerth = page.locator(`.bank-berth[data-owner="${player}"]`);
await ownBerth.scrollIntoViewIfNeeded();
const holdingBounds = await ownBerth.locator('.bank-holding').boundingBox();
const shipBounds = await page
.locator('.piece')
.filter({ hasText: `${state.players[player].name}'s Ship` })
.boundingBox();
assert.ok(shipBounds.x + shipBounds.width < holdingBounds.x, 'ship never overlaps waiting cargo');
assert.equal(await page.locator('.bank-berth').count(), 3);
assert.equal(await ownBerth.locator('[data-piece-id]').count(), 5);
await ownBerth.getByRole('button', { name: 'Next cargo page' }).click();
assert.equal(await ownBerth.locator('[data-piece-id]').count(), 3);
await ownBerth.getByRole('button', { name: 'Previous cargo page' }).click();
await page.screenshot({ path: `/tmp/container-offshore-harbor-${width}.png`, fullPage: true });
// Arrival-only pickup still uses the displayed holding cargo.
await page.locator(`.bank-holding [data-piece-id="${pickup.id}"]`).click();
const loading = await page.evaluate(() => moves.at(-1));
@ -254,6 +276,62 @@ try {
assert.ok(state.players[player].ship.containers.some((piece) => piece.id === pickup.id));
await push();
// Pick the payment color, not the destination: lot II is frozen by an auction.
const payments = ['orange', 'white', 'orange'].map((color) => {
const index = state.containersLeft.findIndex((piece) => piece.color === color);
assert.ok(index >= 0);
return state.containersLeft.splice(index, 1)[0];
});
state.offshoreBank.auctions = [
{ type: 'containers', lot: 1, bidder: (player + 1) % 3, cash: 2, containers: [] },
];
state.offshoreBank.decision = {
kind: 'distribute',
player,
resumePlayer: player,
containers: [],
payment: payments.slice(),
cursor: 0,
};
state.phase = 'bankDecision';
state.newTurn = true;
state.currentPlayers = [player];
await push();
const checkPayment = async (lot, stage) => {
assert.equal(await page.locator('.offshore-lot.destination').getAttribute('data-lot'), String(lot));
assert.equal(await page.locator('.offshore-lot[role="button"]').count(), 0);
assert.equal(await page.locator('.bank-decision > text').count(), 0);
assert.equal(await page.evaluate(() => moves.length), 0, 'never auto-pay');
await page.waitForTimeout(1200);
await page.screenshot({ path: `/tmp/container-offshore-payment-${stage}-${width}.png`, fullPage: true });
};
await checkPayment(0, 'choice');
// Spectators see destination and pending cargo, but cannot choose or bid.
await page.evaluate((state) => {
host.emit('player', { index: undefined });
host.emit('state', state);
}, engine.stripSecret(copy(state)));
assert.equal(await page.locator('.bank-decision [role="button"]').count(), 0);
assert.equal(await page.locator('.offshore-lot.destination').getAttribute('data-lot'), '0');
await page.evaluate((player) => host.emit('player', { index: player }), player);
await push();
for (const [index, lot] of [
[1, 0],
[0, 2],
[2, 0],
]) {
await page.locator(`.bank-choice [data-piece-id="${payments[index].id}"]`).click();
const actions = await page.evaluate(() => moves.at(-1));
assert.equal(actions.length, 1);
assert.equal(actions[0].name, 'distributeBankContainer');
state = engine.move(state, actions[0], player);
assert.ok(state.offshoreBank.containerLots[lot].some((piece) => piece.id === payments[index].id));
await push();
if (index === 1) await checkPayment(2, 'skip');
if (index === 0) await checkPayment(0, 'last');
}
assert.equal(await page.locator('.bank-decision, .offshore-lot.destination').count(), 0);
// Final cash settlement must remain clickable with opponents' point cards stripped.
const payment = state.players[player].containersOnFactoryStore.pop();
const auction = {
@ -278,13 +356,47 @@ try {
state.newTurn = true;
state.currentPlayers = [player];
await push();
await page.getByRole('button', { name: 'Distribute next', exact: true }).click();
assert.equal(await page.evaluate(() => moves.length), 0, 'single payment requires explicit click');
await page.locator('.bank-choice [data-piece-id][role="button"]').click();
const distribution = await page.evaluate(() => moves.at(-1));
assert.equal(distribution.length, 1);
state = engine.move(state, distribution[0], player);
assert.equal(state.phase, 'gameEnd');
await push();
await page.waitForFunction(() => document.querySelector('.statusBar')?.textContent.includes('Game ended'));
// Five fixed assignments, all docked; waiting cargo belongs to the same colored row.
state = engine.setup(5, { offshoreIsland: true }, 'offshore-five-harbors');
state.currentPlayers = [player];
state.players.forEach((p, i) => {
p.name = `Trader ${i + 1}`;
p.ship.shipPosition = engine.ShipPosition.OffshoreBank;
p.bankHolding = state.containersLeft.splice(-7);
});
await push();
await page.waitForTimeout(1200);
assert.equal(await page.locator('.bank-berth').count(), 5);
for (let i = 0; i < 5; i++) {
const berth = page.locator(`.bank-berth[data-owner="${i}"]`);
const cargo = await berth.locator('.bank-holding').boundingBox();
const ship = await page
.locator('.piece')
.filter({ hasText: `Trader ${i + 1}'s Ship` })
.boundingBox();
const bounds = await berth.boundingBox();
assert.ok(ship.x + ship.width < cargo.x);
assert.ok(
ship.y >= bounds.y - 2 && ship.y + ship.height <= bounds.y + bounds.height + 2,
JSON.stringify({ i, ship, bounds })
);
}
await page.locator(`.bank-berth[data-owner="${player}"]`).scrollIntoViewIfNeeded();
await page.screenshot({ path: `/tmp/container-offshore-five-harbors-${width}.png`, fullPage: true });
await page.evaluate((state) => {
host.emit('player', { index: undefined });
host.emit('state', state);
}, engine.stripSecret(copy(state)));
assert.equal(await page.locator('.bank-holding [data-piece-id][role="button"]').count(), 0);
assert.equal(await page.locator('.bank-harbor.canClick').count(), 0);
assert.deepEqual(errors, []);
await page.close();
console.log(

View file

@ -67,9 +67,9 @@
@keydown.esc="ui.selected = null"
id="scene"
data-tutorial="game-board"
:viewBox="`0 0 1250 ${G && G.options.offshoreIsland ? 950 : 650}`"
:height="G && G.options.offshoreIsland ? 950 : 650"
:style="{ aspectRatio: G && G.options.offshoreIsland ? '1250 / 950' : '1250 / 650' }"
:viewBox="`0 0 1250 ${G && G.options.offshoreIsland ? 1050 : 650}`"
:height="G && G.options.offshoreIsland ? 1050 : 650"
:style="{ aspectRatio: G && G.options.offshoreIsland ? '1250 / 1050' : '1250 / 650' }"
>
<defs>
<linearGradient id="container-sea" x2="0" y2="1">
@ -381,7 +381,7 @@
<g
v-if="bankDraft && canMove"
class="bank-draft"
transform="translate(470 680)"
transform="translate(630 680)"
role="group"
:aria-label="bankDraft.type === 'cash' ? 'Offer cargo' : 'Offer cash'"
>
@ -1037,13 +1037,17 @@ export default class Game extends Vue {
this.createPieces();
if (this.G?.offshoreBank?.decision?.player === this.player) {
this.$nextTick(() =>
this.$el.querySelector('.bank-decision')?.scrollIntoView?.({ block: 'nearest', inline: 'start' })
);
this.$nextTick(() => {
this.$el.querySelector('.bank-decision')?.scrollIntoView?.({ block: 'nearest', inline: 'start' });
// Payment choices and their fixed destination share the left bank edge.
if (this.G?.offshoreBank?.decision?.kind === 'distribute') {
(this.$refs.boardScroll as HTMLElement).scrollLeft = 0;
}
});
} else if (this.canMove && this.getCurrentPlayerMoves()[MoveName.LoadBankContainer]?.length) {
this.$nextTick(() =>
this.$el
.querySelector(`.bank-holding[data-owner="${this.player}"]`)
.querySelector(`.bank-berth[data-owner="${this.player}"]`)
?.scrollIntoView?.({ block: 'nearest', inline: 'start' })
);
}

View file

@ -20,7 +20,11 @@
class="offshore-lot"
:class="{
legal: offer(type, i - 1),
selected: selectedOffer?.type === type && selectedOffer?.lot === i - 1,
selected: !bank.decision && selectedOffer?.type === type && selectedOffer?.lot === i - 1,
destination:
bank.decision?.kind === 'distribute' &&
type === 'containers' &&
distributionLot === i - 1,
}"
:aria-pressed="
offer(type, i - 1)
@ -49,13 +53,36 @@
>
<title>
{{
type === 'cash'
bank.decision?.kind === 'distribute' &&
type === 'containers' &&
distributionLot === i - 1
? 'Next payment destination. Choose a payment container below.'
: type === 'cash'
? 'Bid containers to win this cash.'
: 'Bid cash to win these containers.'
}}
</title>
</rect>
<text v-if="type === 'cash'" class="bank-money" x="6" y="18" font-size="16" pointer-events="none"
<path class="bank-bid-zone" d="M1 66 H99 V103 H1 Z" fill="#d2d5cb" pointer-events="none" />
<path d="M1 66 H99" stroke="#899997" pointer-events="none" />
<text
v-if="!auction(type, i - 1)"
x="50"
y="89"
text-anchor="middle"
font-size="10"
fill="#63716e"
pointer-events="none"
>Bid</text
>
<text
v-if="type === 'cash'"
class="bank-money"
x="50"
y="36"
text-anchor="middle"
font-size="16"
pointer-events="none"
>${{ bank.cashLots[i - 1] }}</text
>
<OffshoreCargo
@ -68,7 +95,7 @@
<g v-if="auction(type, i - 1)">
<PlayerToken
class="bank-bidder"
:transform="`translate(16 ${type === 'cash' ? 52 : 86})`"
transform="translate(16 86)"
:owner="auction(type, i - 1).bidder"
:name="owner(auction(type, i - 1).bidder)"
:color="playerColors[auction(type, i - 1).bidder]"
@ -76,9 +103,9 @@
<OffshoreCargo
v-if="type === 'cash'"
:pieces="escrow(auction(type, i - 1))"
transform="translate(32 47)"
transform="translate(32 69)"
:columns="2"
:rows="2"
:rows="1"
/>
<text v-else class="bank-money bank-bid-amount" x="32" y="86" font-size="16" text-anchor="start"
>${{ auction(type, i - 1).cash }}<title>Cash bid</title></text
@ -87,33 +114,76 @@
</g>
</template>
</g>
<g class="bank-piers" pointer-events="none" transform="translate(332 680)">
<g class="bank-piers" transform="translate(332 680)">
<rect width="4" height="214" fill="#c6c6b8" />
<rect v-for="i in 6" :key="i" x="4" :y="(i - 1) * 42" width="108" height="4" fill="#c6c6b8" />
<g
v-for="(p, i) in state.players"
:key="i"
:transform="`translate(4 ${i * 42 + 4})`"
class="bank-berth"
:data-owner="i"
>
<rect
width="268"
height="38"
:fill="playerColors[i]"
fill-opacity=".16"
:stroke="playerColors[i]"
stroke-width="1"
pointer-events="none"
/>
<path d="M112 1 V37" :stroke="playerColors[i]" stroke-opacity=".5" pointer-events="none" />
<g class="bank-holding" :data-owner="i" transform="translate(112 0)">
<title>{{ owner(i) }}: waiting cargo</title>
<PlayerToken transform="translate(12 19)" :owner="i" :name="owner(i)" :color="playerColors[i]" />
<rect
v-if="!p.bankHolding?.length"
x="28"
y="3"
width="20"
height="10"
rx="1"
fill="none"
:stroke="playerColors[i]"
stroke-opacity=".4"
stroke-dasharray="2 2"
pointer-events="none"
/>
<OffshoreCargo
:pieces="p.bankHolding || []"
transform="translate(28 3)"
:columns="5"
:rows="1"
:selectable="
canAct && i === player
? (availableMoves[names.LoadBankContainer] || []).map((piece) => piece.id)
: []
"
action-label="Load from bank harbor"
@select="loadContainer"
/>
</g>
</g>
</g>
<g
v-for="({ p, i }, index) in holdings"
:key="'holding' + i"
:transform="`translate(${750 + Math.floor(index / 3) * 240} ${680 + (index % 3) * 85})`"
class="bank-holding"
:data-owner="i"
v-if="bank.decision"
class="bank-decision"
:transform="bank.decision.kind === 'distribute' ? 'translate(20 950)' : 'translate(630 680)'"
>
<PlayerToken transform="translate(9 0)" :owner="i" :name="owner(i)" :color="playerColors[i]" />
<OffshoreCargo
:pieces="p.bankHolding || []"
transform="translate(0 12)"
:columns="9"
:rows="3"
:selectable="
canAct && i === player
? (availableMoves[names.LoadBankContainer] || []).map((piece) => piece.id)
: []
"
@select="loadContainer"
/>
</g>
<g v-if="bank.decision" class="bank-decision" transform="translate(470 680)">
<text x="0" y="0" font-size="14">{{ decisionTitle }}</text>
<text v-if="decisionTitle" x="0" y="0" font-size="14">{{ decisionTitle }}</text>
<g
v-if="bank.decision.kind === 'distribute'"
class="bank-payment-route"
pointer-events="none"
aria-hidden="true"
>
<path
:d="`M30 -25 H${Math.max(30 + (visibleDecisions.length - 1) * 70, 50 + distributionLot * 104)} M${
50 + distributionLot * 104
} -25 V-54`"
/>
<path :d="`M${44 + distributionLot * 104} -48 l6 -8 l6 8`" />
</g>
<template v-if="!decisionMoves.length">
<PlayerToken
transform="translate(9 20)"
@ -121,19 +191,42 @@
:name="owner(bank.decision.player)"
:color="playerColors[bank.decision.player]"
/>
<OffshoreCargo :pieces="pendingCargo" transform="translate(0 35)" :columns="10" :rows="8" />
<OffshoreCargo
:pieces="pendingCargo"
transform="translate(0 35)"
:columns="10"
:rows="bank.decision.kind === 'distribute' ? 2 : 8"
/>
</template>
<template v-else>
<text v-if="bank.decision.kind === 'distribute'" x="0" y="20" font-size="11"
>Lot {{ ['I', 'II', 'III'][distributionLot] }}</text
>
<g
v-for="(choice, index) in visibleDecisions"
:key="choice.data.id"
class="bank-choice"
:transform="`translate(0 ${40 + index * 35})`"
:transform="
bank.decision.kind === 'distribute'
? `translate(${index * 70} 0)`
: `translate(0 ${40 + index * 35})`
"
>
<OffshoreCargo :pieces="[choice.data]" />
<path
v-if="choice.name === names.DistributeBankContainer"
class="bank-payment-route"
d="M30 0 V-25"
pointer-events="none"
aria-hidden="true"
/>
<OffshoreCargo
:pieces="[choice.data]"
:transform="choice.name === names.ReturnBankContainer ? undefined : 'translate(10 0) scale(2)'"
:selectable="choice.name === names.ReturnBankContainer ? [] : [choice.data.id]"
:action-label="
choice.name === names.SeizeBankContainer
? 'Select for loan default'
: 'Pay into container lot ' + (distributionLot + 1)
"
@select="emitMove(choice)"
/>
<template v-if="choice.name === names.ReturnBankContainer">
<g
v-for="price in returnPrices(choice)"
@ -158,29 +251,10 @@
}}</text>
</g>
</template>
<g
v-else
role="button"
tabindex="0"
:aria-label="
choice.name === names.SeizeBankContainer ? 'Select for default' : 'Distribute next'
"
@click.stop="emitMove(choice)"
@keydown.enter.prevent.stop="emitMove(choice)"
@keydown.space.prevent.stop="emitMove(choice)"
>
<rect x="29" y="-3" width="34" height="24" fill="orange" /><text
x="46"
y="12"
text-anchor="middle"
fill="white"
>→</text
>
</g>
</g>
<Button
v-if="decisionPages > 1"
transform="translate(0 190)"
:transform="bank.decision.kind === 'distribute' ? 'translate(0 40)' : 'translate(0 190)'"
:width="100"
:text="'More ' + (decisionPage + 1) + '/' + decisionPages"
@click="decisionPage = (decisionPage + 1) % decisionPages"
@ -221,21 +295,15 @@ export default class OffshoreBank extends Vue {
get canAct() {
return this.player != null && this.state.currentPlayers.includes(this.player);
}
get holdings() {
return this.state.players
.map((p, i) => ({ p, i }))
.filter(
({ p, i }) =>
(p.bankHolding || []).length ||
(i === this.player && !!this.availableMoves[MoveName.LoadBankContainer])
);
}
get bank() {
return this.state.offshoreBank;
}
offer(type: BankAuctionType, lot: number) {
return this.canAct && this.availableMoves[MoveName.CallBank]?.some((o) => o.type === type && o.lot === lot);
return (
!this.bank?.decision &&
this.canAct &&
this.availableMoves[MoveName.CallBank]?.some((o) => o.type === type && o.lot === lot)
);
}
chooseOffer(type: BankAuctionType, lot: number) {
if (this.offer(type, lot)) this.$emit('choose-offer', { type, lot });
@ -261,7 +329,7 @@ export default class OffshoreBank extends Vue {
? 'Outbid'
: this.bank?.decision?.kind === 'seize'
? 'Loan default'
: 'Pay bank';
: '';
}
returnPrices(choice: Moves.MoveBankContainer) {
return [1, 2, 3, 4, 5, 6].filter((price) =>
@ -293,6 +361,14 @@ export default class OffshoreBank extends Vue {
stroke-width: 2;
cursor: pointer;
}
.bank-payment-route {
fill: none;
stroke: blue;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
}
.offshore-lot.destination,
.offshore-lot.selected {
fill: #d6e4ff;
stroke: blue;

View file

@ -70,6 +70,7 @@ export default class OffshoreCargo extends Vue {
@Prop({ default: () => [] }) pieces!: Array<ContainerPiece & { price?: number }>;
@Prop({ default: () => [] }) selectable!: string[];
@Prop({ default: () => [] }) selected!: string[];
@Prop({ default: '' }) actionLabel!: string;
@Prop({ default: 3 }) columns!: number;
@Prop({ default: 2 }) rows!: number;
@ -93,9 +94,9 @@ export default class OffshoreCargo extends Vue {
this.$emit('select', id);
}
cargoLabel(piece: ContainerPiece & { price?: number }) {
return `${piece.color === 'darkslategray' ? 'dark green' : piece.color} container${
piece.price == null ? '' : ': $' + piece.price
}`;
return `${this.actionLabel && this.selectable.includes(piece.id) ? this.actionLabel + ': ' : ''}${
piece.color === 'darkslategray' ? 'dark green' : piece.color
} container${piece.price == null ? '' : ': $' + piece.price}`;
}
}
</script>

View file

@ -105,7 +105,7 @@ describe('Offshore bank viewer', () => {
const tokens = wrapper.findAll('.bank-bidder');
expect(tokens.length).toBe(2);
expect(tokens.wrappers.map((t) => t.attributes('transform'))).toEqual([
'translate(16 52)',
'translate(16 86)',
'translate(16 86)',
]);
tokens.wrappers.forEach((t) => expect(t.find('circle').attributes('r')).toBe('9'));
@ -115,9 +115,9 @@ describe('Offshore bank viewer', () => {
expect(amount.attributes('text-anchor')).toBe('start');
const escrow = wrapper
.findAllComponents(OffshoreCargo)
.wrappers.find((c) => c.attributes('transform') === 'translate(32 47)')!;
.wrappers.find((c) => c.attributes('transform') === 'translate(32 69)')!;
expect(escrow.props('columns')).toBe(2);
expect(escrow.props('rows')).toBe(2);
expect(escrow.props('rows')).toBe(1);
tokens.wrappers.forEach((token) => {
expect(token.attributes('aria-label')).toBe(name);
expect(token.attributes('translate')).toBe('no');
@ -128,7 +128,7 @@ describe('Offshore bank viewer', () => {
);
});
expect(wrapper.findAll('.bank-board text').wrappers.some((text) => text.text().includes(name))).toBe(false);
expect(wrapper.findAllComponents(PlayerToken).length).toBe(2);
expect(wrapper.findAllComponents(PlayerToken).length).toBe(2 + state.players.length);
wrapper.destroy();
}
});
@ -280,7 +280,7 @@ describe('Offshore bank viewer', () => {
refresh();
let wrapper = render();
expect(wrapper.text()).toContain('Loan default');
await wrapper.find('.bank-choice [role="button"]').trigger('click');
await wrapper.find('.bank-choice [data-piece-id][role="button"]').trigger('keydown.enter');
expect(wrapper.emitted('move')![0][0].name).toBe(MoveName.SeizeBankContainer);
wrapper.destroy();
state.offshoreBank!.decision = {
@ -293,8 +293,14 @@ describe('Offshore bank viewer', () => {
};
refresh();
wrapper = render();
expect(wrapper.text()).toContain('Lot I');
await wrapper.find('.bank-choice [role="button"]').trigger('click');
expect(wrapper.find('.offshore-lot.destination').attributes('data-lot')).toBe('0');
expect(wrapper.find('.offshore-lot.destination').attributes('role')).toBeUndefined();
expect(wrapper.find('.bank-decision > text').exists()).toBe(false);
expect(wrapper.emitted('move')).toBeUndefined();
expect(wrapper.find('.bank-choice [data-piece-id][role="button"]').attributes('aria-label')).toContain(
'Pay into container lot 1'
);
await wrapper.find('.bank-choice [data-piece-id][role="button"]').trigger('keydown.enter');
expect(wrapper.emitted('move')![0][0].name).toBe(MoveName.DistributeBankContainer);
wrapper.destroy();
});
@ -361,6 +367,39 @@ describe('Offshore bank viewer', () => {
game.destroy();
});
it('reserves colored ship and cargo bays for all five players, even when empty', async () => {
const state = setup(5, { offshoreIsland: true }, 'bank-holding-berths');
const player = state.currentPlayers[0];
const colors = ['#123456', '#234567', '#345678', '#456789', '#56789a'];
state.players.forEach((p) => {
p.ship.shipPosition = ShipPosition.OffshoreBank;
});
const other = (player + 1) % 5;
state.players[other].bankHolding = state.containersLeft.splice(-8);
const wrapper = mount(OffshoreBank, {
provide: { __reactiveInject__: { preferences: { colorBlind: true } } },
propsData: { state, player, playerColors: colors },
});
expect(wrapper.findAll('.bank-bid-zone')).toHaveLength(6);
expect(wrapper.findAll('.bank-berth')).toHaveLength(5);
wrapper.findAll('.bank-berth').wrappers.forEach((berth, i) => {
expect(berth.attributes('transform')).toBe(`translate(4 ${i * 42 + 4})`);
expect(berth.find('rect').attributes('fill')).toBe(colors[i]);
expect(berth.find('.player-token text').text()).toBe(String(i + 1));
expect(berth.find('.bank-holding').attributes('transform')).toBe('translate(112 0)');
});
expect(wrapper.find(`.bank-berth[data-owner="${player}"] [data-piece-id]`).exists()).toBe(false);
const holding = wrapper.find(`.bank-holding[data-owner="${other}"]`);
expect(holding.findAll('[data-piece-id]')).toHaveLength(5);
await holding.find('[aria-label="Next cargo page"]').trigger('click');
expect(holding.findAll('[data-piece-id]')).toHaveLength(3);
await wrapper.setProps({ player: undefined });
expect(wrapper.findAll('.bank-berth')).toHaveLength(5);
expect(wrapper.find('.bank-holding [data-piece-id][role="button"]').exists()).toBe(false);
expect(wrapper.emitted('move')).toBeUndefined();
wrapper.destroy();
});
it('renders bank ships at finite coordinates and permits arrival loading only', async () => {
const { state, player, own, refresh, render } = fixture();
own.ship.shipPosition = ShipPosition.OffshoreBank;