From 598b4c59a6f841fc22908c40c7b078e3a065124d Mon Sep 17 00:00:00 2001 From: GeoSot Date: Mon, 6 Sep 2021 10:46:03 +0300 Subject: [PATCH] Use `for...of` in visual tests too --- js/tests/visual/modal.html | 17 ++++++++--------- js/tests/visual/popover.html | 8 ++++---- js/tests/visual/toast.html | 36 ++++++++++++++++++------------------ js/tests/visual/tooltip.html | 8 ++++---- 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/js/tests/visual/modal.html b/js/tests/visual/modal.html index eeb0aa567a..719e9cc10e 100644 --- a/js/tests/visual/modal.html +++ b/js/tests/visual/modal.html @@ -220,15 +220,14 @@ } } - Array.prototype.slice.call(document.querySelectorAll('[data-bs-toggle="popover"]')) - .forEach(function (popover) { - new Popover(popover) - }) - - var tooltipList = Array.prototype.slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')) - tooltipList.forEach(function (tooltip) { - new Tooltip(tooltip) - }) + var popoverElements = document.querySelectorAll('[data-bs-toggle="popover"]') + for (const popoverEl of popoverElements) { + new Popover(popoverEl) + } + var tooltipElements = document.querySelectorAll('[data-bs-toggle="tooltip"]') + for (const tooltipEl of tooltipElements) { + new Tooltip(tooltipEl) + } var tallToggle = document.getElementById('tall-toggle') var tall = document.getElementById('tall') diff --git a/js/tests/visual/popover.html b/js/tests/visual/popover.html index f914f2b3be..3503271ae4 100644 --- a/js/tests/visual/popover.html +++ b/js/tests/visual/popover.html @@ -40,10 +40,10 @@ diff --git a/js/tests/visual/toast.html b/js/tests/visual/toast.html index 3971a60755..f9e1741cfa 100644 --- a/js/tests/visual/toast.html +++ b/js/tests/visual/toast.html @@ -57,26 +57,26 @@ diff --git a/js/tests/visual/tooltip.html b/js/tests/visual/tooltip.html index 29248f9daf..448841e588 100644 --- a/js/tests/visual/tooltip.html +++ b/js/tests/visual/tooltip.html @@ -92,10 +92,10 @@ }) } - Array.prototype.slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')) - .forEach(function (tooltip) { - new Tooltip(tooltip) - }) + var tooltipElements = document.querySelectorAll('[data-bs-toggle="tooltip"]') + for (const tooltipEl of tooltipElements) { + new Tooltip(tooltipEl) + } var tooltipElement = document.getElementById('tooltipElement') var tooltipElementInstance = new Tooltip(tooltipElement, {