From 6750c682ac2c2f70c5ca5e042b51de96a3977df2 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 11 Jan 2022 17:59:06 +0000 Subject: [PATCH] DEV: Add integration test for refreshing discovery-topics views This test would have detected the regression which was fixed in f94c01b2337a4fadcfa4489ab86e673ff721b1bc --- .../tests/acceptance/topic-discovery-test.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-test.js index 539b90fbbf8..ca301c13d40 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-test.js @@ -156,4 +156,26 @@ acceptance("Topic Discovery", function (needs) { await click(".navigation-container a[href='/categories']"); assert.strictEqual(currentURL(), "/categories", "switches to categories"); }); + + test("refreshing tabs", async function (assert) { + const assertShowingLatest = () => { + assert.strictEqual(currentURL(), "/latest", "stays on latest"); + const el = query(".topic-list-body .topic-list-item:first-of-type"); + assert.strictEqual(el.closest(".hidden"), null, "topic list is visible"); + assert.strictEqual( + el.dataset.topicId, + "11557", + "shows the correct topic" + ); + }; + + await visit("/latest"); + assertShowingLatest(); + + await click(".navigation-container a[href='/latest']"); + assertShowingLatest(); + + await click("#site-logo"); + assertShowingLatest(); + }); });