diff --git a/components/test-run-alerts/index.php b/components/test-run-alerts/index.php index 490aa33..741e51d 100644 --- a/components/test-run-alerts/index.php +++ b/components/test-run-alerts/index.php @@ -63,27 +63,35 @@ class="vrts-test-run-alerts__card-link" - component( 'test-run-receipt', $data ); ?> + diff --git a/components/test-run-alerts/script.js b/components/test-run-alerts/script.js index 22aa982..553663e 100644 --- a/components/test-run-alerts/script.js +++ b/components/test-run-alerts/script.js @@ -150,7 +150,9 @@ class VrtsTestRunAlerts extends window.HTMLElement { } const href = $el.getAttribute( 'href' ); - const $comparisons = document.querySelector( 'vrts-comparisons' ); + const $content = + document.querySelector( 'vrts-comparisons' ) || + document.querySelector( 'vrts-test-run-success' ); const $pagination = document.querySelector( 'vrts-test-run-pagination' ); @@ -162,7 +164,7 @@ class VrtsTestRunAlerts extends window.HTMLElement { $el.setAttribute( 'data-vrts-current', 'true' ); const timeout = setTimeout( () => { - $comparisons.setAttribute( 'data-vrts-loading', 'true' ); + $content.setAttribute( 'data-vrts-loading', 'true' ); }, 200 ); fetch( href ) @@ -173,8 +175,9 @@ class VrtsTestRunAlerts extends window.HTMLElement { const parser = new window.DOMParser(); const $html = parser.parseFromString( data, 'text/html' ); - const $newComparisons = - $html.querySelector( 'vrts-comparisons' ); + const $newContent = + $html.querySelector( 'vrts-comparisons' ) || + $html.querySelector( 'vrts-test-run-success' ); const $newPagination = $html.querySelector( 'vrts-test-run-pagination' ); @@ -182,12 +185,12 @@ class VrtsTestRunAlerts extends window.HTMLElement { window.history.replaceState( {}, '', href ); window.scrollTo( { - top: $comparisons.offsetTop - 62, + top: $content.offsetTop - 62, behavior: 'smooth', } ); - if ( $newComparisons ) { - $comparisons.replaceWith( $newComparisons ); + if ( $newContent ) { + $content.replaceWith( $newContent ); } if ( $newPagination ) { diff --git a/components/test-run-page/index.php b/components/test-run-page/index.php index 7767002..4dc330a 100644 --- a/components/test-run-page/index.php +++ b/components/test-run-page/index.php @@ -5,9 +5,15 @@