mirror of
https://github.com/zulip/zulip.git
synced 2025-11-12 01:47:41 +00:00
* 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.
45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
add_dependencies({
|
|
Handlebars: 'handlebars',
|
|
hashchange: 'js/hashchange',
|
|
muting: 'js/muting',
|
|
narrow: 'js/narrow',
|
|
stream_data: 'js/stream_data',
|
|
templates: 'js/templates',
|
|
});
|
|
|
|
set_global('unread', {});
|
|
|
|
var jsdom = require("jsdom");
|
|
var window = jsdom.jsdom().defaultView;
|
|
global.$ = require('jquery')(window);
|
|
|
|
var topic_list = require('js/topic_list.js');
|
|
|
|
global.compile_template('topic_list_item');
|
|
|
|
(function test_topic_list_build_widget() {
|
|
var stream = "devel";
|
|
var active_topic = "testing";
|
|
var max_topics = 5;
|
|
|
|
var topics = [
|
|
{subject: "coding"},
|
|
];
|
|
global.stream_data.populate_stream_topics_for_tests({devel: topics});
|
|
global.unread.num_unread_for_subject = function () {
|
|
return 1;
|
|
};
|
|
|
|
var parent_elem = $('<div>');
|
|
var widget = topic_list.build_widget(parent_elem, stream, active_topic, max_topics);
|
|
var topic_html = widget.get_dom();
|
|
|
|
assert.equal(widget.get_parent(), parent_elem);
|
|
assert.equal(widget.get_stream_name(), 'devel');
|
|
|
|
var topic = $(topic_html).find('a').text().trim();
|
|
assert.equal(topic, 'coding');
|
|
|
|
global.write_test_output("test_topic_list_build_widget", parent_elem.html());
|
|
}());
|