mirror of https://github.com/zulip/zulip.git
zjquery: Require explicit set_parent() calls.
Before this commit, we were erroneously setting up parents as part of add_child() calls, but it's not necessarily the case that those children are immediate children, and therefore the first object is not necessarily the immediate parent.
This commit is contained in:
parent
c91eca291c
commit
70407e080d
|
@ -292,6 +292,7 @@ presence.presence_info[norbert.user_id] = { status: activity.ACTIVE };
|
|||
var li = $("li.user_sidebar_entry[data-user-id='" + pm_key + "']");
|
||||
count.add_child('.value', value);
|
||||
li.add_child('.count', count);
|
||||
count.set_parent(li);
|
||||
|
||||
var counts = new Dict();
|
||||
counts.set(pm_key, 5);
|
||||
|
@ -316,6 +317,7 @@ presence.presence_info[norbert.user_id] = { status: activity.ACTIVE };
|
|||
var li = $(li_selector);
|
||||
count.add_child('.value', value);
|
||||
li.add_child('.count', count);
|
||||
count.set_parent(li);
|
||||
|
||||
var counts = new Dict();
|
||||
counts.set(pm_key, 5);
|
||||
|
@ -576,6 +578,8 @@ $('.user-list-filter').is = function (sel) {
|
|||
var li = $(li_selector);
|
||||
count.add_child('.value', value);
|
||||
li.add_child('.count', count);
|
||||
count.set_parent(li);
|
||||
|
||||
var real_get_huddles = activity.get_huddles;
|
||||
activity.get_huddles = function () {
|
||||
return ['1,2'];
|
||||
|
|
|
@ -325,10 +325,7 @@ function test_upload_realm_icon(upload_realm_icon) {
|
|||
function test_change_message_editing(change_message_editing) {
|
||||
var parent_elem = $('editing-parent-stub');
|
||||
|
||||
parent_elem.add_child(
|
||||
'whatever',
|
||||
$('#id_realm_message_content_edit_limit_minutes_label')
|
||||
);
|
||||
$('#id_realm_message_content_edit_limit_minutes_label').set_parent(parent_elem);
|
||||
|
||||
change_message_editing.apply({checked: false});
|
||||
assert(parent_elem.hasClass('control-label-disabled'));
|
||||
|
@ -342,10 +339,7 @@ function test_change_message_editing(change_message_editing) {
|
|||
function test_change_invite_required(change_invite_required) {
|
||||
var parent_elem = $('invite-parent-stub');
|
||||
|
||||
parent_elem.add_child(
|
||||
'whatever',
|
||||
$('#id_realm_invite_by_admins_only_label')
|
||||
);
|
||||
$('#id_realm_invite_by_admins_only_label').set_parent(parent_elem);
|
||||
|
||||
change_invite_required.apply({checked: false});
|
||||
assert(parent_elem.hasClass('control-label-disabled'));
|
||||
|
|
|
@ -52,6 +52,7 @@ set_global('topic_list', {});
|
|||
var devel_count = $('devel-count');
|
||||
$('devel-stub-html').add_child('.count', devel_count);
|
||||
$('devel-count').add_child('.value', devel_value);
|
||||
devel_count.set_parent($('devel-stub-html'));
|
||||
|
||||
global.templates.render = function (template_name, data) {
|
||||
assert.equal(template_name, 'stream_sidebar_row');
|
||||
|
@ -68,6 +69,7 @@ set_global('topic_list', {});
|
|||
var social_count = $('social-count');
|
||||
$('social-stub-html').add_child('.count', social_count);
|
||||
$('social-count').add_child('.value', social_value);
|
||||
social_count.set_parent($('social-stub-html'));
|
||||
|
||||
global.templates.render = function (template_name, data) {
|
||||
assert.equal(template_name, 'stream_sidebar_row');
|
||||
|
@ -362,6 +364,7 @@ function initialize_stream_data() {
|
|||
var value = $(value_selector);
|
||||
elem.add_child('.count', count);
|
||||
count.add_child('.value', value);
|
||||
count.set_parent(elem);
|
||||
|
||||
return elem;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ exports.make_zjquery = function () {
|
|||
|
||||
var self = {
|
||||
add_child: function (child_selector, child_elem) {
|
||||
child_elem.set_parent(self);
|
||||
children.set(child_selector, child_elem);
|
||||
},
|
||||
addClass: function (class_name) {
|
||||
|
|
Loading…
Reference in New Issue