Move stream_member_list_entry() code in templates.js

(imported from commit 8cca602597a3277d5e80bc1b314cd3fb16ea013c)
This commit is contained in:
Steve Howell 2014-02-01 11:12:28 -05:00
parent 2faf29408a
commit ac57c3c16b
1 changed files with 26 additions and 26 deletions

View File

@ -74,32 +74,6 @@ function render(template_name, args) {
});
}());
(function stream_member_list_entry() {
var everyone_items = ["subscriber-name", "subscriber-email"];
var admin_items = ["remove-subscriber-button"];
// First, as non-admin.
var html = render('stream_member_list_entry',
{name: "King Hamlet", email: "hamlet@zulip.com"});
_.each(everyone_items, function (item) {
assert.equal($(html).find("." + item).length, 1);
});
_.each(admin_items, function (item) {
assert.equal($(html).find("." + item).length, 0);
});
// Now, as admin.
html = render('stream_member_list_entry',
{name: "King Hamlet", email: "hamlet@zulip.com",
displaying_for_admin: true});
_.each(everyone_items, function (item) {
assert.equal($(html).find("." + item).length, 1);
});
_.each(admin_items, function (item) {
assert.equal($(html).find("." + item).length, 1);
});
}());
(function admin_streams_list() {
var html = '<table>';
var streams = ['devel', 'trac', 'zulip'];
@ -421,6 +395,32 @@ function render(template_name, args) {
assert.equal(li.attr('data-name'), 'lunch');
}());
(function stream_member_list_entry() {
var everyone_items = ["subscriber-name", "subscriber-email"];
var admin_items = ["remove-subscriber-button"];
// First, as non-admin.
var html = render('stream_member_list_entry',
{name: "King Hamlet", email: "hamlet@zulip.com"});
_.each(everyone_items, function (item) {
assert.equal($(html).find("." + item).length, 1);
});
_.each(admin_items, function (item) {
assert.equal($(html).find("." + item).length, 0);
});
// Now, as admin.
html = render('stream_member_list_entry',
{name: "King Hamlet", email: "hamlet@zulip.com",
displaying_for_admin: true});
_.each(everyone_items, function (item) {
assert.equal($(html).find("." + item).length, 1);
});
_.each(admin_items, function (item) {
assert.equal($(html).find("." + item).length, 1);
});
}());
(function stream_sidebar_actions() {
var args = {
stream: {