Skip to content

Commit

Permalink
Fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
AshGDS committed Apr 26, 2024
1 parent 9b81f71 commit acb643c
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* global nodeListForEach */
// This component relies on JavaScript from GOV.UK Frontend
// = require govuk/components/accordion/accordion.js
;window.GOVUK = window.GOVUK || {}
Expand Down Expand Up @@ -79,11 +78,12 @@ window.GOVUK.Modules.GovukAccordion = window.GOVUKFrontend.Accordion;
GemAccordion.prototype.addEventListenersForAnchors = function () {
var links = this.$module.querySelectorAll(this.sectionInnerContentClass + ' a[href*="#"]')

nodeListForEach(links, function (link) {

for(var link of links) {
if (link.pathname === window.location.pathname) {
link.addEventListener('click', this.openForAnchor.bind(this, link.hash.split('#')[1]))
}
}.bind(this))
}
}

// Find the parent accordion section for the given id and open it
Expand Down Expand Up @@ -147,9 +147,10 @@ window.GOVUK.Modules.GovukAccordion = window.GOVUKFrontend.Accordion;

GemAccordion.prototype.addEventListenerSections = function () {
var sections = this.$module.querySelectorAll(this.sectionButton)
nodeListForEach(sections, function (section) {

for(var section of sections) {
section.addEventListener('click', this.addAccordionSectionTracking.bind(this, section))
}.bind(this))
}
}

// If the Accordion's sections are opened on click, then pass them to the GA event tracking
Expand Down

0 comments on commit acb643c

Please sign in to comment.