feat(inventory): remove the requiredLevel equip gate from the detail panel
The API can no longer emit ITEM_LEVEL_REQUIREMENT_NOT_MET (Task 8 removed the level gate server-side) and InventoryItem.item no longer carries requiredLevel (Task 12). Drop the characterLevel input, the meetsLevelRequirement computed, the associated template branch and copy, and the dead German error-message mapping. Update fixtures across the inventory specs to the real InventoryItem/CharacterResponse shapes.
This commit is contained in:
@@ -12,7 +12,6 @@ const wornSword: InventoryItem = {
|
||||
name: 'Abgenutztes Kurzschwert',
|
||||
rarity: 'COMMON',
|
||||
equipmentSlot: 'WEAPON',
|
||||
requiredLevel: 1,
|
||||
weaponDamage: 8,
|
||||
bonusAttack: 0,
|
||||
bonusHp: 0,
|
||||
@@ -30,7 +29,6 @@ const banditBlade: InventoryItem = {
|
||||
name: 'Räuberklinge',
|
||||
rarity: 'COMMON',
|
||||
equipmentSlot: 'WEAPON',
|
||||
requiredLevel: 1,
|
||||
weaponDamage: 11,
|
||||
bonusAttack: 1,
|
||||
bonusHp: 0,
|
||||
@@ -42,7 +40,6 @@ const banditBlade: InventoryItem = {
|
||||
async function setup(overrides: {
|
||||
item?: InventoryItem | null;
|
||||
equippedItemInSlot?: InventoryItem | null;
|
||||
characterLevel?: number;
|
||||
busy?: boolean;
|
||||
}) {
|
||||
TestBed.resetTestingModule();
|
||||
@@ -50,7 +47,6 @@ async function setup(overrides: {
|
||||
const fixture = TestBed.createComponent(InventoryDetailPanelComponent);
|
||||
fixture.componentRef.setInput('item', overrides.item ?? null);
|
||||
fixture.componentRef.setInput('equippedItemInSlot', overrides.equippedItemInSlot ?? null);
|
||||
fixture.componentRef.setInput('characterLevel', overrides.characterLevel ?? 1);
|
||||
fixture.componentRef.setInput('busy', overrides.busy ?? false);
|
||||
fixture.detectChanges();
|
||||
return fixture;
|
||||
@@ -79,12 +75,13 @@ describe('InventoryDetailPanelComponent', () => {
|
||||
expect(text).toContain('+1');
|
||||
});
|
||||
|
||||
it('shows a disabled Benötigt Stufe X button when the level requirement is not met', async () => {
|
||||
const fixture = await setup({ item: { ...banditBlade, item: { ...banditBlade.item, requiredLevel: 5 } }, characterLevel: 1 });
|
||||
const button = (fixture.nativeElement as HTMLElement).querySelector<HTMLButtonElement>('[data-detail-equip]');
|
||||
it('always shows the plain equip button for an owned equippable item', async () => {
|
||||
const fixture = await setup({ item: banditBlade });
|
||||
const element = fixture.nativeElement as HTMLElement;
|
||||
|
||||
expect(button?.textContent).toContain('Benötigt Stufe 5');
|
||||
expect(button?.disabled).toBe(true);
|
||||
const button = element.querySelector<HTMLButtonElement>('[data-detail-equip]');
|
||||
expect(button?.disabled).toBe(false);
|
||||
expect(button?.textContent?.trim()).toBe('Ausrüsten');
|
||||
});
|
||||
|
||||
it('emits equip with the characterItemId when Ausrüsten is clicked', async () => {
|
||||
|
||||
Reference in New Issue
Block a user