Hide the redundant Aniimo skill heading for a single selection

The skill heading only helps tell two selected elements apart, so it now shows
for double selections alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-05 19:26:49 +01:00
parent 243465720f
commit 9a4de4a23d
3 changed files with 13 additions and 10 deletions

View file

@ -921,9 +921,10 @@ de 1100 px, puis s'empilent en dessous. Dans chaque compétence, les trois group
offensifs et défensifs utilisent trois colonnes régulières. Les boxes utilisent
une hauteur pilotée par leur contenu, égale au sein de chaque rangée, et repassent
sur une colonne quand leur panneau mesure moins de 460 px. Chaque compétence
sélectionnée est introduite par une barre `nds-section-heading` : le libellé
« Compétence » et le badge doré contenant l'icône et le nom de l'élément sont
regroupés à gauche. Elle conserve ses propres groupes offensifs (« Peu efficace », « Efficacité normale »,
sélectionnée est introduite par une barre `nds-section-heading` uniquement lors
d'une sélection double : le libellé « Compétence » et le badge doré contenant
l'icône et le nom de l'élément sont regroupés à gauche. Pour une sélection simple,
la barre redondante est masquée. Chaque compétence conserve ses propres groupes offensifs (« Peu efficace », « Efficacité normale »,
« Efficace »). Les groupes défensifs vont de « Très résistant » à « Très vulnérable »
et affichent le produit des affinités sélectionnées. Les groupes vides sont omis.
Chaque box associe un libellé explicite, le multiplicateur numérique et la liste

View file

@ -26,11 +26,7 @@ for (const width of [768, 1440]) {
await expect(defense).toHaveClass(/nds-panel/);
const group = (panel, name) => panel.getByRole("region", { name, exact: true });
const waterAttack = attack.getByRole("region", { name: /Compétence.*Eau/ });
const skillHeading = waterAttack.getByRole("heading", { level: 3, name: /Compétence.*Eau/ });
await expect(skillHeading).toHaveClass(/nds-section-heading/);
await expect(skillHeading).toHaveCSS("justify-content", "flex-start");
await expect(skillHeading).toHaveCSS("column-gap", "12px");
await expect(skillHeading.locator(".aniimo-skill-element")).toContainText("Eau");
await expect(waterAttack.locator(".aniimo-skill-heading")).toHaveCount(0);
await expect(group(waterAttack, "Efficace")).toContainText("×1,6");
await expect(group(waterAttack, "Efficace").getByRole("listitem")).toHaveText(["Feu", "Roche"]);
await expect(group(defense, "Résistant")).toContainText("×0,625");
@ -43,6 +39,12 @@ for (const width of [768, 1440]) {
await expect(ice).toHaveAttribute("aria-pressed", "true");
await expect(picker.getByRole("button", { name: "Feu", exact: true })).toBeDisabled();
const iceAttack = attack.getByRole("region", { name: /Compétence.*Glace/ });
const skillHeading = waterAttack.getByRole("heading", { level: 3, name: /Compétence.*Eau/ });
await expect(skillHeading).toHaveClass(/nds-section-heading/);
await expect(skillHeading).toHaveCSS("justify-content", "flex-start");
await expect(skillHeading).toHaveCSS("column-gap", "12px");
await expect(skillHeading.locator(".aniimo-skill-element")).toContainText("Eau");
await expect(iceAttack.locator(".aniimo-skill-heading")).toHaveCount(1);
await expect(group(waterAttack, "Efficace").getByRole("listitem")).toHaveText(["Feu", "Roche"]);
await expect(group(iceAttack, "Peu efficace")).toContainText("×0,625");
await expect(group(iceAttack, "Peu efficace").getByRole("listitem")).toHaveText(["Feu", "Roche", "Glace"]);

View file

@ -58,8 +58,8 @@ export function AniimoElements({ game, aniimo, content }) {
{results ? <div className="aniimo-matchup-panels">
<section className="nds-panel aniimo-matchup-panel" aria-labelledby="aniimo-attack-title">
<h2 id="aniimo-attack-title">{content.attack}</h2><p>{content.attackHelp}</p>
{selected.map((element, index) => <section key={element} className="aniimo-attack-element" aria-labelledby={`aniimo-attack-${element}`}>
<h3 id={`aniimo-attack-${element}`} className="nds-section-heading aniimo-skill-heading"><span className="aniimo-skill-label">{content.skill}</span><span className="nds-badge aniimo-skill-element" data-variant="gold"><ElementLabel element={element} t={t} size={28} /></span></h3>
{selected.map((element, index) => <section key={element} className="aniimo-attack-element" aria-label={selected.length === 1 ? `${content.skill} ${t(element)}` : undefined} aria-labelledby={selected.length > 1 ? `aniimo-attack-${element}` : undefined}>
{selected.length > 1 ? <h3 id={`aniimo-attack-${element}`} className="nds-section-heading aniimo-skill-heading"><span className="aniimo-skill-label">{content.skill}</span><span className="nds-badge aniimo-skill-element" data-variant="gold"><ElementLabel element={element} t={t} size={28} /></span></h3> : null}
<MatchupGroups entries={results.map((row) => ({ element: row.element, multiplier: row.attack[index].multiplier }))} prefix={`aniimo-attack-${element}-band`} content={content} t={t} />
</section>)}
</section>