Commit Graph

940 Commits

Author SHA1 Message Date
Steve Howell ccd821e29b zjquery: Rename add_child() to set_find_results().
Hopefully this will make it more explicit that zjquery does
not truly simulate DOM, but it instead allows you to dynamically
set what you want the results of $('foo').find(some_selector)
to be.
2017-07-08 08:31:18 -04:00
Steve Howell 70407e080d zjquery: Require explicit set_parent() calls.
Before this commit, we were erroneously setting up parents
as part of add_child() calls, but it's not necessarily the
case that those children are immediate children, and therefore
the first object is not necessarily the immediate parent.
2017-07-08 08:21:27 -04:00
Steve Howell c91eca291c zjquery: Remove broken code related to remove().
The logic to remove ourself from the parent's children wasn't
correct.
2017-07-08 07:57:02 -04:00
Tim Abbott 9657c4c176 casper: Fix flaky realm creation test.
This test was failing nondeterministically, because depending on when
the check was done, the unread message may or may not have been read.
2017-07-07 21:16:01 -07:00
Cory Lynch 4f8a2d0c57 filter.js: Make from/sender descriptions more concise. 2017-07-07 20:54:54 -07:00
Cory Lynch 2ce7a20237 search_suggestion: Support autocompleting operator names.
Fixes #5399
2017-07-07 20:54:54 -07:00
Cory Lynch 2e9ec5e958 search_suggestion: Remove unknown operand from 'is'.
Fixes #5400
2017-07-07 20:54:54 -07:00
Tim Abbott cbdffeda82 subscriptions: Edit copy for the new stream creation confirmation flow.
The new text is a bit simpler and clearer.

We also decrease the threshhold for this page to 50 subscribers.
2017-07-07 19:22:34 -07:00
Harshit Bansal 60e5071843 subscriptions: Confirm inviting 100+ users to a new stream.
Our current workflow for creating a new stream allows the user to
invite as many other users as they like but since there can be
mistakes in doing so, we now open a modal with a warning if the
number of invites are more than 100 just to confirm that user indeed
wanted to do this.

Fixes: #1663.
2017-07-07 19:08:04 -07:00
Vaida d5517bae36 Delete the old zulip.com "referrals" system.
This system hasn't been in active use for several years, and had some 
problems with it's design.  So it makes sense to just remove it to declutter
the codebase.

Fixes #5655.
2017-07-07 14:59:18 -07:00
Vishnu Ks fcd944447e common.js: Don't set default password quality/length in frontend.
The min quality/length values are always available via data
attributes. So there is no point of specefying a default value
in common.js.
2017-07-07 14:48:06 -07:00
Vishnu Ks f273e83a85 portico: Explain why password is weak to user. 2017-07-07 14:48:06 -07:00
Cory Lynch 75617d07de search_suggestions: Prioritize recent huddles.
Fixes #5612. What this specifically does is that if you are
typing a group PM, this logic iterates through the possible
search suggestions for the next autocomplete. If that suggestion
contains a group PM that already exists, then prioritize it with
the most recent one on top.
2017-07-07 12:12:30 -07:00
Cory Lynch 7efba29b0c search_suggestions: Hide own name in huddle suggestions. 2017-07-07 12:12:30 -07:00
Vishnu Ks cf2dec539f urls: Use POST for zerver.views.realm_icon.upload_icon.
This upload_icon endpoint is changed from PUT to POST becuase
this endpoint is not idempotent.
2017-07-07 10:31:43 -07:00
Aditya Bansal e99067cfc3 compose.js: Add node test coverage for abort_xhr() function. 2017-07-07 12:01:41 -04:00
Aditya Bansal d9009f0c84 node tests: Add test_trigger_submit_compose_form().
(Steve Howell also contributed to this.)
2017-07-07 12:01:26 -04:00
Aditya Bansal ada54d4574 compose.js: Add node test coverage for update_fade().
(Steve Howell made small changes.)
2017-07-07 11:57:43 -04:00
Aditya Bansal cf2a9b74d5 compose.js: Add node test coverage to initialze() function.
(Steve Howell contributed to this as well.)
2017-07-07 11:19:02 -04:00
Aditya Bansal a6082a2b95 compose.js: Add coverage for transmit_message() function. 2017-07-07 08:29:33 -04:00
Aditya Bansal f7e37d37b3 compose.js: Add coverage for finish() function. 2017-07-07 07:50:02 -04:00
Aditya Bansal c17efffa6a compose.js: Add coverage for enter_with_preview_open() function. 2017-07-07 07:50:02 -04:00
Aditya Bansal 55f05a5f53 compose.js: Add coverage for send_message() function. 2017-07-06 17:44:27 -04:00
Steve Howell 1466cfaf0c Add node tests for zjquery.
These tests should serve as a basic form of documentation on
how to use zjquery.  It covers most of the basic principles.
2017-07-06 14:31:34 -04:00
Steve Howell b3848ed8bd zjquery: Assert only one function gets triggered.
If multiple functions get called by trigger(), it is almost
certainly a sign of overly complex test setup.
2017-07-06 10:27:54 -04:00
Steve Howell 74f9612147 node tests: Simplify trigger stubbing in stream_events.js.
This test verifies the following line of code:

    $(document).trigger($.Event('subscription_remove_done.zulip', {sub: sub}));

Before this change, the mocking mechanism used `$(document).on(...)`
to set the function that gets called on trigger, but it didn't clear
any of the other handlers.

Since all we care about is making sure that the event gets triggered,
we now just override `$(document).trigger`.
2017-07-06 10:27:09 -04:00
Steve Howell 38e3d2fc11 node tests: Use get_on_handler in stream_list.js. 2017-07-06 09:23:06 -04:00
Steve Howell 6a8fa55521 node tests: Use get_on_handler() in message_store.js. 2017-07-06 09:13:19 -04:00
Steve Howell 99a6a9b70d node tests: Replace trigger() calls in activity.js.
We now use get_on_handler() to call event handlers, rather
than simulating a triggered event.
2017-07-06 08:46:36 -04:00
Aditya Bansal 9c90a3d1a3 zjquery: Add get_on_handler(). 2017-07-06 08:37:39 -04:00
Aditya Bansal 641b38f79b zjquery: Add get_on_handlers(). 2017-07-06 08:36:38 -04:00
Aditya Bansal 3b30701844 zjquery: Add selector param option to on() function. 2017-07-06 08:29:07 -04:00
Cory Lynch 43544cef28 stream_events: Add tests for mark_unsubscribed. 2017-07-05 17:57:52 -04:00
Cory Lynch 2627c1cde3 stream_events: Add tests for mark_subscribed. 2017-07-05 17:57:52 -04:00
Cory Lynch c8281de492 stream_events: Add tests for update_property. 2017-07-05 17:57:52 -04:00
Harshit Bansal a6cd460f72 emoji: Rename `emoji.realm_emojis` to `emoji.all_realm_emojis`. 2017-07-05 13:02:41 -07:00
David Coleman 77dc5df56a uploads: Display year in attachments UI upload timestamp.
Modified timerender.js absolute_time() to include the
year in the returned time stamp string.

Fixes #5600.
2017-07-04 16:13:20 -07:00
Cory Lynch b13265d135 util: Remove execute_early.
This function was removed in favor of loading everything in
ui_init.js. The asynchronous nature of jQuery 3 document-ready
events may cause an undesirable order in which these are executed.
2017-07-04 13:54:33 -07:00
Cory Lynch e33b178054 message_store: Move initialization to ui_init.js. 2017-07-04 13:54:33 -07:00
Cory Lynch 25be3a402d message_fetch: Move initialization to ui_init.js.
This involves modifying a casper test, because now
upon registration, there is one unread message.
2017-07-04 13:54:33 -07:00
Harshit Bansal d3d6712fa3 left-sidebar: Update the size of the scrollbar after narrowing to a stream. 2017-07-03 09:53:41 -07:00
vaibhav 3cddc4ac93 settings: Add node test for url input box toggle.
This contains node test for toggling the url inputbox of
outgoing webhooks service url in the "Add new bot" form.
2017-07-03 11:09:40 -04:00
vaibhav f003a4c916 settings: Move api_key_button click in casper tests.
api_key_button element has been moved from "your-bots" settings page
to "account-settings" page. This click statement was left by mistake.
2017-07-03 11:09:40 -04:00
Cory Lynch 30c7629212 Change code block typeahead to only sometimes close fence.
Fixes #5556.
Some tests needed to be moved around to make sure the
stubbing wouldn't break future tests.
2017-07-03 11:05:18 -04:00
Harshit Bansal 4cb8ac100a emoji: Fix the title and alt text for unicode emojis.
Unicode emojis when rendered should display canonical short name.
Similarly, the alt text should be of the format `:<short_name>:`.
For both of these we currently display the actual unicode symbol.
As some systems don't have the fonts necessary for displaying them
properly, they are rendered as empty square blocks. This commit also
ensures that the markup generated for emoji generated by canonical
name and by an unicode emoji is same.

Fixes: #5555.
2017-07-01 11:14:24 -07:00
Cory Lynch 8abbb6d781 search: Remove in:all token from suggestions. 2017-07-01 12:19:52 -04:00
Steve Howell 3fe6d12ab6 node tests: Test server_events_dispatch.js directly.
The dispatch.js tests now no longer go through server_events.js,
so the tests are isolated from some of the setup you have to
do for the main event loop.  They now directly call into
server_events_dispatch.js.
2017-07-01 08:50:50 -04:00
Aditya Bansal 74f40a0a58 compose.js: Add node test coverage for report_as_received() function. 2017-06-30 19:57:15 +05:30
Aditya Bansal 4b3c2931ea compose.js: Add test coverage for mark_rendered_content_disparity(). 2017-06-30 19:57:15 +05:30
Aditya Bansal 7e585acfa5 compose.js: Add coverage for send_message_success() function. 2017-06-30 19:57:15 +05:30
Aditya Bansal 7f4781e17d compose.js: Add test coverage for update_email(). 2017-06-30 19:57:15 +05:30
Aditya Bansal 3d043d0109 compose.js: Add coverage for get_invalid_recipient_emails(). 2017-06-30 19:57:15 +05:30
Aditya Bansal 9437895c9e compose.js: Add coverage for validate_stream_message() function. 2017-06-30 19:57:15 +05:30
Steve Howell 6cf4c65d92 node tests: Add 100% coverage for channel.js. 2017-06-30 09:48:04 -04:00
Steve Howell 0b60538570 node tests: Extract test_get_reaction_section(). 2017-06-30 08:05:10 -04:00
Aditya Bansal 1e18863a98 timerender.js: Use stubbed version of i18n from zjsunit. 2017-06-29 15:18:08 -04:00
Aditya Bansal 5eb5b33f21 settings_org.js: Use stubbed version of i18n from zjsunit. 2017-06-29 15:18:08 -04:00
Aditya Bansal a103949c2b i18n.js: Fix issue of i18n stub not returning 'translated: ' prefix. 2017-06-29 15:18:08 -04:00
Aditya Bansal 4d84be16ca i18n.js: Fix issue with i18n being cleaned up in namespace cleanup. 2017-06-29 15:18:08 -04:00
Aditya Bansal 7531a85c4d stream_data: Add get_subscriber_count() function. 2017-06-29 10:34:47 -04:00
Aditya Bansal cc34e3d382 compose.js: Add coverage for validate_stream_message_address_info(). 2017-06-29 18:02:25 +05:30
Umair Khan 12b124ba71 single_message.handlerbars: Use __starred_status__ in tooltip.
We do not allow handlerbars within tranlation tags. To use variables in
translatable strings, enclose variables with double lowdashes.
2017-06-29 07:39:20 -04:00
Steve Howell aae3250155 node tests: Add test_with_view_stubs() for reactions.js. 2017-06-29 07:19:52 -04:00
Steve Howell 791e489938 Use a proper context in insert_new_reaction().
Before this change, we were piggybacking fields on to the event
object, which coupled us to any other function that relies on
the event.
2017-06-29 07:19:52 -04:00
Aditya Bansal 92b43c7965 compose.js: Add test for validate_stream_message_address_info().
In this commit we add only one test for the case of unsubscribed
streams in validate_stream_message_address_info() function."
2017-06-28 07:45:21 -04:00
Aditya Bansal 6c787ac569 compose.js: Add test for validate_stream_message_address_info().
In this commit we only add a single test for the case of subscribed
stream to validate_stream_message_address_info() function.
2017-06-28 07:45:21 -04:00
Aditya Bansal 63401833b4 compose.js: Add node test coverage for validate function. 2017-06-28 07:45:21 -04:00
Aditya Bansal 232966a948 activity.js: Remove unnecessary override of i18n as global var. 2017-06-28 07:34:04 -04:00
Aditya Bansal 103f19e236 zjsunit: Add i18n minimal lib. 2017-06-28 07:34:04 -04:00
Aditya Bansal 1ed499fffc zjquery: Add stop() function. 2017-06-28 07:34:04 -04:00
Aditya Bansal bd370993ea zjquery: Add fadeTo() function. 2017-06-28 07:34:04 -04:00
Aditya Bansal fb723f9477 zjquery: Reorder functions in lexographic order. 2017-06-28 07:34:04 -04:00
Joshua Pan ac64ee355d compose_actions.js: Allow compose to empty narrow.
This allows r/enter hotkeys to compose to
an empty narrow (no messages).

Fixes #4500.
2017-06-27 14:06:59 -04:00
Joshua Pan c4914eeec9 narrow.js: Create narrowed_by_stream_reply().
This function returns if you are narrowed
to a stream.
2017-06-27 14:06:59 -04:00
Yago González 00a7f89ba9 node tests: Add coverage to composebox_typeahead.js. 2017-06-26 19:33:25 -04:00
Yago González e76c9f1200 node tests: Add tests to test_begins_typeahead. 2017-06-26 19:33:25 -04:00
Yago González 4fa6aa2268 node tests: Re-sort begins_typeahead tests. 2017-06-26 19:33:25 -04:00
Aditya Bansal 7f2b6f739c emoji.js: Add test coverage for initialize. 2017-06-26 14:24:20 -04:00
Aditya Bansal 88d9739c45 emoji.js: Add test coverage for build_emoji_upload_widget func. 2017-06-26 14:24:20 -04:00
Aditya Bansal d1fe75ce3b node tests: Enforce 100% node coverage in activity.js. 2017-06-26 14:24:20 -04:00
Yago González 8ae0c90e9f zjquery: Return element in some jQuery methods.
jQuery's behavior in methods that, because of their nature, don't need to
return anything is to return the element itself in the jQuery object form.

Now the zjquery element is returned when one of these methods is called.
2017-06-26 08:38:21 -04:00
Yago González 1343216002 zjquery: Add select function. 2017-06-26 08:38:21 -04:00
Yago González 4b8a52cee0 zjquery: Handle passing elements to $().
There are some cases when the jQuery dollar
function is called with an element as argument.

If such element has already been created using
zjquery, we should simply return it.
2017-06-26 08:38:21 -04:00
Yago González 679325733d zjquery: Add extend method. 2017-06-26 08:38:21 -04:00
Yago González a9c8efe871 zjquery: Add keydown and keyup functions. 2017-06-26 08:38:21 -04:00
Yago González ad154da174 zjquery: Add generic event setter/handler. 2017-06-26 08:38:21 -04:00
Yago González a8c7539497 node tests: Make Othello's name match the dev server. 2017-06-26 08:38:21 -04:00
Yago González f908c2e442 node tests: Store fake users as independent variables.
This makes the fake users' objects reachable along the whole test file,
allowing to make assertions that involve user data more easily.
2017-06-26 08:38:21 -04:00
Yago González add869edcb node tests: Fix line length. 2017-06-26 08:38:21 -04:00
Sampriti Panda b2a1754f8a drafts: Re-narrow on restoring draft.
Fixes #4587
2017-06-25 12:26:42 -04:00
Sampriti Panda 7ac90ad925 casper: Fix flake in drafts tests.
On some developer machines, casper was having trouble clicking on
a hidden button. Added a step to make sure the button was visible
before being clicked on.

Also removed an unnecessary log line.
2017-06-25 11:21:35 -04:00
Aditya Bansal 6b911959d5 pm_lists.js: Reach 100% node test coverage. 2017-06-23 09:40:00 -04:00
Cory Lynch 090d7487cf search_suggestion: Use person matching function from people.js.
Instead of having a custom (duplicate) matching function in
search suggestion, it was refactored to use the function in
people.js. This also gets the diacritic-ignoring feature
of the function in people.js.

Fixes #5315.
2017-06-23 08:29:20 -04:00
Harshit Bansal 6615f2f2e8 common.js: Migrate `common.js` module to use IIFE module style.
This module was exposing its functions as globals. This PR fixes
it use the IIFE module style that we use in our other modules.
2017-06-22 19:06:32 -04:00
Cory Lynch df83cee86b people.js: Ignore diacritics in search bar.
Fixes #5315
2017-06-21 19:13:44 -04:00
Yago González e7bd18ec09 timerender: Make get_full_time produce a ISO 8601 date string.
Having get_full_time produce a date string non-compliant with RFC2822 or
ISO 8601 caused problems when showing edition timestamps on a message's
edit history.

Now it returns an ISO 8601 date string (1978-10-31T13:37:42Z).
2017-06-21 16:46:39 -04:00
Cynthia Lin e832ebdc98 hotkeys: Add collapse/show message hotkey.
Fixes #4540
2017-06-21 15:54:09 -04:00
Cynthia Lin a9afe43735 hotkeys: Add `u` hotkey for opening message sender profile.
Fixes #4873
2017-06-21 10:38:05 -04:00
Joshua Pan 1e4c133430 node tests: Test sort_recipientbox_typeahead() in typeahead_helper.js. 2017-06-21 00:03:05 -04:00
Joshua Pan b48f8447e2 node tests: Fully cover compare_by_pms() in typeahead_helper.js. 2017-06-21 00:03:05 -04:00