mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	@@ -299,7 +299,7 @@ export function process_escape_key(e) {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (stream_list.searching()) {
 | 
					        if (stream_list.searching()) {
 | 
				
			||||||
            stream_list.escape_search();
 | 
					            stream_list.clear_and_hide_search();
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -874,16 +874,6 @@ export function searching() {
 | 
				
			|||||||
    return $(".stream-list-filter").expectOne().is(":focus");
 | 
					    return $(".stream-list-filter").expectOne().is(":focus");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function escape_search() {
 | 
					 | 
				
			||||||
    const $filter = $(".stream-list-filter").expectOne();
 | 
					 | 
				
			||||||
    if ($filter.val() === "") {
 | 
					 | 
				
			||||||
        clear_and_hide_search();
 | 
					 | 
				
			||||||
        return;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    $filter.val("");
 | 
					 | 
				
			||||||
    update_streams_for_search();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export function clear_search(e) {
 | 
					export function clear_search(e) {
 | 
				
			||||||
    e.stopPropagation();
 | 
					    e.stopPropagation();
 | 
				
			||||||
    const $filter = $(".stream-list-filter").expectOne();
 | 
					    const $filter = $(".stream-list-filter").expectOne();
 | 
				
			||||||
@@ -926,7 +916,7 @@ export function initiate_search() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function clear_and_hide_search() {
 | 
					export function clear_and_hide_search() {
 | 
				
			||||||
    const $filter = $(".stream-list-filter");
 | 
					    const $filter = $(".stream-list-filter").expectOne();
 | 
				
			||||||
    if ($filter.val() !== "") {
 | 
					    if ($filter.val() !== "") {
 | 
				
			||||||
        $filter.val("");
 | 
					        $filter.val("");
 | 
				
			||||||
        update_streams_for_search();
 | 
					        update_streams_for_search();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -84,11 +84,6 @@ run_test("basics", ({override_rewire}) => {
 | 
				
			|||||||
        assert.ok($input.is_focused());
 | 
					        assert.ok($input.is_focused());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function verify_blurred() {
 | 
					 | 
				
			||||||
        assert.ok(stream_list.searching());
 | 
					 | 
				
			||||||
        assert.ok($input.is_focused());
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    function verify_collapsed() {
 | 
					    function verify_collapsed() {
 | 
				
			||||||
        assert.ok($section.hasClass("notdisplayed"));
 | 
					        assert.ok($section.hasClass("notdisplayed"));
 | 
				
			||||||
        assert.ok(!$input.is_focused());
 | 
					        assert.ok(!$input.is_focused());
 | 
				
			||||||
@@ -163,8 +158,8 @@ run_test("basics", ({override_rewire}) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Escape a non-empty search.
 | 
					    // Escape a non-empty search.
 | 
				
			||||||
    $input.val("foo");
 | 
					    $input.val("foo");
 | 
				
			||||||
    stream_list.escape_search();
 | 
					    stream_list.clear_and_hide_search();
 | 
				
			||||||
    verify_blurred();
 | 
					    verify_collapsed();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Expand the widget.
 | 
					    // Expand the widget.
 | 
				
			||||||
    toggle_filter();
 | 
					    toggle_filter();
 | 
				
			||||||
@@ -172,7 +167,7 @@ run_test("basics", ({override_rewire}) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // Escape an empty search.
 | 
					    // Escape an empty search.
 | 
				
			||||||
    $input.val("");
 | 
					    $input.val("");
 | 
				
			||||||
    stream_list.escape_search();
 | 
					    stream_list.clear_and_hide_search();
 | 
				
			||||||
    verify_collapsed();
 | 
					    verify_collapsed();
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user