Commit Graph

2659 Commits

Author SHA1 Message Date
Steve Howell 92ed76e3c1 emoji refactor: Pass in emoji_codes from ui_init.
We don't want emoji.js to depend on a JSON file
(and specifically the location of said JSON file)
when we start sharing our code with mobile.
2020-07-26 16:07:17 -07:00
Steve Howell e7e3760588 tests: Extract markdown test for missing emojis.
We now show before/after, and we don't complicate
our other test that runs in a big loop.

And we take advantage of function injection to
not have to hack into the "real" emoji_codes
structure.

Note that we're simulating the missing emojis
at a slightly higher level, but we already had test
coverage that emoji.get_emoji_name returns
undefined for unknown codepoints.
2020-07-26 16:07:17 -07:00
Steve Howell 91de92ce2f ui_init test: Test with real emoji.js. 2020-07-26 16:07:17 -07:00
Steve Howell aedf1660f8 dispatch tests: Make realm_emoji test more robust.
The main thing here is that we check that the
actual data got put into our data structures.

(In general we want to move away from stubbing
data modules; any place where we stub data modules
is a relic of earlier days, where we were just
trying to set the bar for 100% line coverage,
even though some of the original coverage was
quite shallow.)

I also use real stubs instead of noops for
the calls out to UI-oriented modules.

In passing I tweak some comments in the actual
dispatch code.
2020-07-26 16:07:17 -07:00
Steve Howell 6e9d9b42ca refactor: Rename func to emoji_picker.rebuild_catalog. 2020-07-26 16:07:17 -07:00
Steve Howell ef40767edf emoji: Promote blueslip.error to caller.
The only function that called blueslip had only
one caller, and we are trying to get emoji.js
ready for ES6.
2020-07-26 16:07:17 -07:00
Steve Howell 65ea339a47 emoji tests: Clean up data setup.
With update_emojis, it is pretty easy
to set up the tests with reasonable
data without reaching into internal
data structures.

Also, we can begin the process of
sharing the same data with our
dispatch tests (upcoming).
2020-07-26 16:07:17 -07:00
Steve Howell 28f5dfefea dispatch tests: Use run_test. 2020-07-26 12:50:07 -04:00
Steve Howell d0378b07c7 dispatch test: Remove unneeded blueslip wrapper.
I think this became irrelevant when I moved some
of the code to dispatch_subs a couple months ago.
2020-07-26 12:50:07 -04:00
Steve Howell 978c179e19 node tests: Tweak stream_sort to use run_test. 2020-07-26 12:50:07 -04:00
Steve Howell 7c8dd45da3 node tests: Simplify message_list overrides. 2020-07-26 12:50:07 -04:00
Steve Howell 10bb60e13d node test: Use override in more places.
I also removed some useless stubs in passing.
2020-07-26 12:50:07 -04:00
Steve Howell c9bb6ab843 node tests: Simplify stream_events.
We use the new override helper passed in to
run_test.
2020-07-26 12:50:07 -04:00
Steve Howell ccfcd2c9ae zjsunit: Have run_test pass in override helper.
The subsequent commits will make it more clear
how this helps.
2020-07-26 12:50:07 -04:00
Steve Howell b086e987b8 zjsunit: Prevent spurious function overrides.
If you use the with_overrides() helper, we will
now detect bogus stubs.
2020-07-26 09:25:40 -04:00
Steve Howell 23e14124aa zjsunit: Only allow functions for overrides.
There was only one place where we weren't
overriding a function, and the use case there
was fairly unique.

Knowing that we're dealing with only functions
will simplify override and allow us to add
features like detecting spurious stubs.
2020-07-26 09:25:40 -04:00
Steve Howell b8b2e31463 zjsunit: Require explicit set_global for overrides.
This forces us to more explicitly document at the
top of the file what dependencies we are stubbing,
plus it's less magical.

Also, we may want to do occasional audits of
set_global to clean up places where we mock
things like stream_data, which are probably just
easier to use the real version of now that we
have cleaner APIs to set up stream data.

The modules most affected by this change are our
dispatch-oriented tests--basically, all the
modules that test handling of Zulip events
plus hotkey.js.
2020-07-26 09:25:40 -04:00
Steve Howell 48bb432e4f dispatch tests: Localize overrides. 2020-07-26 09:25:40 -04:00
Steve Howell 7de8726000 dispatch tests: Remove obsolete noop stubs. 2020-07-26 09:25:40 -04:00
Steve Howell a6a9897abd node fixtures: Clean up user_group data. 2020-07-25 17:55:57 -04:00
Steve Howell 97c21ff4da node fixtures: Add all flags for update_message_flags. 2020-07-25 17:55:57 -04:00
Steve Howell 2462282631 node fixtures: Add users for various settings.
We should probably remove this field, as it
seems extraneous.
2020-07-25 17:55:57 -04:00
Steve Howell f22d0b8abe node fixtures: Add op for custom_profile_fields. 2020-07-25 17:55:57 -04:00
Steve Howell b63c7d1cbb node fixtures: Add more realistic data for typing. 2020-07-25 17:55:57 -04:00
Steve Howell b4a4f9d568 node fixtures: Add more realistic data for streams/subs. 2020-07-25 17:55:57 -04:00
Steve Howell 7092cbf6f5 node fixtures: Add more realistic data for user events. 2020-07-25 17:55:57 -04:00
Steve Howell aad98aa6cd node fixtures: Add more realistic data for bots. 2020-07-25 17:55:57 -04:00
Anders Kaseorg f96bd3839c user_search: Convert user_search to an ES6 class UserSearch.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:50:23 -07:00
Steve Howell f5bc454b3a emoji: Remove dependence on page_params.
This sets us up to make emoji a leaf module.
2020-07-24 12:57:52 -07:00
Steve Howell 5280b87f19 emoji refactor: Let emoji.js own the data.
We now only use page_params.realm_emoji at
intialization time, and then settings_emoji
gets the data from emoji.js.
2020-07-24 12:57:52 -07:00
Steve Howell 4f195de78d node tests: Split out settings_emoji.
This keeps the emoji tests free of jQuery
concerns.
2020-07-24 12:57:52 -07:00
Steve Howell cc31403112 mobile sharing: Move fenced_code.js to shared/js.
We also take fenced_code out of the global namespace,
since it only requires katex and underscore.

And we fix the exports to be ES6 style.
2020-07-24 12:57:52 -07:00
Steve Howell c50dbf8297 node tests: Extract markdown_katex.
I want to isolate this test to its own module,
because it is gonna require some rewireproxy
magic in an upcoming commit.
2020-07-24 12:57:52 -07:00
Steve Howell db1e47dd95 node tests: Organize requires for markdown tests. 2020-07-24 12:57:52 -07:00
Anders Kaseorg ea7effbe8a recent_topics: Skip non-stream messages in update_topics_of_message_ids.
Fixes an exception when deleting a private message, introduced by
commit 5d5434ec2f (#15803).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 10:58:21 -07:00
Anders Kaseorg e3b3df328d eslint: Replace sort-imports with import/order.
import/order sorts require() calls as well as import statements.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 09:42:56 -07:00
Anders Kaseorg 498fe285fa js: Access ‘disabled’ as a property, not an attribute.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-22 12:20:23 -07:00
Anders Kaseorg a2a5871088 js: Replace deprecated $.trim method.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-22 12:20:23 -07:00
Anders Kaseorg 7ba3a26cd5 search: Replace deprecated jQuery event trigger shorthand.
$.fn.typeahead, on the other hand, returns the jQuery object back (not
the Typeahead object, which also happens to have a select method), so
this should be converted.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-22 12:20:23 -07:00
Gittenburg 45e19dd6b9 emoji: Rename :slight_smile: to 😄.
Zulip converts :) to the 1F642 Unicode emoji and promotes the same emoji
in the popular section of the emoji picker.

Previously Zulip has labeled 1F642 as "slight smile". While that name
conforms to the Unicode standard (which describes the code point as
SLIGHTLY SMILING FACE), it didn't match our use case of the emoji.

If a user types :) or selects the first smile in the emoji picker they
probably mean to express a regular "smile" and not a "slight smile",
which raises the question why they are only smiling slightly.

This commit relabels 1F642 as 😄 and our previous 😄 263A as
:smiling_face:. Note that 263A looks different in our three supported
emoji sets, so it is not suited to be our "default smile".

This change does not require a migration since our emoji system stores
both unicode points and names and handles name changes transparently.
2020-07-21 16:49:54 -07:00
jagansivam28 90cb72b103 upload widget: Rename image upload widget delete button CSS class.
Previously, image upload widget delete button CSS class name was
`settings-page-delete-button`.
We can change the CSS class name to `image-delete-button`
so that the name can be more generic.
2020-07-21 16:19:20 -07:00
Anders Kaseorg 96dcc0ce6e js: Use ES6 object literal shorthand syntax.
Generated by ESLint.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-21 12:42:22 -07:00
Tim Abbott 9b8255d741 compose: Rename blur_textarea to better describe its purpose.
This blurs all the input elements in the compose area, not just the
textarea for the message body.
2020-07-21 12:08:40 -07:00
Anders Kaseorg a9ca5f603b js: Replace deprecated jQuery event trigger shorthand.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-21 12:01:26 -07:00
Anders Kaseorg 4e42137bd9 js: Replace deprecated jQuery event handler shorthand.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-21 12:01:26 -07:00
Anders Kaseorg 97feea42a1 js: Replace deprecated jQuery.fn.hover.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-21 12:01:26 -07:00
Anders Kaseorg 3510dcbe5e node_tests: Remove useless .select(noop) calls.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-21 12:01:26 -07:00
Anders Kaseorg ded548ad16 zjquery: Refactor generic_event to wrap on.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-21 12:01:26 -07:00
Anders Kaseorg 9102c5a519 node_tests: Trigger events instead of mocking handler installation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-21 12:01:26 -07:00
Anders Kaseorg de1107c1dd node_tests: Install handlers instead of mocking event triggering.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-21 12:01:26 -07:00