Commit Graph

133 Commits

Author SHA1 Message Date
Tim Abbott 16f3f585c3 Fix composebox typeahead tests.
(imported from commit ca6e7ea00d79139a0d7db0f1dd5f3ba8d8da5ce3)
2013-12-02 17:42:24 -05:00
Steve Howell bbda1d93c4 Add test for message.handlebars
(imported from commit b02f0c8a6b1d79c868248598e8b9a829245d95a1)
2013-11-27 16:11:16 -05:00
Steve Howell 6a3089a803 [jquery] Add assertion to validate HTML is correct.
This requires the nodes.js version of jquery.  Talk to Luke if you are having issues
installing it.

(imported from commit 86dc91a9a41b2ef9c2dbcc4fb0085109250d7af7)
2013-11-27 15:09:21 -05:00
Steve Howell 4f2b292289 Add HTML output file for JS unit tests.
The node tests can write to .test-js-with-node.html now, so that
when you are unit-testing template-related code, you can use
the browser to inspect the output.

(imported from commit 3cbd7470ec0da1973124f79acb665c3a3e17c580)
2013-11-27 15:09:21 -05:00
Steve Howell c53845a69c Add unit tests for stream_list.
(imported from commit 1d04a2e6115f29b7949466260ec2ba3126b882e6)
2013-11-27 15:09:20 -05:00
Jeff Arnold 3a41184533 Revert "Make c/C compose to a new destination instead of being identical to r/R"
This reverts commit 755c92aed79ab79089b2e35d2c100582f012736a.

(imported from commit b7790fc63a2cea0a8e294c3f0a881ed6f06ed061)
2013-11-27 10:43:10 -05:00
Jeff Arnold c0a8fc459a Make c/C compose to a new destination instead of being identical to r/R
R means "I want to send a PM, you can guess the destination"
r means "I want send a stream message, you can guess the destination"
C means "I want to send a PM and specify the destination"
c means "I want to send a stream message and specify the destination"

(imported from commit 755c92aed79ab79089b2e35d2c100582f012736a)
2013-11-27 10:35:37 -05:00
Allen Rabinovich ca4e6a0ff8 Updates to stream list
(imported from commit 426a8035e9661598f9bbfa6ae83883ca3ac6106e)
2013-11-13 14:59:07 -08:00
Steve Howell 7bde1f7716 Add activity.short_huddle_name().
(imported from commit e3f0389298631fd06169dbc9559691470ac19d00)
2013-11-07 16:54:13 -05:00
Steve Howell 9adcba1e6d Add activity.huddle_fraction_present().
Add a method that lets us know what percentage of a huddle is
present.  (We can use this later to set the opacity of huddles
in the UI.)

(imported from commit 8a2383951807d7bfbf9d730a8980d977cf23b379)
2013-11-07 16:54:13 -05:00
Kevin Mehall d93c7545f6 Revert rendering window changes related to summarization
This reverts commit c10d9c1a0d23891acce88bf8d79866c08cb75681.
This reverts commit 9259a246946cd968a8725c38ff5ef2d4b4793717.

(imported from commit 50e9e0136c2487cc63d75ae2b78df0c70a1b0be1)
2013-11-07 11:04:27 -05:00
Steve Howell 4fb4e04501 Add activity.full_huddle_name().
(imported from commit 304e47ac88d7497fcde49f448912a2e063dd0bd1)
2013-11-05 15:34:29 -05:00
Steve Howell e628efff6c Fix people_dict in activity.js tests.
The simulated people_dict in the activity.js test was not
matching the production code, and going forward, we'll want to
share the people_dict setup for all of our tests.

(imported from commit fc21a02216b9422130b9fe9c11bcf80590612844)
2013-11-05 15:34:28 -05:00
Steve Howell 6d511486cb Add activity.process_loaded_messages() and get_huddles().
Activity.js now has the capability to track huddles that
come through in loaded messages and return them in reverse
chronological order by their most recent message.  Right
now this only connected to a unit test, not any production
code.

(imported from commit 59957086fa2e454e5711472df091f178217aed2b)
2013-11-05 15:34:28 -05:00
Jessica McKellar 8684c98eef tests: add basic navigation Casper tests.
(imported from commit 66ebb76123213167e551fb0d776a824e218a9032)
2013-10-31 17:34:34 -04:00
Tim Abbott 901a5c342c Use os.path directly rather than sometimes importing it separately.
(imported from commit 48486c4ea64d02a15faeebb0f490d31e9b113d62)
2013-10-28 15:44:13 -04:00
Steve Howell 9979d884e5 Remove 06-unread.js.
This test has been broken for a couple months, and nobody has taken
ownership of fixing it.  It's always slow, sometimes it fails
randomly, sometimes it fails for things that aren't really problems,
and it's generally been way more trouble than it's worth.

(imported from commit 8080e81b226a372e763a2558f4e5668c3a4d087c)
2013-10-25 11:27:25 -04:00
Zev Benjamin a04ac35012 casper: Marginally improve page loaded detection
We really should be setting a variable in Javascript to indicate that
we've finished loading, but this hasn't bitten us yet.

(imported from commit ee1f7c76d9f3c482561cc5c44b81537c7e9636be)
2013-10-22 18:45:11 -04:00
Kevin Mehall bd58861b09 Ignore summarized messages when calculating rendering windows.
Summary blocks can contain hundreds of messages. When the rendering window
code didn't take this into account, it would lead to all kinds of
unpleasant behavior when you scroll.

Trac #1888

Unfortunately, this replaces a subtraction with a function that iterates
through all the messages.

(imported from commit 9259a246946cd968a8725c38ff5ef2d4b4793717)
2013-10-21 11:48:57 -04:00
Steve Howell b7eba8fe5c Test unread.update_unread_subjects() more thoroughly.
(imported from commit 5f1bbdbc6822615d487404930f5e50c970536761)
2013-10-15 14:57:38 -04:00
Steve Howell 7076258b15 Get stream_data.js to 100% branch coverage
(imported from commit fa1fa18271ba280d819bcec8cdea6337230f1953)
2013-10-15 14:57:38 -04:00
Leo Franchi 6e188fb067 Tweak alert_word matches and add some more tests
(imported from commit 63dc4064c15d5d33a7ec0c992b183bf323dd4ee8)
2013-10-10 10:58:21 -04:00
Leo Franchi 51e0bea608 Autocomplete emails in sender: completion
(imported from commit 44dc337842d46349b103cf9631faa7d439be682c)
2013-10-07 14:55:58 -04:00
Leo Franchi 0d6ad56c29 Decode operand in filter.js in operator-aware way
When decoding an operand, a + can be converted to a space
only if the operand is not an email address.

(imported from commit 08fc36a579bbe6409137c60c0fa9579fe3ab2c43)
2013-10-02 12:11:15 -04:00
Steve Howell 8f1498c766 [important] Fix stacktrace in unread.js.
There is a scenario where we call process_read_message()
for a message that we haven't recorded as unread before.
I'm not sure how it happens, but I put back code to
guard against crashing.  The regression happened in
5752458c821.

(imported from commit 5ce15d2e236b738b445ed88f1733aa0612be0ff3)
2013-09-29 22:42:33 -04:00
Steve Howell 2a4cd3c69a Exclude muted topics from stream/home unread counts.
Update get_counts() so that it ignores counts for muted topics
when calculating stream/home unread counts.

(imported from commit 9b4e4da4346c225c535e97d709d3dee032603cc5)
2013-09-28 14:53:11 -04:00
Steve Howell c7b7f8d79a Inlined unread_hashkey() function.
The indirection was more confusing than helpful, especially
since the function had side effects, despite its getter-like
name.

(imported from commit 85d9cf642b4177f62488136f0e0f7f6c9304942e)
2013-09-28 14:53:11 -04:00
Leo Franchi d9dba41767 Add some tests for composebox_typeahead.compose_content_begins_typeahead
(imported from commit 01e71ebe87da6e866817dc56555a7e6ee61cb003)
2013-09-27 13:52:13 -04:00
Steve Howell 49a55ca6fa Call blueslip.warn from stream_data.js functions.
It used to be calling blueslip.warning(), i.e. the wrong name,
and would crash.

(imported from commit ddc953488cdb22dd37ddf674dddf1e05f34eaec9)
2013-09-24 16:19:53 -04:00
Steve Howell 660475bd0c Hide muted messages.
Instead of collapsing muted messages, just hide them altogether
in view where it makes sense to hide them.

(imported from commit 1c2c987ff302ceb135a025753cf421b4de1aea71)
2013-09-23 10:53:06 -04:00
Steve Howell 022ef6e9b9 Add narrow.muting_enabled()
(imported from commit 8972d1e3ca347397664094a7f150ec86fd2f8f8e)
2013-09-23 10:53:06 -04:00
Steve Howell e79e74ade4 Add narrowed_to_topic() helper function.
(imported from commit 9190caa9b183893fb7ae883686b9bdbd661d5895)
2013-09-19 15:41:00 -04:00
Steve Howell a4e2ed9fd2 Add test_narrowed() to narrow.js unit tests.
(imported from commit 060032ac00d0c28a9625e2885ee3156bc94ff130)
2013-09-19 15:40:59 -04:00
Steve Howell 51b8caf442 Add set_filter() to narrow unit tests.
(imported from commit 60734fa1a9d0d28e8c0277a41cc69186bc2b6c0e)
2013-09-19 15:40:59 -04:00
Steve Howell c6a9297f1a Add blueslip warnings to stream_data functions.
Warn inside these functions when you get data on streams that you
are not subscribed to:

  add_subscriber
  remove_subscriber
  user_is_subscribed

The back end should be smart enough not to spam us with subscriber
info that we don't care about.

(imported from commit b27644be2abc37c11ddff884ef392ea208bd1bd3)
2013-09-19 08:52:54 -04:00
Steve Howell e1b881629c Use fold_case:true for subscribers Dict
(imported from commit 8acc794cb5369baadef512a9fcdb3537231dd604)
2013-09-17 10:32:13 -04:00
Steve Howell 4b90f1685d Add stream_data.set_subscribers() method.
This allows us to encapsulate our use of Dict for the internal
data structure.

(imported from commit e8acc50b4c17d339015cb9db9939b9452a62cc8b)
2013-09-17 10:32:11 -04:00
Steve Howell e83c026a27 Set focus-related flags correctly after a server reload
(imported from commit 408469c0da0cfa5513e6838329816cd88665981f)
2013-09-16 12:29:34 -04:00
Steve Howell 5eaeddea12 Get stream_data.js back to 100% coverage
(imported from commit 5b82a10d50b6599c0c42604fe86275b21f9a6396)
2013-09-12 17:23:52 -04:00
Steve Howell 0165dc54ad Create blueslip error for undefined keys in Dict.
We create a blueslip error for undefined keys in Dict.  This led
to a straightforward change in the unit tests for Dict.  For the
unread test, to avoid the blueslip error, we had to be more specific
in setting up a user in one place, but this reduced our coverage,
leading to another small test being added.

(imported from commit 33e14795500d9283de2a7c03c4c58aec11cea4b8)
2013-09-11 18:07:37 -04:00
Steve Howell 9eefc8ae62 Test fold_case option of Dict
(imported from commit 630643767a21818c1ef4adb557c794e560783c3e)
2013-09-11 18:07:37 -04:00
Steve Howell e9adaaa0c0 Avoid Dict crashes for undefined keys when fold_case is true.
The exceptions were cryptic before, and they were inconsistent with
the fold_case: false behavior.

(imported from commit a40704d1a22bcdc60d91be832ee3c81eb416c6dd)
2013-09-11 18:07:37 -04:00
Steve Howell a8ebd80c89 Test that vanilla Dict handles undefined keys
(imported from commit 09846eafa55f2321ca10db950ad3785ce78ae2c6)
2013-09-11 18:07:37 -04:00
Steve Howell c6131b630b Handle undefined keys in muting.is_topic_muted
(imported from commit 96a9f0253e1c0e72a2b05577118dac438d190994)
2013-09-11 16:47:36 -04:00
Steve Howell f616148181 Make muting case insensitive for streams and topics
(imported from commit 6e731a5305a6d19896c61300aedf0fb4a387e148)
2013-09-11 16:47:36 -04:00
Steve Howell 0641e693fa Add muting.set_muted_topics
(imported from commit c84cd085e513d57e3913543d40cd8fd6b5d45b67)
2013-09-11 16:47:36 -04:00
Steve Howell 04c6a8198a Add muting.get_muted_topics
(imported from commit 5edb1d36ae66dfc42cf534edc452959df8306661)
2013-09-11 16:47:36 -04:00
Steve Howell 8626276dc3 Add muting.unmute_topic
(imported from commit c3aa08b7d50c70cba86b43c12d618ba1d96832b4)
2013-09-11 16:47:35 -04:00
Kevin Mehall 7fea9e0755 Fix race condition in 06-unread
There was nothing to ensure that the changes resulting from scrolling
happened before the unread counts were checked. We already had a long
wait there; might as well do those checks after it to ensure that the
DOM is updated.

(imported from commit 0d4014ae6a74dd684521fecabefc4bf79015f842)
2013-09-10 18:06:57 -04:00
Kevin Mehall 5991b0003f Fix 06-unread PM count selector for changes in 2b82fbb
(imported from commit 0d8e52f17fb06092efff7cdf4fc4b01ab4901e2f)
2013-09-10 18:06:57 -04:00