From 754368a632b83714f29496d8e158de43e91ec695 Mon Sep 17 00:00:00 2001 From: "Ksenia V. Mamich" Date: Fri, 28 Apr 2017 17:49:07 +0300 Subject: [PATCH] perf: lazy load of images in HTML report for retries --- lib/reporters/html/static/report.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/reporters/html/static/report.js b/lib/reporters/html/static/report.js index c2c4b2e58..9b73d4e1b 100644 --- a/lib/reporters/html/static/report.js +++ b/lib/reporters/html/static/report.js @@ -9,7 +9,7 @@ Clipboard = require('clipboard'); function expandAll() { - loadLazyImages(document, '.section_collapsed img'); + loadLazyImages(document, '.section_collapsed .tab__item_active img'); forEach.call(sections, function(section) { section.classList.remove('section_collapsed'); }); @@ -22,8 +22,8 @@ } function expandErrors() { - loadLazyImages(document, '.section_status_fail > .section__body > .image-box img'); - loadLazyImages(document, '.section_status_warning > .section__body > .image-box img'); + loadLazyImages(document, '.section_status_fail > .section__body > .image-box .tab__item_active img'); + loadLazyImages(document, '.section_status_warning > .section__body > .image-box .tab__item_active img'); forEach.call(sections, function(section) { if (section.classList.contains('section_status_fail') || section.classList.contains('section_status_warning')) { @@ -35,7 +35,7 @@ } function expandRetries() { - loadLazyImages(document, '.has-retries > .section__body > .image-box img'); + loadLazyImages(document, '.has-retries > .section__body > .image-box .tab__item_active img'); forEach.call(sections, function(section) { if (section.classList.contains('has-retries')) { section.classList.remove('section_collapsed'); @@ -66,6 +66,7 @@ switch_(imageBox.querySelector('.tab'), 'tab__item_active'); switch_(imageBox.querySelector('.tab-switcher'), 'tab-switcher__button_active'); + loadLazyImages(imageBox, '.tab__item_active img'); function switch_(elem, selector) { forEach.call(elem.children, function(item) { @@ -190,7 +191,7 @@ forEach.call(document.querySelectorAll('.section'), function(section) { section.querySelector('.section__title').addEventListener('click', function() { - loadLazyImages(section, ':scope > .section__body > .image-box img'); + loadLazyImages(section, ':scope > .section__body > .image-box .tab__item_active img'); section.classList.toggle('section_collapsed'); }); });