dropdown: Add ability to update items in dropdown widget.

This is needed for the compose stream dropdown widget,
which is also updated here. Now when a user is subscribed
or unsubscribed from a stream, or a stream is renamed, or
or a stream is deleted, the dropdown widget updates
accordingly. This fixes a regression of this functionality
that happened during the switch to the dropdown.
This commit is contained in:
evykassirer
2023-02-09 12:45:47 -08:00
committed by Tim Abbott
parent 19a47a71d8
commit 584d3c66a3
9 changed files with 71 additions and 13 deletions

View File

@@ -23,6 +23,7 @@ const stream_list = mock_esm("../src/stream_list");
const stream_settings_ui = mock_esm("../src/stream_settings_ui");
message_lists.current = {};
const compose_ui = zrequire("compose_ui");
const peer_data = zrequire("peer_data");
const people = zrequire("people");
const server_events_dispatch = zrequire("server_events_dispatch");
@@ -197,7 +198,9 @@ test("stream create", ({override}) => {
assert.deepEqual(sub_store.get(102).name, "test");
});
test("stream delete (normal)", ({override}) => {
test("stream delete (normal)", ({override, override_rewire}) => {
override_rewire(compose_ui, "update_stream_dropdown_options", noop);
const event = event_fixtures.stream__delete;
for (const stream of event.streams) {
@@ -238,7 +241,9 @@ test("stream delete (normal)", ({override}) => {
assert.equal(removed_sidebar_rows, 1);
});
test("stream delete (special streams)", ({override}) => {
test("stream delete (special streams)", ({override, override_rewire}) => {
override_rewire(compose_ui, "update_stream_dropdown_options", noop);
const event = event_fixtures.stream__delete;
for (const stream of event.streams) {