diff --git a/src/components/panel/_macro.njk b/src/components/panel/_macro.njk index 40bd88a5fe..ff0cb9dd26 100644 --- a/src/components/panel/_macro.njk +++ b/src/components/panel/_macro.njk @@ -50,7 +50,7 @@ {{ params.assistiveTextPrefix | default("Announcement: ") }} {% endif %} - {% if params.title %} + {% if params.title and (params.variant not in ['bare', 'warn', 'warn-branded', 'announcement'] ) %} {% if params.variant == 'error' %} {% set defaultTitleTag = "h" ~ 2 %} {% else %} diff --git a/src/components/panel/_macro.spec.js b/src/components/panel/_macro.spec.js index fb7c35d0db..6bf4abbc91 100644 --- a/src/components/panel/_macro.spec.js +++ b/src/components/panel/_macro.spec.js @@ -32,7 +32,7 @@ describe('macro: panel', () => { expect(results).toHaveNoViolations(); }); - it('has correct class', () => { + it('has correct panel variant class', () => { const $ = cheerio.load( renderComponent('panel', { ...EXAMPLE_PANEL_BASIC, @@ -173,6 +173,20 @@ describe('macro: panel', () => { }); }); + describe.each(['bare', 'warn', 'warn-branded', 'announcement'])('mode: %s', (panelVariant) => { + it('does not render a title when `title` is provided', () => { + const $ = cheerio.load( + renderComponent('panel', { + ...EXAMPLE_PANEL_BASIC, + title: 'Panel title', + variant: panelVariant, + }), + ); + + expect($('.ons-panel__title').length).toBe(0); + }); + }); + describe.each([ ['error', 'h2'], ['success', 'div'],