left sidebar: Clicking on a stream clears the stream search.

Clears and hides the search bar when a stream is selected from the
filtered stream list.

Fixes: #7909.
This commit is contained in:
Logan Williams 2018-01-25 19:44:30 +00:00 committed by Tim Abbott
parent 0f99610478
commit 53e4dc1a46
2 changed files with 19 additions and 0 deletions

View File

@ -365,6 +365,23 @@ casper.waitForSelector('.input-append.notdisplayed', function () {
casper.test.assertExists('.input-append.notdisplayed', 'Stream filter box not visible after second click');
});
// We search for the beginning of "Verona", not case sensitive
casper.then(function () {
casper.evaluate(function () {
$('.stream-list-filter').expectOne()
.focus()
.val('ver')
.trigger($.Event('input'));
});
});
casper.waitWhileVisible('#stream_filters [data-stream-name="Denmark"]', function () {
// Clicking the narrowed list should clear the search
casper.click('#stream_filters [data-stream-name="Verona"] a');
expect_stream();
casper.test.assertEquals(casper.fetchText('.stream-list-filter'), '', 'Clicking on a stream clears the search');
});
un_narrow();
common.then_log_out();

View File

@ -472,6 +472,8 @@ exports.initialize = function () {
popovers.hide_all();
narrow.by('stream', sub.name, {select_first_unread: true, trigger: 'sidebar'});
exports.clear_and_hide_search();
e.preventDefault();
e.stopPropagation();
});