Commit add3b8ef authored by JC Brand's avatar JC Brand

utils now no longer depends on jquery.

parent 6c3aa34c
......@@ -137,6 +137,17 @@
});
_converse.rosterview.update(); // XXX: Will normally called as event handler
}
$.fn.hasScrollBar = function() {
if (!$.contains(document, this.get(0))) {
return false;
}
if(this.parent().height() < this.get(0).scrollHeight) {
return true;
}
return false;
};
return test_utils.waitUntil(function () {
if (_converse.rosterview.$roster.hasScrollBar()) {
return $filter.is(':visible');
......
......@@ -191,11 +191,12 @@
_converse.api.listen.on('serviceDiscovered', this.featureAdded, this);
// Features could have been added before the controlbox was
// initialized. We're only interested in MUC
const feature = _converse.disco_entities[_converse.domain].features.findWhere({
'var': Strophe.NS.MUC
});
if (feature) {
this.featureAdded(feature);
const entity = _converse.disco_entities[_converse.domain];
if (!_.isUndefined(entity)) {
const feature = entity.features.findWhere({'var': Strophe.NS.MUC });
if (feature) {
this.featureAdded(feature);
}
}
});
},
......@@ -1283,7 +1284,7 @@
$fieldset.append($('<p class="instructions">').text(instructions));
}
_.each($fields, function (field) {
$fieldset.append(utils.xForm2webForm($(field), $stanza));
$fieldset.append(utils.xForm2webForm(field, stanza));
});
$form.append('<fieldset></fieldset>');
$fieldset = $form.children('fieldset:last');
......
......@@ -356,7 +356,7 @@
if (this.form_type === 'xform') {
$fields = $stanza.find('field');
_.each($fields, (field) => {
$form.append(utils.xForm2webForm.bind(this, $(field), $stanza));
$form.append(utils.xForm2webForm.bind(this, field, stanza));
});
} else {
// Show fields
......
<field var="{{{name}}}">{[ if (_.isArray(value)) { ]}
<field var="{{{name}}}">
{[ if (_.isArray(value)) { ]}
{[ _.each(value,function(arrayValue) { ]}<value>{{{arrayValue}}}</value>{[ }); ]}
{[ } else { ]}
<value>{{{value}}}</value>
......
This diff is collapsed.
(function (root, factory) {
define("mock", ['jquery.noconflict', 'converse'], factory);
}(this, function ($, converse_api) {
var _ = converse_api.env._;
var Promise = converse_api.env.Promise;
var Strophe = converse_api.env.Strophe;
var $iq = converse_api.env.$iq;
}(this, function ($, converse) {
var _ = converse.env._;
var Promise = converse.env.Promise;
var Strophe = converse.env.Strophe;
var $iq = converse.env.$iq;
var mock = {};
// Names from http://www.fakenamegenerator.com/
mock.req_names = [
......@@ -99,7 +99,7 @@
});
}
var _converse = converse_api.initialize(_.extend({
var _converse = converse.initialize(_.extend({
'i18n': 'en',
'auto_subscribe': false,
'play_sounds': false,
......@@ -113,7 +113,7 @@
'debug': false
}, settings || {}));
_converse.ChatBoxViews.prototype.trimChat = function () {};
_converse.disable_effects = true;
window.converse_disable_effects = true;
$.fx.off = true;
return _converse;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment