diff --git a/spec/helpers/helper.js b/spec/helpers/helper.js index 8832fd4937..84d04a73b7 100644 --- a/spec/helpers/helper.js +++ b/spec/helpers/helper.js @@ -1,6 +1,3 @@ -/* eslint-disable no-undef */ -/* eslint-disable no-unused-vars */ - const KEYMAP = { '27': 'Escape', '32': 'Space', @@ -121,6 +118,7 @@ const KEYMAP = { '105': '9' }; +// eslint-disable-next-line @typescript-eslint/no-unused-vars function XloadHtml(html, options) { options = options ? options : {}; const defaultOptions = { insertionType: 'append' }; @@ -128,11 +126,9 @@ function XloadHtml(html, options) { ...defaultOptions, ...options }; - const div = document.createElement('div'); div.classList.add('please-delete-me'); div.innerHTML = html; - if (options.insertionType === 'append') { document.body.appendChild(div); } else if (options.insertionType === 'prepend') { @@ -140,9 +136,9 @@ function XloadHtml(html, options) { } } +// eslint-disable-next-line @typescript-eslint/no-unused-vars function XunloadFixtures() { document.querySelectorAll('.please-delete-me').forEach((el) => el.remove()); - // document.querySelectorAll('.material-tooltip').forEach((el) => el.remove()); document.querySelectorAll('.dropdown-content').forEach((el) => el.remove()); } @@ -152,7 +148,7 @@ beforeEach(() => { toExist: (util, customEqualityTesters) => { return { compare: (actual) => { - let result = {}; + const result = {}; result.pass = util.equals(!!actual, true, customEqualityTesters); return result; } @@ -190,7 +186,7 @@ beforeEach(() => { return { compare: (actual) => { const style = getComputedStyle(actual); - let result = {}; + const result = {}; result.pass = util.equals( style.getPropertyValue('display'), 'none', @@ -204,7 +200,7 @@ beforeEach(() => { return { compare: (actual) => { const style = getComputedStyle(actual); - let result = {}; + const result = {}; result.pass = !util.equals( style.getPropertyValue('display'), 'none', @@ -224,7 +220,7 @@ beforeEach(() => { toHaveClass: (util, customEqualityTesters) => { return { compare: (actual, expected) => { - let result = {}; + const result = {}; result.pass = util.equals( actual.classList.contains(expected), true, @@ -237,7 +233,7 @@ beforeEach(() => { toNotHaveClass: (util, customEqualityTesters) => { return { compare: function (actual, expected) { - let result = {}; + const result = {}; result.pass = util.equals( actual.classList.contains(expected), false, diff --git a/spec/tests/autocomplete/autocompleteSpec.js b/spec/tests/autocomplete/autocompleteSpec.js index cf8a57147d..7ad08978f7 100644 --- a/spec/tests/autocomplete/autocompleteSpec.js +++ b/spec/tests/autocomplete/autocompleteSpec.js @@ -96,7 +96,7 @@ describe('Autocomplete Plugin', () => { } const limitedInstance = M.Autocomplete.getInstance(limited); const limit = 20; - limitedInstance.options.onSearch = (text) => { + limitedInstance.options.onSearch = () => { const filteredItems = data.slice(0, limit); limitedInstance.setMenuItems(filteredItems); }; @@ -114,8 +114,8 @@ describe('Autocomplete Plugin', () => { }); it('should open correctly from typing', (done) => { - let normal = document.querySelector('#normal-autocomplete'); - let autocompleteEl = normal.parentNode.querySelector('.autocomplete-content'); + const normal = document.querySelector('#normal-autocomplete'); + const autocompleteEl = normal.parentNode.querySelector('.autocomplete-content'); focus(normal); normal.value = 'e'; keyup(normal, 69); @@ -129,8 +129,8 @@ describe('Autocomplete Plugin', () => { }); it('should open correctly from keyboard focus', (done) => { - let normal = document.querySelector('#normal-autocomplete'); - let autocompleteEl = normal.parentNode.querySelector('.autocomplete-content'); + const normal = document.querySelector('#normal-autocomplete'); + const autocompleteEl = normal.parentNode.querySelector('.autocomplete-content'); normal.value = 'e'; keyup(normal, 9); focus(normal); diff --git a/spec/tests/cards/cardsSpec.js b/spec/tests/cards/cardsSpec.js index 138f395ede..3072a52b71 100644 --- a/spec/tests/cards/cardsSpec.js +++ b/spec/tests/cards/cardsSpec.js @@ -1,5 +1,3 @@ -/* eslint-disable no-undef */ - describe('Cards', () => { const fixture = `
@@ -150,13 +148,13 @@ describe('Cards', () => { }); it('should have small card dimensions', () => { - let cardImage = small.querySelector('.card-image'); - let cardContent = small.querySelector('.card-content'); - let cardAction = small.querySelector('.card-action'); - let smallRect = small.getBoundingClientRect(); - let cardImageRect = cardImage.getBoundingClientRect(); - let cardContentRect = cardContent.getBoundingClientRect(); - let cardActionRect = cardAction.getBoundingClientRect(); + const cardImage = small.querySelector('.card-image'); + const cardContent = small.querySelector('.card-content'); + const cardAction = small.querySelector('.card-action'); + const smallRect = small.getBoundingClientRect(); + const cardImageRect = cardImage.getBoundingClientRect(); + const cardContentRect = cardContent.getBoundingClientRect(); + const cardActionRect = cardAction.getBoundingClientRect(); expect(smallRect.height).toEqual(300, 'small card should be 300px high'); expect(cardImageRect.height).toBeLessThan(181, 'small image should be <= 180px or 60% high'); @@ -171,13 +169,13 @@ describe('Cards', () => { }); it('should have medium card dimensions', () => { - let cardImage = medium.querySelector('.card-image'); - let cardContent = medium.querySelector('.card-content'); - let cardAction = medium.querySelector('.card-action'); - let mediumRect = medium.getBoundingClientRect(); - let cardImageRect = cardImage.getBoundingClientRect(); - let cardContentRect = cardContent.getBoundingClientRect(); - let cardActionRect = cardAction.getBoundingClientRect(); + const cardImage = medium.querySelector('.card-image'); + const cardContent = medium.querySelector('.card-content'); + const cardAction = medium.querySelector('.card-action'); + const mediumRect = medium.getBoundingClientRect(); + const cardImageRect = cardImage.getBoundingClientRect(); + const cardContentRect = cardContent.getBoundingClientRect(); + const cardActionRect = cardAction.getBoundingClientRect(); expect(mediumRect.height).toEqual(400, 'medium card should be 400px high'); expect(cardImageRect.height).toBeLessThan(241, 'medium image should be <= 240 or 60% high'); @@ -192,13 +190,13 @@ describe('Cards', () => { }); it('should have large card dimensions', () => { - let cardImage = large.querySelector('.card-image'); - let cardContent = large.querySelector('.card-content'); - let cardAction = large.querySelector('.card-action'); - let largeRect = large.getBoundingClientRect(); - let cardImageRect = cardImage.getBoundingClientRect(); - let cardContentRect = cardContent.getBoundingClientRect(); - let cardActionRect = cardAction.getBoundingClientRect(); + const cardImage = large.querySelector('.card-image'); + const cardContent = large.querySelector('.card-content'); + const cardAction = large.querySelector('.card-action'); + const largeRect = large.getBoundingClientRect(); + const cardImageRect = cardImage.getBoundingClientRect(); + const cardContentRect = cardContent.getBoundingClientRect(); + const cardActionRect = cardAction.getBoundingClientRect(); expect(largeRect.height).toEqual(500, 'large card should be 500px high'); expect(cardImageRect.height).toBeLessThan(301, 'large image should be <= 300 or 60% high'); diff --git a/spec/tests/carousel/carouselSpec.js b/spec/tests/carousel/carouselSpec.js index 4e87226dfd..933036d025 100644 --- a/spec/tests/carousel/carouselSpec.js +++ b/spec/tests/carousel/carouselSpec.js @@ -1,5 +1,3 @@ -/* eslint-disable no-undef */ - describe('Carousel', () => { const fixture = `