merge: 최신 main을 턴 입력기 연월 경계 수정에 통합한다
This commit is contained in:
@@ -112,6 +112,7 @@ const myGeneral = (state: FixtureState) => ({
|
||||
injury: 0,
|
||||
experience: 100,
|
||||
dedication: 200,
|
||||
bill: 800,
|
||||
age: 30,
|
||||
turnTime: '2026-01-01 00:10:00',
|
||||
recentWar: '2026-01-01 00:00:00',
|
||||
@@ -296,6 +297,7 @@ const battleCenter = (state: FixtureState) => ({
|
||||
stats: { leadership: 70, strength: 60, intelligence: 50 },
|
||||
experience: 100,
|
||||
dedication: 200,
|
||||
bill: 800,
|
||||
injury: 0,
|
||||
gold: 1_000,
|
||||
rice: 2_000,
|
||||
@@ -334,6 +336,7 @@ const battleCenter = (state: FixtureState) => ({
|
||||
stats: { leadership: 50, strength: 50, intelligence: 50 },
|
||||
experience: 0,
|
||||
dedication: 0,
|
||||
bill: 400,
|
||||
injury: 0,
|
||||
gold: 500,
|
||||
rice: 500,
|
||||
@@ -1245,6 +1248,7 @@ test('내 정보&설정 keeps desktop density and becomes a 390px horizontal-ide
|
||||
await expect(page.locator('.general-table')).toContainText('병종보병');
|
||||
await expect(page.locator('.general-table')).toContainText('삭턴6 턴');
|
||||
await expect(page.locator('.battle-general-extra')).toContainText('계급29품관');
|
||||
await expect(page.locator('.battle-general-extra')).toContainText('봉급800');
|
||||
await expect(page.locator('.battle-general-extra')).toContainText('전투8회');
|
||||
await expect(page.locator('.battle-general-extra')).toContainText('계략12');
|
||||
await expect(page.locator('.battle-general-extra')).toContainText('사관4년');
|
||||
@@ -1255,7 +1259,7 @@ test('내 정보&설정 keeps desktop density and becomes a 390px horizontal-ide
|
||||
await expect(page.locator('.battle-general-extra__recent-value')).toHaveText('01-01 00:00');
|
||||
await expect(page.locator('.legacy-general-details')).toHaveCount(0);
|
||||
expect(await readGeneralSummaryRows(page.locator('.battle-general-extra'))).toEqual([
|
||||
['명성', '계급', ''],
|
||||
['명성', '계급', '봉급'],
|
||||
['전투', '계략', '사관'],
|
||||
['승률', '승리', '패배'],
|
||||
['살상률', '사살', '피살'],
|
||||
@@ -2039,6 +2043,7 @@ test('감찰부 keeps the selector interaction and shows the permission error pa
|
||||
await expect(page.locator('.battle-general-name')).toContainText('간의대부');
|
||||
await expect(page.locator('.battle-general-name')).toContainText('건강');
|
||||
await expect(page.locator('.battle-general-extra')).toContainText('계급29품관');
|
||||
await expect(page.locator('.battle-general-extra')).toContainText('봉급800');
|
||||
await expect(page.locator('.battle-general-card')).toContainText('병종보병');
|
||||
await expect(page.locator('.battle-general-card')).not.toContainText('che_');
|
||||
await expect(page.locator('.battle-general-card')).toHaveAttribute('data-general-basic-card', '');
|
||||
@@ -2049,7 +2054,7 @@ test('감찰부 keeps the selector interaction and shows the permission error pa
|
||||
await expect(page.locator('.battle-general-extra')).toContainText('승률62.50%');
|
||||
await expect(page.locator('.battle-general-extra')).toContainText('살상률181.84%');
|
||||
expect(await readGeneralSummaryRows(page.locator('.battle-general-extra'))).toEqual([
|
||||
['명성', '계급', ''],
|
||||
['명성', '계급', '봉급'],
|
||||
['전투', '계략', '사관'],
|
||||
['승률', '승리', '패배'],
|
||||
['살상률', '사살', '피살'],
|
||||
|
||||
@@ -36,7 +36,10 @@ type NavigationFixture = {
|
||||
generalTurnTime?: string;
|
||||
nextTurnMonthOffset?: 0 | 1;
|
||||
serverTime?: string;
|
||||
serverWallTime?: string;
|
||||
clockMode?: 'realtime' | 'manual';
|
||||
clockRunning?: boolean;
|
||||
clockStartsAt?: string | null;
|
||||
cityDefence?: number;
|
||||
cityState?: number;
|
||||
nationRate?: number;
|
||||
@@ -589,7 +592,10 @@ const installFixture = async (page: Page, state: NavigationFixture) => {
|
||||
month: state.currentMonth ?? 1,
|
||||
turnTerm: 10,
|
||||
serverTime: state.serverTime ?? '2026-08-13T00:00:00.000Z',
|
||||
serverWallTime: state.serverWallTime ?? '2026-08-13T00:00:00.000Z',
|
||||
clockMode: state.clockMode ?? 'realtime',
|
||||
clockRunning: state.clockRunning ?? true,
|
||||
clockStartsAt: state.clockStartsAt ?? null,
|
||||
scenarioTitle: state.scenarioTitle ?? '',
|
||||
});
|
||||
}
|
||||
@@ -1844,12 +1850,48 @@ test('main general card uses local turn time and command clock tracks corrected
|
||||
}
|
||||
|
||||
state.clockMode = 'manual';
|
||||
state.clockRunning = false;
|
||||
state.serverTime = '2026-08-13T00:08:30.000Z';
|
||||
await page.reload();
|
||||
const frozenClock = page.locator('[data-main-target="commands"] [data-command-current-time]').first();
|
||||
await expect(frozenClock).toHaveText('09:08:30');
|
||||
await page.clock.runFor(2_000);
|
||||
await expect(frozenClock).toHaveText('09:08:30');
|
||||
|
||||
state.clockMode = 'realtime';
|
||||
state.clockRunning = false;
|
||||
state.serverTime = '2026-08-13T00:10:00.000Z';
|
||||
state.serverWallTime = '2026-08-21T10:00:00.000Z';
|
||||
state.clockStartsAt = '2026-08-21T10:00:02.000Z';
|
||||
await page.reload();
|
||||
const preopenClock = page.locator('[data-main-target="commands"] [data-command-current-time]').first();
|
||||
await expect(preopenClock).toHaveText('09:10:00');
|
||||
const operationsBeforePreopenBoundary = state.operations.length;
|
||||
await page.clock.runFor(1_500);
|
||||
await expect(preopenClock).toHaveText('09:10:00');
|
||||
if (artifactRoot) {
|
||||
const preopenGeometry = await preopenClock.evaluate((element) => ({
|
||||
rect: element.getBoundingClientRect().toJSON(),
|
||||
overflow: element.scrollWidth - element.clientWidth,
|
||||
fontSize: getComputedStyle(element).fontSize,
|
||||
lineHeight: getComputedStyle(element).lineHeight,
|
||||
value: element.textContent,
|
||||
}));
|
||||
expect(preopenGeometry.overflow).toBeLessThanOrEqual(0);
|
||||
await Promise.all([
|
||||
page.screenshot({
|
||||
path: resolve(artifactRoot, 'main-preopen-clock-frozen-mobile-500.png'),
|
||||
fullPage: true,
|
||||
}),
|
||||
writeFile(
|
||||
resolve(artifactRoot, 'main-preopen-clock-frozen-mobile-500.json'),
|
||||
`${JSON.stringify(preopenGeometry, null, 2)}\n`
|
||||
),
|
||||
]);
|
||||
}
|
||||
await page.clock.runFor(1_500);
|
||||
await expect(preopenClock).toHaveText('09:10:01');
|
||||
expect(state.operations).toHaveLength(operationsBeforePreopenBoundary);
|
||||
});
|
||||
|
||||
test('message targets keep reply behavior and use nation-color contrast in labels and select options', async ({
|
||||
|
||||
@@ -80,7 +80,7 @@ const baseTroops = (): TroopFixture[] => [
|
||||
name: '백마대',
|
||||
nationId: 1,
|
||||
turnTime: '2026-07-25T08:20:30.000Z',
|
||||
reservedCommands: ['che_집합', 'che_이동'],
|
||||
reservedCommands: ['집합', '-'],
|
||||
leader: {
|
||||
id: 1,
|
||||
name: '공손찬',
|
||||
@@ -96,7 +96,7 @@ const baseTroops = (): TroopFixture[] => [
|
||||
name: '청룡대',
|
||||
nationId: 1,
|
||||
turnTime: '2026-07-25T08:30:30.000Z',
|
||||
reservedCommands: ['che_징병'],
|
||||
reservedCommands: ['-'],
|
||||
leader: {
|
||||
id: 2,
|
||||
name: '관우',
|
||||
@@ -224,6 +224,27 @@ const installApiFixture = async (page: Page, state: FixtureState) => {
|
||||
});
|
||||
};
|
||||
|
||||
test('shows only the Ref-safe first-five troop command labels on desktop and mobile', async ({ page }) => {
|
||||
await installApiFixture(page, {
|
||||
me: { id: 1, troopId: 1 },
|
||||
permission: 4,
|
||||
troops: baseTroops(),
|
||||
});
|
||||
|
||||
for (const viewport of [
|
||||
{ width: 1000, height: 800 },
|
||||
{ width: 500, height: 800 },
|
||||
]) {
|
||||
await page.setViewportSize(viewport);
|
||||
await gotoTroop(page);
|
||||
|
||||
const firstTroopCommands = page.locator('.troopReservedCommand').first();
|
||||
await expect(firstTroopCommands).toContainText('1: 집합');
|
||||
await expect(firstTroopCommands).toContainText('2: -');
|
||||
await expect(page.locator('#troopList')).not.toContainText('che_');
|
||||
}
|
||||
});
|
||||
|
||||
test('renders the legacy desktop grid with matching computed geometry and states', async ({ page }) => {
|
||||
await installApiFixture(page, {
|
||||
me: { id: 1, troopId: 1 },
|
||||
@@ -233,6 +254,9 @@ test('renders the legacy desktop grid with matching computed geometry and states
|
||||
await page.setViewportSize({ width: 1000, height: 800 });
|
||||
await gotoTroop(page);
|
||||
await expect(page.locator('.troopInfo').filter({ hasText: '백마대' })).toBeVisible();
|
||||
await expect(page.locator('.troopReservedCommand').first()).toContainText('1: 집합');
|
||||
await expect(page.locator('.troopReservedCommand').first()).toContainText('2: -');
|
||||
await expect(page.locator('#troopList')).not.toContainText('che_');
|
||||
|
||||
const geometry = await page
|
||||
.locator('.troopItem')
|
||||
@@ -319,6 +343,9 @@ test('matches the legacy 500px responsive placement', async ({ page }) => {
|
||||
await page.setViewportSize({ width: 500, height: 800 });
|
||||
await gotoTroop(page);
|
||||
await expect(page.locator('.troopInfo').filter({ hasText: '백마대' })).toBeVisible();
|
||||
await expect(page.locator('.troopReservedCommand').first()).toContainText('1: 집합');
|
||||
await expect(page.locator('.troopReservedCommand').first()).toContainText('2: -');
|
||||
await expect(page.locator('#troopList')).not.toContainText('che_');
|
||||
|
||||
const geometry = await page
|
||||
.locator('.troopItem')
|
||||
|
||||
@@ -20,7 +20,10 @@ const props = defineProps<{
|
||||
currentMonth?: number;
|
||||
turnTermMinutes?: number;
|
||||
serverTime?: string;
|
||||
serverWallTime?: string;
|
||||
clockMode?: 'realtime' | 'manual';
|
||||
clockRunning?: boolean;
|
||||
clockStartsAt?: string | null;
|
||||
autorunLimit?: number | null;
|
||||
storageKey?: string;
|
||||
mapData?: CommandMapData | null;
|
||||
@@ -90,8 +93,10 @@ const autonomousUntil = computed(() => {
|
||||
});
|
||||
|
||||
const currentServerTime = ref('--:--:--');
|
||||
const MAX_SERVER_CLOCK_TIMER_DELAY_MS = 60_000;
|
||||
let sampledServerTimeMs: number | null = null;
|
||||
let sampledClientTimeMs = 0;
|
||||
let sampledStartDelayMs: number | null = 0;
|
||||
let serverClockTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
|
||||
const updateServerClock = () => {
|
||||
@@ -101,21 +106,42 @@ const updateServerClock = () => {
|
||||
currentServerTime.value = '--:--:--';
|
||||
return;
|
||||
}
|
||||
const projectedTime = new Date(
|
||||
props.clockMode === 'manual' ? sampledServerTimeMs : sampledServerTimeMs + Date.now() - sampledClientTimeMs
|
||||
);
|
||||
const clientElapsedMs = Math.max(0, Date.now() - sampledClientTimeMs);
|
||||
const elapsedGameMs =
|
||||
props.clockMode === 'manual' || sampledStartDelayMs === null
|
||||
? 0
|
||||
: Math.max(0, clientElapsedMs - sampledStartDelayMs);
|
||||
const projectedTime = new Date(sampledServerTimeMs + elapsedGameMs);
|
||||
currentServerTime.value = formatLocalTimeSeconds(projectedTime);
|
||||
if (props.clockMode !== 'manual') {
|
||||
serverClockTimer = setTimeout(updateServerClock, 1_000 - projectedTime.getMilliseconds());
|
||||
if (props.clockMode !== 'manual' && sampledStartDelayMs !== null) {
|
||||
const untilStartMs = sampledStartDelayMs - clientElapsedMs;
|
||||
serverClockTimer = setTimeout(
|
||||
updateServerClock,
|
||||
untilStartMs > 0
|
||||
? Math.min(untilStartMs, MAX_SERVER_CLOCK_TIMER_DELAY_MS)
|
||||
: 1_000 - projectedTime.getMilliseconds()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
watch(
|
||||
() => [props.serverTime, props.clockMode] as const,
|
||||
([serverTime]) => {
|
||||
() => [props.serverTime, props.serverWallTime, props.clockMode, props.clockRunning, props.clockStartsAt] as const,
|
||||
([serverTime, serverWallTime, clockMode, clockRunning, clockStartsAt]) => {
|
||||
const parsed = serverTime ? new Date(serverTime).getTime() : Number.NaN;
|
||||
sampledServerTimeMs = Number.isFinite(parsed) ? parsed : null;
|
||||
sampledClientTimeMs = Date.now();
|
||||
if (clockMode === 'manual') {
|
||||
sampledStartDelayMs = null;
|
||||
} else if (clockRunning !== false) {
|
||||
sampledStartDelayMs = 0;
|
||||
} else {
|
||||
const wallTimeMs = serverWallTime ? new Date(serverWallTime).getTime() : Number.NaN;
|
||||
const startsAtMs = clockStartsAt ? new Date(clockStartsAt).getTime() : Number.NaN;
|
||||
sampledStartDelayMs =
|
||||
Number.isFinite(wallTimeMs) && Number.isFinite(startsAtMs)
|
||||
? Math.max(0, startsAtMs - wallTimeMs)
|
||||
: null;
|
||||
}
|
||||
updateServerClock();
|
||||
},
|
||||
{ immediate: true }
|
||||
|
||||
@@ -7,6 +7,7 @@ export type GeneralBattleSummaryData = {
|
||||
available?: boolean;
|
||||
experience?: number | null;
|
||||
dedicationText?: string | null;
|
||||
bill?: number | null;
|
||||
warnum?: number | null;
|
||||
wins?: number | null;
|
||||
losses?: number | null;
|
||||
@@ -62,8 +63,13 @@ const killRate = computed(() => {
|
||||
<template v-else>
|
||||
<span>명성</span><strong>{{ numberText(summary.experience) }}</strong> <span>계급</span
|
||||
><strong>{{ summary.dedicationText || '-' }}</strong>
|
||||
<span class="battle-general-extra__empty" aria-hidden="true"></span>
|
||||
<strong class="battle-general-extra__empty" aria-hidden="true"></strong>
|
||||
<template v-if="summary.bill !== undefined">
|
||||
<span>봉급</span><strong>{{ numberText(summary.bill) }}</strong>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span class="battle-general-extra__empty" aria-hidden="true"></span>
|
||||
<strong class="battle-general-extra__empty" aria-hidden="true"></strong>
|
||||
</template>
|
||||
<span>전투</span
|
||||
><strong>{{ numberText(summary.warnum) }}<template v-if="summary.warnum != null">회</template></strong>
|
||||
<span>계략</span><strong>{{ numberText(summary.strategies) }}</strong>
|
||||
|
||||
@@ -291,6 +291,7 @@ onMounted(() => {
|
||||
available: true,
|
||||
experience: selectedGeneral.experience,
|
||||
dedicationText: selectedGeneral.progression.dedicationText,
|
||||
bill: selectedGeneral.bill,
|
||||
warnum: selectedGeneral.warnum,
|
||||
wins: selectedGeneral.battleStats.kills,
|
||||
losses: selectedGeneral.battleStats.deaths,
|
||||
|
||||
@@ -267,7 +267,10 @@ watch(
|
||||
:current-month="lobbyInfo?.month"
|
||||
:turn-term-minutes="lobbyInfo?.turnTerm"
|
||||
:server-time="lobbyInfo?.serverTime"
|
||||
:server-wall-time="lobbyInfo?.serverWallTime"
|
||||
:clock-mode="lobbyInfo?.clockMode"
|
||||
:clock-running="lobbyInfo?.clockRunning"
|
||||
:clock-starts-at="lobbyInfo?.clockStartsAt"
|
||||
:autorun-limit="reservedGeneralAutorunLimit"
|
||||
:map-data="worldMap"
|
||||
:map-layout="mapLayout"
|
||||
@@ -437,7 +440,10 @@ watch(
|
||||
:current-month="lobbyInfo?.month"
|
||||
:turn-term-minutes="lobbyInfo?.turnTerm"
|
||||
:server-time="lobbyInfo?.serverTime"
|
||||
:server-wall-time="lobbyInfo?.serverWallTime"
|
||||
:clock-mode="lobbyInfo?.clockMode"
|
||||
:clock-running="lobbyInfo?.clockRunning"
|
||||
:clock-starts-at="lobbyInfo?.clockStartsAt"
|
||||
:autorun-limit="reservedGeneralAutorunLimit"
|
||||
:map-data="worldMap"
|
||||
:map-layout="mapLayout"
|
||||
|
||||
@@ -421,6 +421,7 @@ onMounted(() => {
|
||||
available: true,
|
||||
experience: data.general.experience,
|
||||
dedicationText: data.general.progression?.dedicationText,
|
||||
bill: data.general.bill,
|
||||
warnum: data.general.records.battles,
|
||||
wins: data.general.records.wins,
|
||||
losses: data.general.records.losses,
|
||||
|
||||
Reference in New Issue
Block a user