From fab100f3939e5715b126d2b1f51fd57762a3b54a Mon Sep 17 00:00:00 2001 From: Andrew Date: Mon, 11 Nov 2024 12:39:04 +0000 Subject: [PATCH 1/2] Alter section headers to be anchor tags rather than headers (#3416) --- src/components/section-navigation/_macro.njk | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/components/section-navigation/_macro.njk b/src/components/section-navigation/_macro.njk index 2c79b08f14..0c6c18b9b3 100644 --- a/src/components/section-navigation/_macro.njk +++ b/src/components/section-navigation/_macro.njk @@ -31,9 +31,12 @@ class="ons-section-nav__item{{ ' ' + item.classes if item.classes else '' }}{{ ' ons-section-nav__item--active' if isCurrent == true }}" > {% if isCurrent == true %} - {{ openingHeadingTag | replace(headingLevel, sectionItemHeadingLevel | string) | safe }} - class="ons-section-nav__link ons-section-nav__item-header" href="{{ item.url }}" - aria-current="location">{{ item.text }}{{ closingHeadingTag | replace(headingLevel, sectionItemHeadingLevel | string) | safe }} + {{ item.text }} {% else %} {{ item.text }} {% endif %} @@ -71,9 +74,9 @@ class="ons-section-nav__item{{ ' ' + item.classes if item.classes else '' }}{% if isCurrent == true %}{{ ' ' }}ons-section-nav__item--active{% endif %}" > {% if isCurrent == true %} - {{ openingHeadingTag | replace(headingLevel, sectionItemHeadingLevel | string) | safe }} - class="ons-section-nav__link ons-section-nav__item-header" href="{{ item.url }}" - aria-current="location">{{ item.text }}{{ closingHeadingTag | replace(headingLevel, sectionItemHeadingLevel | string) | safe }} + {{ item.text }} {% else %} {{ item.text }} {% endif %} From 1300be4d8f0f58c2a32b80a3bea85a8fd6ee82d6 Mon Sep 17 00:00:00 2001 From: rmccar <42928680+rmccar@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:33:26 +0000 Subject: [PATCH 2/2] Fix button logic for when `noIcon` param is set to false (#3418) --- src/components/button/_macro.njk | 2 +- src/components/button/_macro.spec.js | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/components/button/_macro.njk b/src/components/button/_macro.njk index e4f0c71b82..bb0113777b 100644 --- a/src/components/button/_macro.njk +++ b/src/components/button/_macro.njk @@ -11,7 +11,7 @@ {# Default icon position before label #} {% set iconPosition = "before" %} {% endif %} - {% elif params.iconType is not defined and params.noIcon is not defined %} + {% elif params.iconType is not defined and params.noIcon != true %} {% if params.url and params.newWindow %} {# CTA link opening in new tab #} {% set iconType = "external-link" %} diff --git a/src/components/button/_macro.spec.js b/src/components/button/_macro.spec.js index b64c38240c..12b398ad7d 100644 --- a/src/components/button/_macro.spec.js +++ b/src/components/button/_macro.spec.js @@ -351,6 +351,30 @@ describe('macro: button', () => { expect(iconsSpy.occurrences[0].iconType).toBe('arrow-next'); }); + it('has no icon when noIcon is set to true', () => { + const faker = templateFaker(); + const iconsSpy = faker.spy('icon'); + + faker.renderComponent('button', { + url: 'http://example.com', + noIcon: true, + }); + + expect(iconsSpy.occurrences[0]).toBeUndefined(); + }); + + it('has default `arrow-next` icon when noIcon is set to false', () => { + const faker = templateFaker(); + const iconsSpy = faker.spy('icon'); + + faker.renderComponent('button', { + url: 'http://example.com', + noIcon: false, + }); + + expect(iconsSpy.occurrences[0].iconType).toBe('arrow-next'); + }); + it('opens in a new window when `newWindow` is `true`', () => { const $ = cheerio.load( renderComponent('button', {