diff --git a/web/src/activity_ui.ts b/web/src/activity_ui.ts index 0748538524..9a5405c840 100644 --- a/web/src/activity_ui.ts +++ b/web/src/activity_ui.ts @@ -83,7 +83,7 @@ export function searching(): boolean { } export function render_empty_user_list_message_if_needed($container: JQuery): void { - const empty_list_message = $container.data("search-results-empty"); + const empty_list_message = $container.attr("data-search-results-empty"); if (!empty_list_message || $container.children().length) { return; diff --git a/web/src/buddy_list.ts b/web/src/buddy_list.ts index 8754e59b02..f8e9ea2f42 100644 --- a/web/src/buddy_list.ts +++ b/web/src/buddy_list.ts @@ -291,8 +291,8 @@ export class BuddyList extends BuddyListConf { } } - $("#buddy-list-users-matching-view").data( - "search-results-empty", + $("#buddy-list-users-matching-view").attr( + "data-search-results-empty", matching_view_empty_list_message, ); if ($("#buddy-list-users-matching-view .empty-list-message").length) { @@ -302,7 +302,10 @@ export class BuddyList extends BuddyListConf { $("#buddy-list-users-matching-view").html(empty_list_widget_html); } - $("#buddy-list-other-users").data("search-results-empty", other_users_empty_list_message); + $("#buddy-list-other-users").attr( + "data-search-results-empty", + other_users_empty_list_message, + ); if ($("#buddy-list-other-users .empty-list-message").length) { const empty_list_widget_html = render_empty_list_widget_for_list({ other_users_empty_list_message, diff --git a/web/src/list_widget.ts b/web/src/list_widget.ts index 6ec2f51a1b..20a180825b 100644 --- a/web/src/list_widget.ts +++ b/web/src/list_widget.ts @@ -215,7 +215,7 @@ export function render_empty_list_message_if_needed( ): void { let empty_list_message = $container.data("empty"); - const empty_search_results_message = $container.data("search-results-empty"); + const empty_search_results_message = $container.attr("data-search-results-empty"); if (filter_value && empty_search_results_message) { empty_list_message = empty_search_results_message; } diff --git a/web/tests/activity.test.js b/web/tests/activity.test.js index 2d1d0c5c75..9eb6271207 100644 --- a/web/tests/activity.test.js +++ b/web/tests/activity.test.js @@ -489,7 +489,8 @@ test("render_empty_user_list_message", ({override, mock_template}) => { append($data) { $appended_data = $data; }, - data() { + attr(name) { + assert.equal(name, "data-search-results-empty"); return empty_list_message; }, children: () => [], diff --git a/web/tests/list_widget.test.js b/web/tests/list_widget.test.js index 90b78fff88..bc13b50f2b 100644 --- a/web/tests/list_widget.test.js +++ b/web/tests/list_widget.test.js @@ -45,6 +45,7 @@ const ListWidget = zrequire("list_widget"); function make_container() { const $container = {}; + $container.attr = noop; $container.empty = noop; $container.data = noop; diff --git a/web/tests/user_search.test.js b/web/tests/user_search.test.js index 5011b71e9d..a938764f49 100644 --- a/web/tests/user_search.test.js +++ b/web/tests/user_search.test.js @@ -10,10 +10,10 @@ const {realm} = require("./lib/zpage_params"); const fake_buddy_list = { scroll_container_selector: "#whatever", $users_matching_view_container: { - data() {}, + attr() {}, }, $other_users_container: { - data() {}, + attr() {}, }, find_li() {}, first_key() {},