diff --git a/assets/javascripts/test_result.js b/assets/javascripts/test_result.js index b19372aa216..b8ea5fce0af 100644 --- a/assets/javascripts/test_result.js +++ b/assets/javascripts/test_result.js @@ -644,16 +644,20 @@ function renderTestModules(response) { setCurrentPreviewFromStepLinkIfPossible($("[href='" + hash + "'], [data-href='" + hash + "']")); } - // setup keyboard navigation through test details - $(window).keydown(handleKeyDownOnTestDetails); - - // ensure the size of the preview container is adjusted when the window size changes - $(window).resize(function () { - const currentPreview = $('.current_preview'); - if (currentPreview.length) { - setCurrentPreview($('.current_preview'), true); - } - }); + // setup event handlers for the window + if (!this.hasWindowEventHandlers) { + // setup keyboard navigation through test details + $(window).keydown(handleKeyDownOnTestDetails); + + // ensure the size of the preview container is adjusted when the window size changes + $(window).resize(function () { + const currentPreview = $('.current_preview'); + if (currentPreview.length) { + setCurrentPreview($('.current_preview'), true); + } + }); + this.hasWindowEventHandlers = true; + } // setup result filter, define function to apply filter changes const detailsFilter = $('#details-filter');