feat: 내정보 상세 설명 툴팁 이관

말·무기·서적·도구·병종·특기 설명과 국가 성향 정보를 API에 투영하고 Tippy.js 기반 공용 툴팁으로 표시한다. 실제 Chromium의 hover·focus와 모바일 경계를 회귀 테스트한다.
This commit is contained in:
2026-08-21 15:55:44 +00:00
parent 9e0f1f6003
commit a0e64a6f74
10 changed files with 708 additions and 30 deletions
@@ -1,6 +1,7 @@
import { describe, expect, it } from 'vitest';
import {
formatCrewTypeRequirement,
resolveCityLevelName,
resolveDedicationLevelName,
resolveNationLevelName,
@@ -29,4 +30,27 @@ describe('Ref GUI display names', () => {
expect(resolveCityLevelName(99)).toBe('-');
expect(resolveRegionName(99)).toBe('-');
});
it('formats crew-type requirements with the same text as Ref tooltips', () => {
expect(formatCrewTypeRequirement({ type: 'ReqTech', tech: 1_000 })).toBe('기술력 1000 이상 필요');
expect(formatCrewTypeRequirement({ type: 'ReqRegions', regions: ['중원', '오월'] })).toBe(
'중원, 오월 지역 소유시 가능'
);
expect(formatCrewTypeRequirement({ type: 'ReqCitiesWithCityLevel', level: 8, cities: ['완'] })).toBe(
'완 특성 소유시 가능'
);
expect(formatCrewTypeRequirement({ type: 'ReqHighLevelCities', level: 7, count: 4 })).toBe(
'대성 4개 이상 소유시 가능'
);
expect(formatCrewTypeRequirement({ type: 'ReqNationAux', key: 'can_대검병사용', op: '==', value: 1 })).toBe(
'대검병 연구 시 가능'
);
expect(formatCrewTypeRequirement({ type: 'ReqNationAux', key: 'did_특성초토화', op: '>=', value: 1 })).toBe(
'특성 초토화 시 가능'
);
expect(formatCrewTypeRequirement({ type: 'ReqMinRelYear', year: 3 })).toBe('3년 경과 후 사용 가능');
expect(formatCrewTypeRequirement({ type: 'ReqChief' })).toBe('군주 및 수뇌부만 가능');
expect(formatCrewTypeRequirement({ type: 'ReqNotChief' })).toBe('군주 및 수뇌부는 불가');
expect(formatCrewTypeRequirement({ type: 'Impossible' })).toBe('불가능');
});
});
@@ -424,13 +424,21 @@ describe('in-game my information ownership', () => {
general: {
officerLevelText: '간의대부',
crewTypeName: '보병',
crewTypeInfo: {
name: '보병',
info: ['표준적인 보병입니다.', '보병은 방어특화이며,', '상대가 회피하기 어렵습니다.'],
requirements: [],
stats: { attack: 100, defence: 150, speed: 7, avoid: 10, magicCoef: 0, cost: 9, rice: 9 },
},
progression: { experienceLevel: 4, dedicationLevel: 2, dedicationText: '29품관' },
itemNames: { horse: '노새(+3)' },
itemInfo: { horse: '통솔 +3' },
},
city: { levelName: '특', regionName: '중원', nationName: '위' },
nation: {
levelName: '주자사',
typeName: '법가',
typeInfo: '금수입↑ 치안↑ 인구↓ 민심↓',
capitalCityName: '업',
},
});
@@ -508,6 +516,12 @@ describe('in-game my information ownership', () => {
specialDomestic: '상재',
specialWar: '신산',
},
traitInfo: {
personal: '사기 -5, 징·모병 비용 -20%',
specialDomestic: '[내정] 상업 투자 : 기본 보정 +10%, 성공률 +10%p, 비용 -20%',
specialWar:
'[계략] 화계·탈취·파괴·선동 : 성공률 +10%p<br>[전투] 계략 시도 확률 +20%p, 계략 성공 확률 +20%p',
},
},
nation: {
id: 0,
@@ -518,6 +532,7 @@ describe('in-game my information ownership', () => {
rice: 0,
tech: 0,
typeCode: 'None',
typeInfo: '',
capitalCityId: null,
},
});