global.stub_out_jquery(); add_dependencies({ Handlebars: 'handlebars', templates: 'js/templates', muting: 'js/muting', narrow: 'js/narrow', stream_color: 'js/stream_color', stream_data: 'js/stream_data', subs: 'js/subs', util: 'js/util', hashchange: 'js/hashchange' }); set_global('unread', {}); set_global('message_store', { recent_private_messages: new global.Array() }); // TODO: move pm_list-related tests to their own module var pm_list = require('js/pm_list.js'); var stream_list = require('js/stream_list.js'); var jsdom = require("jsdom"); var window = jsdom.jsdom().defaultView; global.$ = require('jquery')(window); $.fn.expectOne = function () { assert(this.length === 1); return this; }; global.compile_template('sidebar_private_message_list'); global.compile_template('stream_sidebar_row'); global.compile_template('stream_privacy'); (function test_build_private_messages_list() { var reply_tos = "alice@zulip.com,bob@zulip.com"; var active_conversation = "Alice, Bob"; var max_conversations = 5; var conversations = {reply_to: reply_tos, display_reply_to: active_conversation, timestamp: 0 }; global.message_store.recent_private_messages.push(conversations); global.unread.num_unread_for_person = function () { return 1; }; var convos_html = pm_list._build_private_messages_list(active_conversation, max_conversations); global.write_test_output("test_build_private_messages_list", convos_html); var conversation = $(convos_html).find('a').text().trim(); assert.equal(conversation, active_conversation); }()); function clear_filters() { var stream_search_box = $(''); var stream_filters = $('