Commit Graph

958 Commits

Author SHA1 Message Date
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
Joshua Pan 1c34a3ae54 node tests: Fully cover sort_streams() in typeahead_helper.js. 2017-06-21 00:03:05 -04:00
Joshua Pan ffde90fcd1 node tests: Add tests for sort_emojis() in typeahead_helper.js. 2017-06-21 00:03:05 -04:00
Joshua Pan 0563337240 node tests: Fully cover split_by_subscribers() in typeahead_helper.js. 2017-06-21 00:03:05 -04:00
Joshua Pan a53a4b7f0d node tests: Add tests for render stream typeahead item. 2017-06-21 00:03:05 -04:00
Joshua Pan 7a93a425f8 node tests: Add tests for render person typeahead item. 2017-06-21 00:03:05 -04:00
Joshua Pan ee48ac1854 node tests: Fully cover compare_by_popularity() in typeahead_helper.js. 2017-06-21 00:03:05 -04:00
Joshua Pan 649558476e node tests: Get rid of typeahead_helper dependency.
This also puts the global tests into their
own specific tests, which then allows us to
get rid of the typeahead_helper dependency.
2017-06-21 00:03:05 -04:00
Cory Lynch 6d90d7ccbb people.js: Ignore own email address in group PMs. 2017-06-20 21:22:45 -04:00
Aditya Bansal 4c8e4eea4e user_events.js: Make node test coverage reach 100%. 2017-06-20 20:57:10 -04:00
Cory Lynch ff9498f85b bookend: Hide re-subscribe button for private streams.
Fixes #5181
2017-06-20 20:56:26 -04:00
Joshua Pan 5e611826da node tests: Call settings_bot.set_up() to get initial line coverage. 2017-06-20 19:49:23 -04:00
Joshua Pan 8a6e8906bd zjquery: Add .click() function. 2017-06-20 19:49:23 -04:00
vaibhav d9bc3932ec settings: Move "download personal API key" from "your-bots" to "your account"
Fixes: #5355.
2017-06-20 15:46:23 -04:00
vaibhav 9a6e326305 Add support for generating and downloading flaskbotrc.
Flaskbotrc is a file containing config of all active
outgoing webhook bots. It is used to provide configuration
of all active outgoing webhook bots to zulip-bot-server.
2017-06-20 09:43:45 -04:00
Cory Lynch 005d06eb38 message_store.js: Add tests for message id change.
This gets message_store.js to 100% line coverage.
2017-06-20 06:24:27 -04:00
Cory Lynch 10b86da128 message_store.js: Add tests for erorrs/edge cases. 2017-06-20 06:24:27 -04:00
Cory Lynch 24b9108d09 message_store.js: Increase coverage for add_message. 2017-06-20 06:24:27 -04:00
Steve Howell 6c722843ef node tests: Fix namespace leaks related to require().
The node tests have purged modules from cache that were
included via things like set_global(), but calling require
directly would leak modules into the next test, which made
a couple tests only work when you ran the whole suite.  I
fixed those tests to work standalone.  And then I now make
dependencies explicitly clear the require cache before we
require them in namespace.js.
2017-06-19 22:36:58 -04:00
Vishnu Ks 9b16835c99 user_popover: Handle the case when user presence is unknown.
For bots and users who have not logged in for a long time the presence information is not known. For the these users make the presence indicator hidden.
2017-06-19 17:25:06 -04:00
Joshua Pan ecaf628d76 node tests: Add test_set_user_status(). 2017-06-19 08:00:55 -04:00
Joshua Pan a71a8d2343 node tests: Fully cover status_from_timestamp in presence.js. 2017-06-19 08:00:55 -04:00
Joshua Pan 8011212384 node tests: Fully cover update_info_for_small_realm in presence.js. 2017-06-19 08:00:55 -04:00
Joshua Pan 65c68d385e node tests: Add test_last_active_date(). 2017-06-19 08:00:55 -04:00
Joshua Pan 71dab26c84 node tests: Fully cover test_set_info in presence.js. 2017-06-19 08:00:55 -04:00
Cory Lynch 7f8ecb62c9 fenced_code.js: Improve coverage to 100%. 2017-06-19 06:53:25 -04:00
Cory Lynch 58a2ffbe1d Add search suggestion support for is:unread. 2017-06-19 06:51:13 -04:00
Cory Lynch 86d3e00bd0 Add search support for is:unread.
Fixes #1423.
2017-06-19 06:51:13 -04:00
Steve Howell 7e99262331 Add tests to settings_org.js.
This gets about 80% line coverage.
2017-06-16 18:57:07 -04:00
Steve Howell e0d79acac0 zjquery: Add attr() method. 2017-06-16 14:58:27 -04:00
Steve Howell f91dc2fec9 zjquery: Add prop() function. 2017-06-16 08:47:54 -04:00
Abhijeet Kaur af7e08acb0 bots: Add UI to view bot types of existing bots in "Your bots".
Tweaked by tabbott for more standard internationalization.
2017-06-15 10:08:31 -07:00
Steve Howell d2b710b307 Add maybe_show_keyboard_shortcuts().
This prevents some strange UI experiences and some blueslip
errors by not opening keyboard help when other overlays or
popovers are open.
2017-06-15 10:15:29 -04:00
Yago González 1d47a7b505 node tests: Replace stub jQuery with zjquery. 2017-06-15 09:08:40 -04:00
Yago González 98e74db6e8 node tests: Remove unnecessary dependency (hashchange). 2017-06-15 09:08:40 -04:00
Yago González 31d81e2c9b node tests: Add coverage for unexpected exceptions in handleTex. 2017-06-15 09:08:40 -04:00
Yago González 6c0dfa7f8f node tests: Fix format in markdown.js tests.
Replaced 2-space indentation with 4 spaces, and removed a couple
unnecessary newlines.
2017-06-15 09:08:40 -04:00
Yago González 44078a73bf node tests: Add coverage for python_to_js_filter. 2017-06-15 09:08:40 -04:00
Yago González 97a07f311e node tests: Add coverage for add_subject_links. 2017-06-15 09:08:40 -04:00
Yago González ae67f9044d node tests: Add coverage for handleUnicodeEmoji. 2017-06-15 09:08:40 -04:00
Akhil 1bcc0dbd81 org-settings: Add UI for changing the notifications stream.
Added a dropdown in the organization settings page with a search-box and
required styles. Also added an element to disable it. Added a method to
populate the dropdown using list_rendering.js. Also altered response to
the event of deletion of the notifications stream on the frontend. On
selection of a new stream or on clicking 'Disable', a patch request is
made with stream-id to /json/realm.

Fixes: #3708.
2017-06-15 04:08:29 -07:00
Cory Lynch 11a7a476d7 search_suggestion: Add negation support for 'has' operator. 2017-06-15 02:32:00 -07:00
Cory Lynch da4e2954fe search_suggestion: Remove is:private as default suggestion. 2017-06-15 02:20:50 -07:00
Cory Lynch 89b8d07420 Make search suggestion messages more concise.
This involves updating filter.js, mostly. The
tests were updated appropriately for this change,
which also involved changing a caspar test for
narrowing.
2017-06-14 22:34:46 -07:00
Cory Lynch ab5b0e938d Add support for "has" operator in search_suggestions.
This was never a feature in the old search_suggestions
version, so a new helper function for it was added.

Relevant tests were also added, maintaining 100% coverage.
2017-06-14 22:34:46 -07:00
Cory Lynch a7ec8cd1f3 Improve topic in search_suggestion.js.
Also added some additional testing to handle
some edge cases that I'd like to make sure
don't break down.
2017-06-14 22:34:46 -07:00
Cory Lynch 69e8074d14 Improve person/group in search_suggestions.js.
The get_person_suggestions and get_group_suggestions functions
were updated to the new system. Support for negation is also
added in the new system.

Relevant tests were also updated. Also, note that the function
get_private_suggestions was removed, as it was rendered
obsolete by these updates.
2017-06-14 22:34:46 -07:00
Cory Lynch c8d4eff8aa Improve sent_by_me in search_suggestions.js.
Added appropriate tests.
2017-06-14 22:34:46 -07:00
Cory Lynch 79d56c94dc Improve default and special_filter in search_suggestion.js.
Special filter was updated to work even when it is not the first
token in a search query. Furthermore, the default query was
moved around to work with the changes to come for the new
suggestion system.

A test also had to be modified to work with the new system.
2017-06-14 22:34:46 -07:00
Steve Howell 5482a6e129 Add test_narrowing() for stream_list. 2017-06-14 15:29:17 -04:00
Steve Howell dc9ea24d79 zjquery: Add get(). 2017-06-14 15:29:17 -04:00
Steve Howell 7722539504 zjquery: Add better trigger stubbing. 2017-06-14 15:26:41 -04:00
Steve Howell 39e8bed9ef Test stream_list.update_dom_with_unread_counts(). 2017-06-14 12:28:08 -04:00
Steve Howell 499962bb6b Change arg for stream_list.redraw_stream_privacy().
We now pass in a sub, not a stream name.
2017-06-14 11:24:42 -04:00
Steve Howell bc575685a9 Add more test coverage to stream_list.js. 2017-06-14 11:24:20 -04:00
Steve Howell bc5165a54e Add test coverage to stream_list.js. 2017-06-14 09:27:28 -04:00
Steve Howell 5272b6644e zjquery: Support $('<div>').html(). 2017-06-14 08:17:03 -04:00
Harshit Bansal 0e8f1f4e5d alert_words: Fix the UI to not allow users to create duplicate alert words. 2017-06-13 16:37:49 -07:00
Harshit Bansal 947f6e9190 casper_tests: Fix the broken alert words casper tests.
This commit fixes the broken alert word casper tests that were
commented out earlier due to flakes(see issue #1244).

Fixes: #1269.
2017-06-13 16:36:11 -07:00
Harshit Bansal 94fc7dfe20 alert_words_ui: Fix the data flow while removing an alert word.
Add `remove_alert_word()` function which uses the correct data flow
while removing an alert word.

`alert_words_ui.js` was structured differently from most of the other
settings. It was not using the triggers from the server for running
the success/failure handlers.
2017-06-13 16:36:11 -07:00
Steve Howell 66673f508b node tests: Add test_update_count_in_dom(). 2017-06-13 18:37:02 -04:00
Akhil ff9a929d7a typeahead: Remove highlighting and add common template. 2017-06-13 16:16:17 -04:00
Steve Howell 736f4c2930 zjquery: Fix missing wrapper from last commit. 2017-06-12 07:43:04 -04:00
Steve Howell 8da391b51e zjquery: Fix chaining semantics.
We now make it so that $('foo').addClass(whatever) and similar
functions properly return the wrapper object for chaining
purposes.  We may eventually want to change the wrapper object
to automatically dispatch to the first child object, but this
should work for now.
2017-06-12 07:28:23 -04:00
hackerkid a158676fb0 Add function to get last seen status from last active date. 2017-06-11 07:09:21 -05:00
Cory Lynch 12d1086d14 message_list: Add tests for sent_by_me. 2017-06-08 16:48:34 -07:00
Cory Lynch 863c298d3c message_list: Add tests for change_message_id. 2017-06-08 16:48:34 -07:00
Cory Lynch 6ecd7545ae message_list: Add tests for updates. 2017-06-08 16:48:34 -07:00
Cory Lynch d1e1e69abe message_list: Add tests for message_range. 2017-06-08 16:48:34 -07:00
Cory Lynch e229f79474 message_list: Add tests for add/remove and rerender. 2017-06-08 16:48:34 -07:00
Cory Lynch 537ae79398 message_list: Add tests for unmuted messages. 2017-06-08 16:48:34 -07:00
Cory Lynch 0f848b1770 message_list: Add tests for bookend. 2017-06-08 16:48:34 -07:00
Cory Lynch 4bd28a3ff3 message_list: Add more basic tests. 2017-06-08 16:48:34 -07:00
Joshua Pan ccd880094e util.js: Refactor util.strcmp into util.make_strcmp. 2017-06-07 19:45:46 -05:00
Joshua Pan 2bf48e58aa node tests: Get util.js to 100% node coverage. 2017-06-07 19:45:46 -05:00
Joshua Pan 9d862ab3d3 node tests: Make util.js use zjquery. 2017-06-07 19:45:46 -05:00
Umair Khan 520d1de052 12-toggle-message-editing.js: Remove waitForText. 2017-06-07 13:41:59 -07:00
Umair Khan 591098cd27 11-mention.js: Remove waitForText. 2017-06-07 13:41:59 -07:00
Umair Khan 33e46af898 08-edit.js: Remove waitForText. 2017-06-07 13:41:59 -07:00
Umair Khan 5ae822fc54 07-stars.js: Remove waitForText. 2017-06-07 13:41:59 -07:00
Umair Khan fe8204f1f0 05-subscriptions.js: Remove waitForText. 2017-06-07 13:41:59 -07:00
Umair Khan 0c952dca73 04-compose.js: Remove waitForText. 2017-06-07 13:41:59 -07:00
Umair Khan e4f6f53e74 casper: Add waitForSelectorText.
Fixes #1110
2017-06-07 13:41:59 -07:00