recent_topics: Select the filter text on lauch.

This will allow users to easily search for new topics
without losing the last filtered text.
This commit is contained in:
Aman Agrawal
2020-06-13 17:30:32 +05:30
committed by Tim Abbott
parent 79d829bda1
commit 9b862cd73f
2 changed files with 11 additions and 2 deletions

View File

@@ -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

View File

@@ -349,7 +349,7 @@ exports.launch = function () {
},
});
exports.complete_rerender();
$("#recent_topics_search").focus();
$("#recent_topics_search").select();
};
window.recent_topics = exports;