diff --git a/spec/javascripts/components/metadata-spec.js b/spec/javascripts/components/metadata-spec.js index 1921bedd9f..e23054a7d8 100644 --- a/spec/javascripts/components/metadata-spec.js +++ b/spec/javascripts/components/metadata-spec.js @@ -60,7 +60,7 @@ describe('The metadata component', function () { function init (element, target) { new GOVUK.Modules.Metadata(element).init() - var toggle = new GOVUK.Modules.GemToggle($(target)[0]) - target && toggle.init() + /* eslint-disable no-new */ + target && new GOVUK.Modules.GemToggle($(target)[0]) } }) diff --git a/spec/javascripts/components/toggle-input-class-on-focus-spec.js b/spec/javascripts/components/toggle-input-class-on-focus-spec.js index ffbb723c23..de51d15668 100644 --- a/spec/javascripts/components/toggle-input-class-on-focus-spec.js +++ b/spec/javascripts/components/toggle-input-class-on-focus-spec.js @@ -4,7 +4,7 @@ describe('A toggle class module', function () { 'use strict' - var element, toggle + var element afterEach(function () { element.remove() @@ -17,8 +17,8 @@ describe('A toggle class module', function () { '' + '') $('body').append(element) - toggle = new GOVUK.Modules.GemToggleInputClassOnFocus(element[0]) - toggle.init() + /* eslint-disable no-new */ + new GOVUK.Modules.GemToggleInputClassOnFocus(element[0]) }) it('applies the focus style on focus and removes it on blur', function () { @@ -38,8 +38,8 @@ describe('A toggle class module', function () { '' + '') $('body').append(element) - toggle = new GOVUK.Modules.GemToggleInputClassOnFocus(element[0]) - toggle.init() + /* eslint-disable no-new */ + new GOVUK.Modules.GemToggleInputClassOnFocus(element[0]) }) it('applies the focus style on load if the search box already has a value', function () { diff --git a/spec/javascripts/components/toggle-spec.js b/spec/javascripts/components/toggle-spec.js index 652c5010ba..6a775fcebf 100644 --- a/spec/javascripts/components/toggle-spec.js +++ b/spec/javascripts/components/toggle-spec.js @@ -20,8 +20,8 @@ describe('A toggle module', function () { '
Target
' + '' element = $(html) - var toggle = new GOVUK.Modules.GemToggle(element[0]) - toggle.init() + /* eslint-disable no-new */ + new GOVUK.Modules.GemToggle(element[0]) }) it('adds aria attributes to toggles', function () { @@ -42,8 +42,8 @@ describe('A toggle module', function () { '
Target
' + '' element = $(html) - var toggle = new GOVUK.Modules.GemToggle(element[0]) - toggle.init() + /* eslint-disable no-new */ + new GOVUK.Modules.GemToggle(element[0]) element.find('.my-toggle')[0].click() }) @@ -83,8 +83,8 @@ describe('A toggle module', function () { '
Target
' + '' element = $(html) - var toggle = new GOVUK.Modules.GemToggle(element[0]) - toggle.init() + /* eslint-disable no-new */ + new GOVUK.Modules.GemToggle(element[0]) element.find('.my-toggle')[0].click() }) @@ -131,8 +131,8 @@ describe('A toggle module', function () { '
Another target
' + '' element = $(html) - var toggle = new GOVUK.Modules.GemToggle(element[0]) - toggle.init() + /* eslint-disable no-new */ + new GOVUK.Modules.GemToggle(element[0]) expect(element.find('#target').is('.js-hidden')).toBe(true) expect(element.find('#another-target').is('.js-hidden')).toBe(true) @@ -155,8 +155,8 @@ describe('A toggle module', function () { '
Target
' + '' element = $(html) - var toggle = new GOVUK.Modules.GemToggle(element[0]) - toggle.init() + /* eslint-disable no-new */ + new GOVUK.Modules.GemToggle(element[0]) expect(element.find('#target').is('.myclass')).toBe(false) element.find('.my-toggle')[0].click()