Commit Graph

6 Commits

Author SHA1 Message Date
Steve Howell
7376934a77 zjquery: Add $.create() method.
This commit add $.create(), which allows you to create a
jQuery object that just has a name to identify it, as opposed
to some selector or HTML fragment.  It's useful for things that
are really used as stubs.

This also fixes a bunch of the existing tests to use $.create().

Before this fix, you could actually just do $('some-stub'), but
now we enforce that the input to $() looks like a valid selector
or HTML fragment, and we make some exceptions for things like
window-stub and document-stub.
2017-07-08 10:32:32 -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
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
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