Josh Gilley
de74d2fd7c
settings: Use HTML table for "Alert Words" for better icon alignment.
...
"Alert Words" is one of Zulip's oldest settings UI elements, and as a
result is buggy. This commit converts it to use our standard
progressive-table-wrapper system used for settings tables, which has
the side effect of fixing a bug that mad ethe tables look pretty bad
if one adds a very long word.
Fixes #17172 .
2021-03-05 14:38:56 -08:00
Steve Howell
ff09d8af03
node tests: Test empty string for input_pill.
2021-03-05 12:57:20 -05:00
Steve Howell
f6edaaab96
node tests: Test upload.feature_check directly.
2021-03-05 12:57:20 -05:00
Steve Howell
779f56d411
node tests: Add test for compose_state.
2021-03-05 12:57:20 -05:00
Steve Howell
886e419731
node tests: Directly test how we add/remove rtl class.
2021-03-05 12:57:20 -05:00
Anders Kaseorg
62532777b1
server_events: Replace deprecated $.now alias.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-04 18:07:47 -08:00
m-e-l-u-h-a-n
f4a111e314
compose: Add user presence circles in mention and pm typeahead.
...
This commit addresses the problem of user's status visibility to
some extent. It adds presence circles, like we have in buddy_list to the
typeahead suggestions that are given for mentioning users in messages.
Tweaked by tabbott to adjust vertical alignment of group mentions as well.
Testing for the changes is done manually in the developement server,
and also by updating frontend tests to address these changes.
Fixes : #17138
2021-03-04 17:06:02 -08:00
Riken Shah
d12257e2c1
puppeteer_test: Add missing `await` checking compose content.
...
assert_compose_box_content should always be called with await.
2021-03-04 09:41:49 -08:00
Riken Shah
b23cd2b7d4
puppeteer_test: Skip tests that require file upload for Firefox.
...
Right now Firefox does not support file upload with puppeteer.
2021-03-04 09:41:24 -08:00
Riken Shah
dc5095bad9
puppeteer_test: Add `waitForNavigation` when reloading.
...
This commit ensures that it waits until the
page is reloaded which avoids uncertain
flake.
2021-03-04 09:40:14 -08:00
Riken Shah
de96aeb822
puppeteer_test: Fix `page.url()` for Firefox.
...
This commit works around an issue with Puppeteer tests on Firefox
where `page.url()` does not show the URL fragment, by adding a
temporary function that solves the issue.
2021-03-04 09:40:14 -08:00
Riken Shah
a6c1f02df0
puppeteer_test: Add `is_firefox` option to enable/disable some tests.
...
This commit introduces the `is_firefox`
option in CommonUtils to identify if a browser
is Firefox or not.
This helps us to avoid calling some tests
that is yet not compatible with Firefox.
2021-03-03 22:04:16 -08:00
Riken Shah
6676aa2f90
puppeteer_test: Change browser default viewport to allow Firefox.
...
When we run puppeteer with Firefox,
the `--window-size` option does not work,
which makes the bottom part of
the page cut off.
This commit fixes this issue
by setting the screen default viewport
to the maximum size of the window.
2021-03-03 22:01:36 -08:00
Steve Howell
b1a871f2e0
node tests: Avoid reset_module for recent_topics.
2021-03-03 07:08:51 -05:00
Anders Kaseorg
cce3257f2c
zjsunit: Remove babel-plugin-lazy-require.
...
There are no more require() calls in tested modules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
099e8fb00e
js: Convert static/js/settings_profile_fields.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
7ec8b8980f
js: Convert static/js/dropdown_list_widget.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
9e613b1487
js: Convert static/js/message_events.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
d8c793f791
js: Convert static/js/composebox_typeahead.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
5cc1f8d289
js: Convert static/js/ui.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
8dbaf2d680
js: Convert static/js/subs.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
0e90f3be6d
js: Convert static/js/compose_actions.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
e74598da17
js: Convert static/js/narrow.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
7a67c06581
js: Convert static/js/message_list.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
68872f44f6
js: Convert static/js/widgetize.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
3e8ddc229b
js: Convert static/js/stream_list.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
727208b84c
js: Convert static/js/unread.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
9997e13032
js: Convert static/js/unread_ops.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
7ec3fc38fa
js: Convert static/js/input_pill.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
ac4e293da5
settings_profile_fields: Use named export from sortablejs.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
19e4328a7b
node_tests: Don’t use this in __esModule mock.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
4a2f937732
narrow: Add setter for narrow_title.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
1ec97070e8
node_tests: Move more set_global mocks before zrequire calls.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
Anders Kaseorg
79ac5c25b5
zulip_test: Re-export internal functions used by Puppeteer tests.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-03-02 17:06:35 -08:00
sahil839
b53c773987
events: Remove email field from update subscription events.
...
This commit removes email field from update subscription
events, as email field is of no use in this case.
2021-03-01 14:52:06 -08:00
Anders Kaseorg
2a2373307f
node_tests: Remove unused rewiremocks.
...
Found by running the tests after
sed -i 's/\.with(/.toBeUsed().with(/g' frontend_tests/node_tests/*.js
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
4b1b1950b2
node_tests: Fix ineffective rewiremocks installed after import.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
d8ad63126d
js: Convert static/js/billing/helpers.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
2a49ce1b6c
js: Convert static/js/search_pill_widget.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
1a8422b152
js: Convert static/js/recent_topics.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
934d4e4e10
js: Convert static/js/panels.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
dc95f06b62
js: Convert static/js/compose_ui.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
8191915e57
js: Convert static/js/emoji_picker.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
b9e1d320e8
js: Convert static/js/typing_events.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
e382389797
js: Convert static/js/reactions.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
a0caabe6c7
js: Convert static/js/bot_data.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
5438a04b84
js: Convert static/js/message_view_header.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
d36c6f23f6
js: Convert static/js/admin.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
972a52ca99
js: Convert static/js/settings.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
65840a2001
js: Convert static/js/settings_user_groups.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
b58b1f080e
js: Convert static/js/settings_invites.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
e9c65834ff
js: Convert static/js/settings_linkifiers.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
8953c9b6d6
js: Convert static/js/settings_streams.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
793ff996f6
js: Convert static/js/settings_users.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
2501a0412f
js: Convert static/js/settings_org.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
d0ffb37320
js: Convert static/js/settings_exports.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
6ffcc0d25b
js: Convert static/js/settings_emoji.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
f94b29356c
js: Convert static/js/settings_sections.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
c66d616752
js: Convert static/js/settings_bots.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
7a1ce36d4f
js: Convert static/js/settings_notifications.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
4d738ebe15
js: Convert static/js/settings_display.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
8e8a2840c4
js: Convert static/js/settings_account.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
db6e3a41d3
js: Convert static/js/confirm_dialog.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
542a77f5d5
js: Convert static/js/reminder.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
5ebc3f1477
js: Convert static/js/realm_logo.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
f577489aa4
js: Convert static/js/realm_icon.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
b2849edfd7
js: Convert static/js/avatar.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
e64c7a9efe
js: Convert static/js/upload_widget.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
a7b2e5ba03
js: Convert static/js/hotspots.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
7e9b5efa8a
js: Convert static/js/timerender.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
9a0fc5cc87
js: Convert static/js/user_events.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
a832983290
js: Convert static/js/activity.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
afe310f64c
js: Convert static/js/buddy_list.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
85ae00ce16
js: Convert static/js/padded_widget.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
170905c065
js: Convert static/js/buddy_data.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
818b5aacb6
js: Convert static/js/presence.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
19bb5fa7ad
js: Convert static/js/server_events.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
21c6a3d87a
js: Convert static/js/message_fetch.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
7a45ed46af
js: Convert static/js/message_util.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
7145cb4a0d
js: Convert static/js/message_store.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
ac65935b16
js: Convert static/js/attachments_ui.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
ac4d3bf204
js: Convert static/js/alert_words_ui.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
636587665b
js: Convert static/js/starred_messages.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
5ae2f172d0
js: Convert static/js/message_flags.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
e30df92944
js: Convert static/js/hashchange.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
c94ffb5319
js: Convert static/js/hash_util.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
9d318f054f
js: Convert static/js/notifications.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
9a3dcb7305
js: Convert static/js/hotkey.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
9d7917749c
js: Convert static/js/list_util.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
0200f48a12
js: Convert static/js/navigate.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
b9137e3de8
js: Convert static/js/search.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
9d9c716dd2
js: Convert static/js/search_suggestion.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
940861fd7e
js: Convert static/js/typeahead_helper.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
45b8e0244e
js: Convert static/js/overlays.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
b3f74af090
js: Convert static/js/popovers.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
c71af35461
js: Convert static/js/stream_popover.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
b408565111
js: Convert static/js/gear_menu.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
fb93be0d94
js: Convert static/js/scroll_bar.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
5b647e3d72
js: Convert static/js/settings_toggle.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
dd84974a15
js: Convert static/js/settings_panel_menu.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
7416022f20
js: Convert static/js/click_handlers.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
f59133db42
js: Convert static/js/ui_util.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
8a07ec5365
js: Convert static/js/night_mode.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
3a90ec30d5
js: Convert static/js/info_overlay.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
5b2b2924be
js: Convert static/js/message_scroll.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
26710a4370
js: Convert static/js/ui_report.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
76bfa78beb
js: Convert static/js/lightbox.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
68732d4581
js: Convert static/js/floating_recipient_bar.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
e58666e512
js: Convert static/js/list_widget.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
9f881ebe34
js: Convert static/js/resize.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
5ba7153a3b
js: Convert static/js/condense.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
dd18b32e04
js: Convert static/js/message_edit.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
031fab7661
js: Convert static/js/stream_edit.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
72ffb33589
js: Convert static/js/stream_events.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
f47090136d
js: Convert static/js/stream_muting.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
ad3390e395
js: Convert static/js/stream_topic_history.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
245d6c3a3e
js: Convert static/js/stream_data.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
d81ba3698f
js: Convert static/js/stream_color.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
374dfc2fda
js: Convert static/js/color_data.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
6f660793e7
js: Convert static/js/upload.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
5d3baec4ef
js: Convert static/js/compose.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
35afd078f3
js: Convert static/js/transmit.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
1547494e25
js: Convert static/js/compose_state.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
f499c4a858
js: Convert static/js/sent_messages.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
32288d245c
js: Convert static/js/local_message.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
10a4d2bcbd
js: Convert static/js/markdown.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
ea01e6da5e
js: Convert static/js/compose_fade.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
527b6a36b3
js: Convert static/js/reload.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
e05293a257
js: Convert static/js/reload_state.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
b830f53eb5
js: Convert static/js/narrow_state.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
a1e9be884d
js: Convert static/js/message_live_update.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
817358ce00
js: Convert static/js/message_list_view.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
68f7bfff56
js: Convert static/js/submessage.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
472f3bc478
js: Convert static/js/poll_widget.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
cfacf68fb8
js: Convert static/js/filter.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
16668904c1
js: Convert static/js/top_left_corner.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
1b151d0472
js: Convert static/js/recent_senders.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
850c3c65e7
js: Convert static/js/pm_list.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
666938f46c
js: Convert static/js/pm_list_dom.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
20cfb9ef09
js: Convert static/js/topic_list.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
5a68bda15b
js: Convert static/js/user_groups.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
592cd780f5
js: Convert static/js/rows.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
fe4d1e839c
js: Convert static/js/message_viewport.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
6e045e4470
js: Convert static/js/muting_ui.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
94a5da325c
js: Convert static/js/muting.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
ece27a19bc
js: Convert static/js/unread_ui.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
09920af211
js: Convert static/js/channel.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
1dafb143e3
js: Convert static/js/compose_pm_pill.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
000865ceb1
js: Convert static/js/user_pill.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
977e7dfe07
js: Convert static/js/drafts.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
98c4ffa700
js: Convert static/js/scroll_util.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
6477b7631c
js: Convert static/js/rtl.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
f85924dd0a
js: Convert static/js/keydown_util.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
d5740d43f3
js: Convert static/js/vdom.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
3faae49dc0
js: Convert static/js/loading.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
a3e6ebb04c
js: Convert static/js/common.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
4df3fef88f
zjsunit: Add babel-plugin-lazy-require.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
b93e00f213
zjsunit: Enable Babel lazy imports.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
48c67700ed
node_tests: Convert rewiremock.proxy uses to low level API.
...
This seems easier to understand and much easier to produce
automatically.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
aee94f141d
zjsunit: Remove _patched_with_set_global check.
...
Most of our set_global usage will disappear as our globals do, anyway.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
db50451a5a
zjsunit: Use __Rewire__ for ES modules in with_field.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
8985b5ffc7
zjsunit: Use __Rewire__ for ES modules in override.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
7c860caffc
node_tests: Remove unnecessary zrequire calls for ES6 modules.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
8947ff10a4
compose: Add setter for wildcard_mention_large_stream_threshold.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Anders Kaseorg
cc3d33b386
node_tests: Unroll ignore_modules loop in ui_init test.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-28 14:23:00 -08:00
Steve Howell
07b213bd2e
node tests: Remove unused parameters.
...
We were not setting shiftKey or ctrlKey to true.
2021-02-26 14:11:42 -05:00
Steve Howell
4543554daf
node tests: Add overrides for hotkeys.
2021-02-26 14:11:42 -05:00
Steve Howell
bfcb84774c
node tests: Default overlay functions to false.
2021-02-26 14:11:42 -05:00
Steve Howell
87f4fa3323
node tests: Split up hotkey tests.
2021-02-26 14:11:42 -05:00
Steve Howell
70d204ddce
node tests: Promote code to module level in hotkeys test.
2021-02-26 14:11:42 -05:00
Steve Howell
3035d1790b
node tests: Inline return_true and return_false.
...
We just use the concise es6 idiom now.
2021-02-26 14:11:42 -05:00
Anders Kaseorg
54c97c4457
node_tests: Consistently move set_global mocks before zrequire calls.
...
This way, as we convert them to rewiremock, they will become available
before they are imported.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-26 07:55:53 -08:00
Anders Kaseorg
15b1abef3d
puppeteer_tests: Fix for recent topics title change.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-25 18:31:54 -08:00
Wesley Aptekar-Cassels
673af19a4d
typeahead: Always rank exact string match first.
...
Previously, exact matches could be pushed off the typeahead list in the
case where there were more prefix matches that happened to rank first,
which is confusing to the user: if an emoji, for instance, falls into
this category, it will never show up in typeahead, which is easy to
confuse with the emoji not existing.
This isn't a perfect fix — there are still cases where it's hard to find
emojis because the prefix-space is very crowded, but it does fix a
category of surprising and frustrating behaviour.
This doesn't come completely without downside - it means that the exact
match emoji will jump to the front of the list, which changes what is
currently conceptually a "filtering" operation to a "filtering and
sorting" operation, but it seems on the whole to be a more ideal
experience. This is particularly notable in the non-typeahead emoji
picker, which uses the same codepath, but this change seems somewhat
desirable even there, since it allows the user to type the name of an
emoji and press enter and have that emoji show up, without having to
visually confirm that they aren't inadvertently selecting a
prefix-matching emoji.
A better solution to this in the long term might be ordering emoji
results by shortest-first as a tiebreaker for alphabetical ordering,
since that should provide the same behaviour while keeping the mental
model as "filtering" (since the sort order won't change as the user
types), but this seems like a reasonable first pass, and changing to
shortest-first ordering after making this change won't break any muscle
memory for existing users.
2021-02-25 17:55:54 -08:00
Aman Agrawal
f9537053ea
narrow_title: Correct title of RT and all messages narrow.
...
Recent topics, being the default view, is no longer beta.
2021-02-25 17:32:51 -08:00
Aman Agrawal
ce3f1355e1
zulip_logo: Remove custom click handling.
...
We don't need to handle user clicking on Zulip logo since
changing the hash via the `a` tag takes care of it automatically.
Also, cleanup the narrow.restore_home_state function since
it is no longer being used.
2021-02-25 17:32:32 -08:00
Aman Agrawal
f4f37fca14
hashchange: Extract func which checks current hash is in RT.
2021-02-25 17:31:33 -08:00
Aman Agrawal
3e36fe6a1e
recent_topics: Don't show topics from unsubscribed streams.
2021-02-25 17:31:33 -08:00
Aman Agrawal
e887428dec
stream_events: Re-render RT after a stream is (un)muted.
...
We manually trigger a re-render of RT after a stream is muted
to update the list of topic in RT for the active filter.
This fixes the bug that RT doesn't update correctly
after a stream is muted.
2021-02-25 17:31:33 -08:00
Aman Agrawal
bbe1b742c6
recent_topics: Recalculate space for stream list when activating.
...
If user is in private message narrow, we reduce height of stream
list to allow height for pm list in the left sidebar. We need
to recalculate it when moving out of pm narrow and moving in
rt narrow.
2021-02-25 17:31:33 -08:00
Aman Agrawal
a29b328854
MessageListView: Don't reselect message_id if RT is open.
...
When idle, we try to backfill messages and in the end reselect
the closest message in the list, which can be a unread message
if present.
When recent topics is open, we can backfill messages; but
shouldn't select the message_id otherwise it will mark the
message as read if the message is unread while triggering
`message_selected.zulip`.
2021-02-25 17:31:32 -08:00
Aman Agrawal
b5036cd3b3
narrow: Explicitly hide recent topics when changing narrow.
...
User can go from recent topics to stream / topic narrow via various
means, but all go through narrow.activate, hence we make sure all the
state changes we do in recent_topics.hide are actually applied when we
hide recent topics and go to another narrow.
This fixes the bug that narrowing from left sidebar to a stream
takes user to the top of the narrow.
2021-02-25 17:31:32 -08:00
Aman Agrawal
8d398ddd54
recent_topics: Focus on first table row after first render.
...
We land user on the first row of the table instead of the search
box because here user can access hotkeys like `w`, `q`, `/`, etc,
which will not be directly available if user is focused in
recent topics search box.
For tests:
We set focus to search by default to avoid mocking a lot of
table html for getting the tests passing.
2021-02-25 17:31:32 -08:00
Aman Agrawal
d2c2371c84
recent_topics: Call revive_current_focus as part of redraw process.
...
This makes more sense as it ensures we revive focus after every
redraw.
2021-02-25 17:31:32 -08:00
YashRE42
2cd234f1b7
recent_topics: Add persistence for filters via localstorage.
...
Previously the filter would be reset every time the page was
refreshed. This commit adds persistence via localstorage, the tests
follow the pattern used in tests for drafts.
Fixes : #15676 .
2021-02-25 17:31:32 -08:00
Aman Agrawal
39d123e355
recent_topics: Make it the default view.
...
Go to Recent Topics on "#", no hash and "#recent_topics".
Go to Recent Topics as the last destination for escape key.
Map `a` key to All messages and change its hash to
`#all_messages`.
2021-02-25 17:31:32 -08:00
Aman Agrawal
1eafb1d8b3
recent_topics: Move from overlay to a narrow-like view.
...
Recent Topics is no longer an overlay now, but note that it is
also not a typical messages narrow. It can reside between
an overlay and a Filter in the sense that it is dispalyed as
a typical Filter narrow but has properties of an Overlay.
Compose box is not visible in this view as it will be confusing
to many users and hence compose shortcuts have also been disabled.
Keyboard shortcuts that apply on messages have also been disabled.
The remaining shortcuts that apply to a narrow are still accessible
here.
2021-02-25 17:31:32 -08:00
Steve Howell
092670b278
node tests: Break out view tests for reactions.
...
The old test here was overly complicated, and
while it got a lot of line coverage, it wasn't
verifying things very precisely.
2021-02-25 13:42:47 -05:00
Steve Howell
a577004842
node tests: Test redundant actions in reactions.
2021-02-25 13:42:47 -05:00
Steve Howell
e9c94982e0
node tests: Prevent leaking reactions.view functions.
2021-02-25 13:42:47 -05:00
Steve Howell
20203e1bba
node tests: Verify Alice's emojis in test.
2021-02-25 13:42:47 -05:00
Steve Howell
737f60e2b7
minor: Add constant for alice_user_id.
2021-02-25 13:42:47 -05:00
Steve Howell
f0d6a0d459
node tests: Use better values for emoji urls.
2021-02-25 13:42:47 -05:00
Steve Howell
623accff68
node tests: Use override for message_store.get.
2021-02-25 13:42:47 -05:00
Steve Howell
5437a16602
zjquery: Remove bogus remove().
2021-02-25 13:42:47 -05:00
Steve Howell
bd034f5767
node tests: Exercise compose_pm_pill callbacks.
...
In the next commit we are stubbing out some
code in compose.js that only indirectly tested
these one-liner configs.
2021-02-25 13:42:47 -05:00
Steve Howell
98fc28c8ed
node tests: Add explicit test for clearing input pills.
2021-02-25 13:42:47 -05:00
Steve Howell
e971cff5b8
node tests: Use override in topic_list_data.
2021-02-24 11:56:40 -05:00
Steve Howell
983f1d66fd
node tests: Break up reactions test.
2021-02-24 11:56:40 -05:00
Steve Howell
0ab3649182
reactions: Simplify code to choose popover target.
...
We now only assign target once, rather than
assigning it then overwriting it for the
not-sent-by-me use case.
I tried to extract a "selector" here but the linter
complained.
Splitting up the tests here ensures we don't
needlessly do extra work here. (In the prior
clumsy implementation, the second test that
I split out here would fail due to the lack
of us setting up the jquery stub.)
2021-02-24 11:56:40 -05:00
Steve Howell
da1cd57d5f
node tests: Use override in more places.
2021-02-24 11:56:40 -05:00
Steve Howell
b57873050f
node tests: Consolidate message_store.get stubs.
2021-02-24 11:56:40 -05:00
Steve Howell
fe28303376
node tests: Clean up narrow tests.
...
I do the following:
- hoist some imports
- split big test into three
- use some of actual compose_state implementation
2021-02-24 11:56:40 -05:00
Steve Howell
70fff472c3
node tests: Use zjquery text() method for input_pill test.
2021-02-24 11:56:40 -05:00
Steve Howell
aa21ccf61f
node tests: Avoid silly stub in filter test.
2021-02-24 11:56:40 -05:00
Steve Howell
dd2552e5f5
node tests: Split up echo test.
2021-02-24 11:56:40 -05:00
Anders Kaseorg
6ff28577cc
js: Convert static/js/message_list_data.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-23 20:36:01 -08:00
Anders Kaseorg
f9c4b5438e
js: Convert static/js/localstorage.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-23 20:36:01 -08:00
Anders Kaseorg
901a1e16cf
js: Convert static/js/list_cursor.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-23 20:36:01 -08:00
Anders Kaseorg
8add2ffc4e
js: Convert static/js/fetch_status.js to ES6 module.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-23 20:36:01 -08:00
Anders Kaseorg
5a22e73cc6
ui: Remove warning for unsupported old Zulip desktop app.
...
This warning was added in #6551 . It’s not for any version of the
current Electron app, which we warn about on the server side with
DESKTOP_WARNING_VERSION, but rather some pre-Electron app so ancient I
don’t even know what it is. Apparently it communicated using the
window.bridge global, so eradicate that too.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-23 18:14:12 -08:00
sahil839
6b5cf231a1
users: Add new user 'shiva' as realm moderator.
...
Note that at this point, it's not possible to create moderator users;
this just will make it easier to write tests for logic involving them
as we develop the feature.
2021-02-23 15:00:49 -08:00
Anders Kaseorg
ba0ee6ddfa
dependencies: Upgrade Source Sans Pro font to Source Sans 3.
...
https://blog.adobe.com/en/2020/11/30/whats-new-in-source-sans-3.html
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-23 14:55:33 -08:00
Anders Kaseorg
174fa0a331
node_tests: Revert wrong conversion of some functions to arrows.
...
‘function’ and ‘=>’ are not equivalent because they bind ‘this’
differently. For these functions, the ‘function’ semantics are
intentional.
This reverts part of commit 1a241cef88
(#17388 ).
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-23 11:35:55 -08:00
Steve Howell
1a241cef88
node tests: Use array syntax more aggressively.
2021-02-23 09:15:36 -05:00
Steve Howell
2262f79cc8
node tests: Use override/with_field in billing.
...
This prevents the possibility of future leaks.
2021-02-23 09:15:36 -05:00
Steve Howell
009a6e0145
node tests: Use override in widgetize.
2021-02-23 09:15:36 -05:00
Steve Howell
dbf514a055
node tests: Remove unnecessary test_ui wrappers.
2021-02-23 07:55:43 -05:00
Steve Howell
ac69450681
zjsunit: Clear $ elements in run_test.
...
We now call $.clear_all_elements at the top
of run_test.
We have to exempt two modules from the new regime:
compose
settings_user_groups
Also, if modules do set_global("$", ...) we don't
try to call the non-existent function.
It's possible we'll want to move to something like
this, but we might want to clean up the two
sloppy_$ modules first:
// AVOID THIS:
// const $ = require("zjquery")
run_test("test widget", ({override, $}) => {
override(foo, "bar", ...);
$.create(...);
// do stuff
});
2021-02-23 07:55:43 -05:00
Steve Howell
81fd1a5e6a
node tests: Introduce test_ui wrappers.
...
These are a prep step for the next commit.
2021-02-23 07:55:43 -05:00
Steve Howell
2fae9dc0a2
node test: Stub out first element of search box.
2021-02-23 07:55:43 -05:00
Steve Howell
0b711516c9
node tests: Fix zjquery leaks in recent_topics.
2021-02-23 07:55:43 -05:00
Anders Kaseorg
3ccb4391d8
zjsunit: Restore missing fields correctly in with_field.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 20:21:41 -08:00
Anders Kaseorg
58b18fd499
zjsunit: Handle exceptions in with_field, with_overrides.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 20:21:41 -08:00
Anders Kaseorg
7e3735b9ba
node_tests: Don’t read page_params from deprecated global variable.
...
Follow up to commit 89aa3155a9
(#17262 ).
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 19:46:42 -08:00
Anders Kaseorg
279c4b0e24
puppeteer_tests: Port to TypeScript.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 16:03:10 -08:00
Anders Kaseorg
8dec7b9270
puppeteer_lib: Use class fields.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 16:03:10 -08:00
Anders Kaseorg
912c5a28f2
puppeteer_tests: Replace deprecated jQuery event trigger shorthand.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 16:03:10 -08:00
Anders Kaseorg
87e95f43c9
puppeteer_tests: Prefix selector with missing #.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 16:03:10 -08:00
Anders Kaseorg
ad540dac3a
puppeteer_lib: Supply missing $eval arugment.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 16:03:10 -08:00
Anders Kaseorg
72142273c0
puppeteer_tests: Remove buggy assert_selector_doesnt_exist helper.
...
It was checking whether the selector string is itself null, not
whether it selects anything!
Use page.waitForSelector(…, {hidden: true}) instead.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 16:03:10 -08:00
Anders Kaseorg
0ca543396a
zjsunit: Use clear_zulip_refs as the main way to undo zrequire.
...
Move clear_zulip_refs into restore, and rewrite it without lodash. We
no longer need the requires array, and zrequire is now nothing more
than a wrapper around require.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 10:53:49 -08:00
Anders Kaseorg
7011f0911d
node_tests: Fix misspelled pm_conversation global.
...
It’s pm_conversations.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-22 10:17:03 -08:00
Steve Howell
ff3175f8a2
lightbox: Export method for testing purposes.
...
We weren't exercising this method in any
meaningful way during the tests, and when
do add coverage, we probably want to just
test it directly.
We also kill off stub_selector(), which was
never well-documented.
2021-02-22 12:38:07 -05:00
Steve Howell
aed5b65525
node tests: Avoid use of stub_selector.
...
We will eliminate this soon.
2021-02-22 12:38:07 -05:00
Steve Howell
d62ef78e9c
node tests: Avoid stub_selector() in activity tests.
2021-02-22 12:38:07 -05:00
Steve Howell
42c2c9fb2d
zjquery: Avoid array-related hacks.
...
Callers can either explicitly pass in children,
stub out $(...)[0] as needed, or just
circumvent jQuery complications with override.
Note the reactions test was broken before,
since $(...)[0] was always returning the same
stub.
2021-02-22 12:38:07 -05:00
Aman Agrawal
2b8921bf67
zjquery: Tell user why using tags as selector is invalid.
...
Like using $('input') is too broad a selector and shouldn't
be used in the codebase. With this error messages, contributors
can easily understand that now.
2021-02-22 10:24:59 -05:00
Aman Agrawal
269457c58b
zjquery: Extract func to verify selector.
2021-02-22 10:24:59 -05:00
Steve Howell
914533c8bc
zjsunit: Prevent common mistakes with overrides.
...
We only allow you to replace functions with functions,
unless you have used set_global() or are dealing
with $ from zjquery.
2021-02-22 10:04:29 -05:00
Steve Howell
5caee967d3
zjquery: Remove bogus after/before functions.
2021-02-22 10:04:29 -05:00
Steve Howell
132e67cb28
zjquery: Prohibit extensions to $.fn.
...
We make an exception for the popovers code.
Luckily it's pretty rare that we extend $.fn
in our real code.
2021-02-22 10:04:29 -05:00
Steve Howell
89ab76920f
zjquery: Prevent direct patches to $.
...
We prohibit code from making direct patches to
$ unless you use override().
2021-02-22 10:04:29 -05:00
Steve Howell
b40d8d5790
node tests: Inline setup for settings_bots.
...
I also use override in more places, and I add
$.validator to zjquery.
In passing I clean up some IIFEs that aren't
really needed.
2021-02-22 10:04:29 -05:00
Steve Howell
38e3aa490f
node tests: Use override for $.post.
2021-02-22 10:04:29 -05:00
Steve Howell
623500bae1
node tests: Avoid zjquery for channel tests.
...
We create our own stub for $.ajax.
2021-02-22 10:04:29 -05:00
Steve Howell
0ffbea8650
node tests: Break up channel tests.
2021-02-22 10:04:29 -05:00
Steve Howell
ffe1043bcc
zjsunit: Remove stub_out_jquery.
...
We now either use zjquery or do whatever gross
things we need to do to work past document.trigger(...)
calls or $.now calls explicitly in the tests.
2021-02-21 17:34:55 -05:00
Steve Howell
64c7eb67eb
zjquery: Make zjquery a singleton.
...
We no longer export make_zjquery().
We now instead have a singleton zjquery instance
that we attach to global.$ in index.js.
We call $.clear_all_elements() before each module.
(We will soon get even more aggressive about doing
it in run_test.)
Test functions can still override $ with set_global.
A good example of this is copy_and_paste using the
real jquery module.
We no longer exempt $ as a global variable, so
test modules that use the zjquery $ need to do:
const $ = require("../zjsunit/zjquery");
2021-02-21 17:34:55 -05:00
Steve Howell
2e3406f0b8
node tests: Eliminate "silent" option for zjquery.
...
The "silent" option was kind of evil, as it had
$(...).find(...) passing back "self" instead of a stub.
Now we just use $(...).set_find_results(...) or
override(...) to simulate/bypass drawing code.
(It turns out hash_util didn't even need this option.)
2021-02-21 15:11:31 -05:00
Steve Howell
706e2baf7e
node_test: Avoid make_zjquery.
...
We just use $.clear_all_elements() now.
2021-02-21 15:11:31 -05:00
Steve Howell
9938811759
node tests: Avoid $ override for compose test.
...
We just use zjquery now.
2021-02-21 15:11:31 -05:00
Steve Howell
895179e8f6
node tests: Make setup for ui_init more local.
2021-02-21 15:11:31 -05:00
Steve Howell
b72575d98b
node tests: Fix zjquery leaks in stream_list.
2021-02-21 15:11:31 -05:00
Steve Howell
496932bfc6
node tests: Share setup helpers for stream_list.
2021-02-21 15:11:31 -05:00
Steve Howell
d207d71753
node tests: Make setup for stream_edit more local.
2021-02-21 15:11:31 -05:00
Steve Howell
3829ab0ea9
node tests: Fix zjquery leaks for popovers.
2021-02-21 15:11:31 -05:00
Steve Howell
fc29ee02c8
node tests: Fix zjquery leaks in compose_actions.
2021-02-21 15:11:31 -05:00
Steve Howell
2fc8e134f5
node tests: Fix zjquery leaks in common.
2021-02-21 15:11:31 -05:00
Steve Howell
569b12439d
node tests: Fix zjquery leaks in alert_words_ui.
2021-02-21 15:11:31 -05:00
Steve Howell
0124264a9e
node tests: Prevent zjquery leaks in activity tests.
2021-02-20 17:33:51 -05:00
Steve Howell
faa1d0d96d
node tests: Fix zjquery leaks in buddy_list test.
2021-02-20 12:00:24 -05:00
Steve Howell
5bd73ce190
zjsunit: Show more of the traceback.
...
We still reduce a lot of clutter, but this
shows wrappers around `run_test` now.
2021-02-20 12:00:24 -05:00
Steve Howell
490894475e
node tests: Prevent zjquery leaks in pm_list.
...
We weren't leaking anything, but this change
prevents future leaks.
2021-02-20 10:29:30 -05:00
Steve Howell
d34723987f
node tests: Make sure we try to find container in pm_list.
2021-02-20 10:29:30 -05:00
Steve Howell
7e4d784888
node tests: Use override/with_field in pm_list.
2021-02-20 10:29:30 -05:00
Steve Howell
7c408bc525
node tests: Use override in buddy tests.
2021-02-19 10:06:44 -05:00
Steve Howell
fed1eaf7d7
minor: Inline filter_table in subs.js.
...
The old structure of having a two-line wrapper was
mostly driven by testing concerns. Now I just
have a single function with the optional argument.
2021-02-18 13:38:16 -08:00
Steve Howell
374d2ff3e2
stream settings: Fix tooltips for stream counts.
...
The tooltips for the left panel of stream settings
have been broken since November 2018 due to my
commit 8f915da2ca
.
The code prior to 2018 was restoring tooltips
right inside the loop where we were detaching
the row from the DOM to put it back into the
DOM at another place. And then I tried to
just add them in bulk, forgetting that I was
in the middle of all the DOM manipulation (and
hence my selector for the loop was a noop).
Also, I don't think we've ever had them for live
events that add streams. (I fixed that too.)
It's not clear to me that this code is actually
necessary, as we get hover help without
calling $(...).tooltip(...) properly.
This is probably why we didn't notice any
breakage when we merged my 2018 commit.
2021-02-18 13:38:16 -08:00
Steve Howell
b4ab662442
puppeteer: Make subscribe/unsubscribe test more robust.
...
We generally want to avoid clicking on DOM elements
that may not actually be visible due to the prior
operation. Instead, we can just find the visible
element after each step.
I also introduce a couple helper functions to
de-clutter the click/unclick/click steps, and I do
a couple extra clicks for good measure.
You can verify that the test will fail if you
add an early return to update_check_button_for_sub.
2021-02-18 11:05:46 -05:00
Steve Howell
34b429dfd5
node tests: Simplify subs tests for filtering.
...
This is prep for future simplifications to the
real code.
2021-02-16 13:11:10 -08:00
Steve Howell
dad90fe770
node tests: Extract locals for stream names.
...
This just makes the next diff smaller. It makes
sense on its own to just flatten the code.
2021-02-16 13:11:10 -08:00
Steve Howell
0e4ba368e0
node tests: Remove tooltips logic in subs test.
...
The zjquery setup here isn't worth the complexity here.
The function being tested just does a simple jQuery
loop.
2021-02-16 13:11:10 -08:00
Steve Howell
62e272ce27
stream settings: Remove obsolete scrolling code.
...
We just want to reset the scrollbar here, which
we still do via ui.reset_scrollbar.
You don't want to preserve scroll position if
you are filtering or re-sorting.
2021-02-16 13:11:10 -08:00
Steve Howell
9862156158
stream settings: Clean up functions to redraw left panel.
...
We have long had this annoying two-pass way of building the
DOM that I am trying to eliminate.
The function names that I introduce here describe the current
situation more accurately.
In passing I make it so that we only throttle redraws when
users are actually typing. Using a throttled redraw when
you click on the sort icons is at best unnecessary, and it
may actually aggravate double clicks.
2021-02-16 13:11:10 -08:00
Abhijeet Prasad Bodas
674a5fef54
node tests: Split draft_model for add/edit/delete cases.
...
This splits the one big `run_test` block into
add/edit/delete parts, for better clarity.
This also removes the `with_field` calls and
uses the override style instead, which is
preferred because it makes sure the stubbed
function is actually called.
2021-02-14 09:13:24 -05:00
Abhijeet Prasad Bodas
8cc0b435e5
node tests: Remove unecessary with_field call in pm_list.
...
After eeee6edf41
, `is_all_privates`
isn't called from the `update_private_messages`
path, and doesn't need to be stubbed.
2021-02-14 09:13:24 -05:00
Abhijeet Prasad Bodas
6c6def2dcc
node tests: Prefer override over with_field.
...
This commit replaces `with_field` calls to
use the override style instead.
`override` is preferred since it makes sure
the stubbed function is actually called,
while `with_field` doesn't, which makes it
hard to spot dead code.
2021-02-14 09:13:24 -05:00
Steve Howell
2ad879cdda
node tests: Use override in echo.js.
2021-02-13 12:48:15 -08:00
Steve Howell
9698fec008
node tests: Use override for snapshot_message.
...
Using override ensures that the real code actually
calls the stubs here.
The one-line map() helper avoids some ugliness
from "prettify".
2021-02-13 08:50:10 -05:00
Abhijeet Prasad Bodas
c183076a91
minor: Suggest with_field instead of override for non-functions.
2021-02-13 07:28:26 -05:00
Abhijeet Prasad Bodas
a24d8272e8
zjsunit: Remove with_stub helper.
...
This doesn't add much clarity to the tests.
Using scoped stub objects is preferred instead.
2021-02-13 06:48:59 -05:00
Abhijeet Prasad Bodas
0d770c32cc
node tests: Explicitly call make_stub.
...
This commit replaces all `with_stub` calls and
explicitly calls `make_stub` instead.
The `with_stub` helper does not add much clarity
hence we now use scoped stub objects instead.
This de-indents some blocks where scoping isn't
required, for example when there is a single
stub object inside a `run_test` function.
With this change, we also need to explicitly
assert `num_calls`.
2021-02-13 06:48:59 -05:00
Steve Howell
183c51ba51
node tutorial: Add make_stub example.
2021-02-12 12:11:23 -05:00
Steve Howell
a5a5863bde
node tutorial: Use override in helpers.
2021-02-12 12:11:23 -05:00
Steve Howell
69ddf68f4d
node tutorial: Inline setup.
...
This code didn't make sense to run inside its own
run_test wrapper.
2021-02-12 12:11:23 -05:00
Steve Howell
118a212af8
node tutorial: Add with_field example.
2021-02-12 12:11:23 -05:00
Steve Howell
7672e7dd7b
node tutorial: Use override() more.
...
This is just a better practice.
2021-02-12 12:11:23 -05:00
Steve Howell
ba7e49c20e
node tutorial: Use set_global for overlays.
2021-02-12 12:11:23 -05:00
Steve Howell
70fb1c225b
minor: Clarify that message_store is a deep test.
...
I believe the original message_store example used
to stub some things here, but the part of the tutorial
that pertains to stubbing is further down.
2021-02-12 12:11:23 -05:00
Steve Howell
c0874462dc
node tests: Rename general.js to tutorial.js.
2021-02-12 12:11:23 -05:00
Steve Howell
1598344fa7
zjsunit: Rename `module` argument to `obj`.
...
Due to recent changes, `with_overrides` is no longer
constrained to overriding module methods. You can
override methods on any type of object.
2021-02-12 12:11:23 -05:00
Steve Howell
21cb0d1547
minor: Suggest using with_field instead of override.
2021-02-12 12:11:23 -05:00
Steve Howell
16ad65dd66
zjsunit: Restrict overrides to once-per-function.
...
We can relax this restriction in the future, but
basically every time it came up for me, the test
code was just disorganized, or it had an easy
workaround.
2021-02-11 11:29:21 -05:00
Steve Howell
90730a18d9
node tests: Simplify stream_events.
...
These are still kind of a mess.
The old code combined the worst of both worlds:
- we had one monolithic test
- we called the events multiple times,
verifying a different stub each time
Now I make the tests more granular.
We could actually re-combine the tests, but
in a nicer way, so that we just set
up multiple stubs and verify that all stubs
get correctly invoked.
2021-02-11 11:29:21 -05:00
Steve Howell
fcf5a66aeb
node tests: Move streams tests to dispatch_subs.
...
There is also some code cleanup here--in dispatch_subs,
we don't stub stream_data, so it's easier to write
deeper tests that actually validate the data changes.
2021-02-11 11:29:21 -05:00
Steve Howell
90ca1ded13
node tests: Split up dispatch tests.
2021-02-11 11:29:21 -05:00
Steve Howell
6f25a372ab
node tests: Reuse message_list stubs.
...
We now just override these functions to close
on local variables.
2021-02-11 11:29:21 -05:00
Anders Kaseorg
741c0ac8ca
node_tests: Change stub/events pattern to work with non-global modules.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-11 07:35:28 -05:00
Anders Kaseorg
2f6c9b8d0e
zjsunit: Change override API to work with non-global modules.
...
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-02-11 07:35:28 -05:00