Skip to content
This repository was archived by the owner on Sep 21, 2022. It is now read-only.

Commit 754368a

Browse files
committed
perf: lazy load of images in HTML report for retries
1 parent eda123b commit 754368a

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/reporters/html/static/report.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Clipboard = require('clipboard');
1010

1111
function expandAll() {
12-
loadLazyImages(document, '.section_collapsed img');
12+
loadLazyImages(document, '.section_collapsed .tab__item_active img');
1313
forEach.call(sections, function(section) {
1414
section.classList.remove('section_collapsed');
1515
});
@@ -22,8 +22,8 @@
2222
}
2323

2424
function expandErrors() {
25-
loadLazyImages(document, '.section_status_fail > .section__body > .image-box img');
26-
loadLazyImages(document, '.section_status_warning > .section__body > .image-box img');
25+
loadLazyImages(document, '.section_status_fail > .section__body > .image-box .tab__item_active img');
26+
loadLazyImages(document, '.section_status_warning > .section__body > .image-box .tab__item_active img');
2727
forEach.call(sections, function(section) {
2828
if (section.classList.contains('section_status_fail') ||
2929
section.classList.contains('section_status_warning')) {
@@ -35,7 +35,7 @@
3535
}
3636

3737
function expandRetries() {
38-
loadLazyImages(document, '.has-retries > .section__body > .image-box img');
38+
loadLazyImages(document, '.has-retries > .section__body > .image-box .tab__item_active img');
3939
forEach.call(sections, function(section) {
4040
if (section.classList.contains('has-retries')) {
4141
section.classList.remove('section_collapsed');
@@ -66,6 +66,7 @@
6666

6767
switch_(imageBox.querySelector('.tab'), 'tab__item_active');
6868
switch_(imageBox.querySelector('.tab-switcher'), 'tab-switcher__button_active');
69+
loadLazyImages(imageBox, '.tab__item_active img');
6970

7071
function switch_(elem, selector) {
7172
forEach.call(elem.children, function(item) {
@@ -190,7 +191,7 @@
190191

191192
forEach.call(document.querySelectorAll('.section'), function(section) {
192193
section.querySelector('.section__title').addEventListener('click', function() {
193-
loadLazyImages(section, ':scope > .section__body > .image-box img');
194+
loadLazyImages(section, ':scope > .section__body > .image-box .tab__item_active img');
194195
section.classList.toggle('section_collapsed');
195196
});
196197
});

0 commit comments

Comments
 (0)