Commit Graph

3567 Commits

Author SHA1 Message Date
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