Commit Graph

19 Commits

Author SHA1 Message Date
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 b65d2e063d js: Reformat with Prettier.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-17 14:31:25 -07:00
Anders Kaseorg f3726db89a js: Normalize strings to double quotes.
Prettier would do this anyway, but it’s separated out for a more
reviewable diff.  Generated by ESLint.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-17 14:31:24 -07:00
Steve Howell d604814347 casper: Improve logic to confirm message sends.
We now use `wait_for_message_fully_processed`
to check that messages are fully rendered.

Before this, we had loopholes where messages
sent outside the view were effectively ignored.
Now we explicitly ignore the check for the
one place we do that.

The more important behavior is for messages
that get sent to the current view.

Before this change, the older version of this
function declared victory as soon as we put the
server version of a locally echoed message into
the current message list's data.

This fixes flaky behavior with 07-stars in
particular, since we need the star icon
on our last message to be there before
we click on it.

Because this function is more robust now, we
can remove some redundant checks in 08-edit.js.
2020-03-26 14:54:02 -04:00
Steve Howell 41f0069a08 casper: Remove left-arrow message-edit tests.
These tests have been notoriously brittle over time.
I think the problem here was knowing whether the
compose box was open or not.
2020-03-26 14:54:02 -04:00
Tim Abbott d65fbfb3db casper: Fix buggy waiting logic in 08-edit.
Apparently, this test was not allowing the browser to run between the
keypress to start edit and checking to see if message_edit_content appeared.

I'm not sure if this is what has been causing recent flakes, but it
was definitely wrong Casper code.
2020-03-22 11:17:26 -07:00
Jack Tiggleman 1682d75ea8 message_edit: Add message edit local echo.
Updates the message editing process to do a local 'echo'.

On slow connections, now there is visual confirmation of the edit,
similar to when sending messages.  The contains_backend_only_syntax
logic and check are the same as there.

We showing "(SAVING)" until the edit is completed, and on successful
edit, the word "(EDITED)" appears.  There's likely useful future work
to do on making the animation experience nicer.

Substantially rewritten by tabbott to better handle corner cases and
communicate more clearly about what's happening.

Fixes: #3530.
2019-11-20 17:40:19 -08:00
Anders Kaseorg d17b577d0c js: Purge useless IIFEs.
With webpack, variables declared in each file are already file-local
(Global variables need to be explicitly exported), so these IIFEs are
no longer needed.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-25 13:51:21 -07:00
Thomas Ip b72f30bd06 jQuery: Replace positional selectors at the end of multiple selectors.
A selector like `$('.elem1 .elem2:first')` selects the first descendant
with class name `.elem2` under `.elem1`. This is the same as saying
`$('.elem1 .elem2').first()`. See example here:
https://jsbin.com/bohehesari/edit?html,js,output
2019-06-06 15:21:26 -07:00
Tim Abbott bdb3da4504 eslint: Add key-spacing linter rule.
Apparently, we didn't have one of these, and thus had a moderate
number of generally very old violations in the codebase.  Fix this and
clear the ones that exist..
2018-12-18 10:41:06 -08:00
Tommy Ip 6e22847548 refactor: new message content -> compose textarea. 2017-11-28 12:53:40 -08:00
Umair Khan 33e46af898 08-edit.js: Remove waitForText. 2017-06-07 13:41:59 -07:00
Cory Lynch ba7b7a9a36 Change edit_message_content to have unique IDs for different messages.
Fixes bugs of when multiple messages are being edited simultaneously.
Specifically, typeahead is no longer broken, copying messages to clipboard
is less buggy, and resizing is no longer
broken when multiple messages are being edited.
2017-04-28 12:15:34 -07:00
Igor Tokarev 55cffa1e69 Added keyboard shortcut to edit the last message.
Tweaked significantly by tabbott to update Casper tests, document the
new feature, and fix hotkeys.

Fixes #1147.
2017-02-12 00:29:28 -08:00
Tim Abbott 8ef3e7cde8 casper: Use waitUntilVisible in editing tests. 2017-02-09 23:35:11 -08:00
Tim Abbott 2447f4a5b4 eslint: Update most casper tests to use new comma-dangle rules.
* In most cases, eslint --fix with the right comma-dangle settings was
  able to update the code correctly.

* The exceptions were cases where the parser incorrectly treated the
arguments to functions as lists/objects and added commas; these are
detectable with linters, and we fixed manually.  Since this is test
code, we can be reasonably confident that just fixing the failures
suffices to correct any bugs introduced by making changes
automatically.
2016-12-03 15:00:24 -08:00
Umair Khan 06b8c76bda casper: Use local_id check to ensure messages are actually sent.
Previously, we only used this approach of waiting until the local echo
ID was cleared in the message edit tests.
2016-10-03 09:27:22 -07:00
Rishi Gupta 7ef434ec62 08-edit: Change how we wait for messages to be sent in casper tests.
We originally waited for .message_edit_notice to appear, now we wait for
textarea.message_edit_content to disappear.

This is better because the previous code didn't correctly handle
editing the same message twice (the "EDITED" tag would still be there
from the first edit, so it wouldn't wait at all the second time!).
2016-07-06 15:27:13 -07:00
Vishnu Ks 420ee968f7 Renumber the casper tests to make space for realm-creation test.
And also fix the mysterious gaps at 6 and 8.
2016-06-24 17:47:56 -07:00