mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
filter_input: Add explicit classname for filter clear button.
This commit adds an explicit "input-close-filter-button" classname to the filter input clear button, improving the readability of the code.
This commit is contained in:
@@ -824,7 +824,11 @@ export function initialize(): void {
|
||||
|
||||
// LEFT SIDEBAR
|
||||
|
||||
$("body").on("click", ".filter-topics .input-button", topic_list.clear_topic_search);
|
||||
$("body").on(
|
||||
"click",
|
||||
".filter-topics .input-close-filter-button",
|
||||
topic_list.clear_topic_search,
|
||||
);
|
||||
|
||||
$(".streams_filter_icon").on("click", (e) => {
|
||||
e.stopPropagation();
|
||||
|
||||
@@ -2,7 +2,7 @@ import $ from "jquery";
|
||||
|
||||
$("body").on(
|
||||
"click",
|
||||
".filter-input .input-button",
|
||||
".filter-input .input-close-filter-button",
|
||||
function (this: HTMLElement, _e: JQuery.Event) {
|
||||
const $input = $(this).prev(".input-element");
|
||||
$input.val("").trigger("input");
|
||||
|
||||
@@ -1063,7 +1063,7 @@ export function set_event_handlers({
|
||||
e.preventDefault();
|
||||
if (
|
||||
e.target.id === "streams_inline_icon" ||
|
||||
$(e.target).parent().hasClass("input-button")
|
||||
$(e.target).parent().hasClass("input-close-filter-button")
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ export class UserSearch {
|
||||
this._update_list = opts.update_list;
|
||||
this._on_focus = opts.on_focus;
|
||||
|
||||
$("#userlist-header-search .input-button").on("click", () => {
|
||||
$("#userlist-header-search .input-close-filter-button").on("click", () => {
|
||||
this.clear_search();
|
||||
});
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
the right padding to compensate for the same. */
|
||||
padding-right: 0.5em;
|
||||
|
||||
~ .input-button {
|
||||
~ .input-close-filter-button {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
@@ -137,7 +137,7 @@
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
|
||||
.input-button {
|
||||
.input-close-filter-button {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
{{/if}}
|
||||
{{> @partial-block .}}
|
||||
{{#if input_button_icon}}
|
||||
{{> icon_button custom_classes="input-button" squared=true icon=input_button_icon intent="neutral" }}
|
||||
{{#if (eq input_type "filter-input") }}
|
||||
{{> icon_button custom_classes="input-button input-close-filter-button" squared=true icon=input_button_icon intent="neutral" }}
|
||||
{{else}}
|
||||
{{> icon_button custom_classes="input-button" squared=true icon=input_button_icon intent="neutral" }}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
@@ -114,9 +114,9 @@ test("clear_search with button", ({override}) => {
|
||||
override(fake_buddy_list, "populate", (user_ids) => {
|
||||
assert.deepEqual(user_ids, {all_user_ids: ordered_user_ids});
|
||||
});
|
||||
$("#userlist-header-search .input-button").trigger("click");
|
||||
$("#userlist-header-search .input-close-filter-button").trigger("click");
|
||||
assert.equal($("input.user-list-filter").val(), "");
|
||||
$("#userlist-header-search .input-button").trigger("click");
|
||||
$("#userlist-header-search .input-close-filter-button").trigger("click");
|
||||
});
|
||||
|
||||
test("clear_search", ({override}) => {
|
||||
|
||||
Reference in New Issue
Block a user