1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-28 23:59:53 +02:00

Enable unicorn/no-array-for-each rule

This commit is contained in:
XhmikosR
2021-07-30 09:28:51 +03:00
parent 2b4d0d166b
commit 666fe596bf
23 changed files with 132 additions and 117 deletions

View File

@@ -34,17 +34,17 @@ export const jQueryMock = {
elements: undefined,
fn: {},
each(fn) {
this.elements.forEach(el => {
for (const el of this.elements) {
fn.call(el)
})
}
}
}
export const clearBodyAndDocument = () => {
const attributes = ['data-bs-padding-right', 'style']
attributes.forEach(attr => {
for (const attr of attributes) {
document.documentElement.removeAttribute(attr)
document.body.removeAttribute(attr)
})
}
}

View File

@@ -211,14 +211,14 @@ describe('Carousel', () => {
spyOn(carousel, '_triggerSlideEvent')
carousel._isSliding = true;
carousel._isSliding = true
['ArrowLeft', 'ArrowRight'].forEach(key => {
for (const key of ['ArrowLeft', 'ArrowRight']) {
const keydown = createEvent('keydown')
keydown.key = key
carouselEl.dispatchEvent(keydown)
})
}
expect(carousel._triggerSlideEvent).not.toHaveBeenCalled()
})

View File

@@ -17,10 +17,9 @@ describe('Modal', () => {
clearBodyAndDocument()
document.body.classList.remove('modal-open')
document.querySelectorAll('.modal-backdrop')
.forEach(backdrop => {
backdrop.remove()
})
for (const backdrop of document.querySelectorAll('.modal-backdrop')) {
backdrop.remove()
}
})
beforeEach(() => {

View File

@@ -15,9 +15,9 @@ describe('Popover', () => {
const popoverList = document.querySelectorAll('.popover')
popoverList.forEach(popoverEl => {
for (const popoverEl of popoverList) {
popoverEl.remove()
})
}
})
describe('VERSION', () => {

View File

@@ -15,9 +15,9 @@ describe('Tooltip', () => {
afterEach(() => {
clearFixture()
document.querySelectorAll('.tooltip').forEach(tooltipEl => {
for (const tooltipEl of document.querySelectorAll('.tooltip')) {
tooltipEl.remove()
})
}
})
describe('VERSION', () => {

View File

@@ -17,9 +17,9 @@ describe('Backdrop', () => {
clearFixture()
const list = document.querySelectorAll(CLASS_BACKDROP)
list.forEach(el => {
for (const el of list) {
el.remove()
})
}
})
describe('show', () => {
@@ -35,9 +35,10 @@ describe('Backdrop', () => {
instance.show()
instance.show(() => {
expect(getElements().length).toEqual(1)
getElements().forEach(el => {
for (const el of getElements()) {
expect(el.classList.contains(CLASS_NAME_SHOW)).toEqual(true)
})
}
done()
})
})
@@ -67,9 +68,10 @@ describe('Backdrop', () => {
instance.show(() => {
expect(getElements().length).toEqual(1)
getElements().forEach(el => {
for (const el of getElements()) {
expect(el.classList.contains(CLASS_NAME_FADE)).toEqual(true)
})
}
done()
})
})