diff --git a/frontend_tests/node_tests/recent_topics.js b/frontend_tests/node_tests/recent_topics.js index 4d57dc8db0..91eed1dc21 100644 --- a/frontend_tests/node_tests/recent_topics.js +++ b/frontend_tests/node_tests/recent_topics.js @@ -318,11 +318,20 @@ run_test("test_recent_topics_launch", () => { return ''; }); + $("#recent_topics_search").selected = false; + $("#recent_topics_search").select = () => { + $("#recent_topics_search").selected = true; + }; + const rt = zrequire('recent_topics'); rt.process_messages(messages); + assert.equal($("#recent_topics_search").selected, false); + rt.launch(); - assert.equal($("#recent_topics_search").is(":focus"), true); + + // Test if search text is selected + assert.equal($("#recent_topics_search").selected, true); overlays.close_callback(); // incorrect topic_key diff --git a/static/js/recent_topics.js b/static/js/recent_topics.js index 4b19c5c855..e1eb7fcb4e 100644 --- a/static/js/recent_topics.js +++ b/static/js/recent_topics.js @@ -349,7 +349,7 @@ exports.launch = function () { }, }); exports.complete_rerender(); - $("#recent_topics_search").focus(); + $("#recent_topics_search").select(); }; window.recent_topics = exports;