Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

recent_topics: Select the filter text on lauch.

Aman Agrawal9b862cd73f8b
diff --git a/frontend_tests/node_tests/recent_topics.js b/frontend_tests/node_tests/recent_topics.js
index 4d57dc8db0c..91eed1dc217 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 table stub>';
});
+ $("#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 4b19c5c8557..e1eb7fcb4ea 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;