Commit add3b8ef authored by JC Brand's avatar JC Brand

utils now no longer depends on jquery.

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