Commit Graph

22 Commits

Author SHA1 Message Date
Tim Abbott
6e149a7594 lint: Add JS indentation eslint rules for node_tests.
The only difference between this as the main project's lint rules is
that we dont have the OuterIIFE setting.
2018-05-06 19:35:18 -07:00
Steve Howell
264dcb6f40 refactor: Extract MessageListData class.
Most of this was straightforward.

Most functions that were grabbed verbatim and whole from
the original class still have one-line wrappers.

Many functions are just-the-data versions of functions that
remain in MessageList:  see add, append, prepend, remove as
examples.  In a typical pattern the MessageList code becomes
super simple:

    prepend: function MessageList_prepend(messages) {
        var viewable_messages = this.data.prepend(messages);
        this.view.prepend(viewable_messages);
    },

Two large functions had some minor surgery:

    triage_messages =
            top half of add_messages +
            API to pass three lists back

    change_message_id =
            original version +
            two simple callbacks to list

For the function update_muting_and_rerender(), we continue
to early-exit if this.muting_enabled is false, and we copied
that same defensive check to the new function
named update_items_for_muting(), even though it's technically
hidden from that codepath by the caller.
2018-05-05 06:31:51 -07:00
Tim Abbott
51dc46bfb1 node: Fix test failures due to missing import.
I missed this when reviewing the last batch of changes.
2018-03-09 14:24:08 -08:00
Steve Howell
98c4ee3175 node tests: Use zrequire in message_list.js. 2017-11-08 12:24:17 -08:00
Steve Howell
eff9f617ef node tests: Use stubbed i18n in message_list.js. 2017-11-08 12:24:17 -08:00
Cory Lynch
ff9498f85b bookend: Hide re-subscribe button for private streams.
Fixes #5181
2017-06-20 20:56:26 -04: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
Tim Abbott
459421d045 eslint: Update node 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 like `assert_equal` as arguments; we fixed
  these 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
Tommy Ip
b3f4feb996 eslint: change max-len from warning to error and fix violations. 2016-12-02 14:16:33 +00:00
Steve Howell
ebe76dd2c3 Add stub_out_jquery() for node tests. 2016-07-30 14:54:30 -07:00
Vishnu Ks
ae49ad383d Rename all function on MessageList to all_messages. 2016-04-25 13:45:18 -07:00
Vishnu Ks
35b0af2852 Move all_msg_list to message_list.js. 2016-04-21 17:46:21 -07:00
Vishnu Ks
ee39f5009f Make message_list.js work like the other modules. 2016-04-20 15:29:30 -07:00
Varshit
72033069ed Extend lint-all to check for newlines at the end of files. 2016-03-17 23:03:56 -07:00
Tim Abbott
10657c1d53 Move node tests to node_tests/. 2015-10-28 10:11:47 -07:00