Commit 95bc55c1 authored by JC Brand's avatar JC Brand

Merge branch 'master' into amd-strophe

parents e5e8539f af87d59e
module.exports = function(grunt) { module.exports = function(grunt) {
var path = require('path');
var cfg = require('./package.json'); var cfg = require('./package.json');
grunt.initConfig({ grunt.initConfig({
jst: { jst: {
...@@ -62,6 +63,10 @@ module.exports = function(grunt) { ...@@ -62,6 +63,10 @@ module.exports = function(grunt) {
dest: 'css/converse.min.css', dest: 'css/converse.min.css',
src: ['css/converse.css'] src: ['css/converse.css']
} }
},
touch: {
npm: ['stamp-npm'],
bower: ['stamp-bower']
} }
}); });
grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-cssmin');
...@@ -69,6 +74,7 @@ module.exports = function(grunt) { ...@@ -69,6 +74,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-jst'); grunt.loadNpmTasks('grunt-contrib-jst');
grunt.loadNpmTasks('grunt-json'); grunt.loadNpmTasks('grunt-json');
grunt.loadNpmTasks('grunt-contrib-requirejs'); grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-touch');
grunt.registerTask('test', 'Run Tests', function () { grunt.registerTask('test', 'Run Tests', function () {
var done = this.async(); var done = this.async();
...@@ -107,23 +113,26 @@ module.exports = function(grunt) { ...@@ -107,23 +113,26 @@ module.exports = function(grunt) {
var child_process = require('child_process'); var child_process = require('child_process');
var exec = child_process.exec; var exec = child_process.exec;
var callback = function (err, stdout, stderr) { var callback = function (err, stdout, stderr) {
grunt.log.write(stdout);
if (err) { if (err) {
grunt.log.write('build failed with error code '+err.code); grunt.log.write('build failed with error code '+err.code);
grunt.log.write(stderr); grunt.log.write(stderr);
} done(false);
grunt.log.write(stdout); } else
done(); done();
}; };
exec('./node_modules/requirejs/bin/r.js -o src/build.js && ' + var rjsext = (process.platform === 'win32') ? '.cmd' : '';
'./node_modules/requirejs/bin/r.js -o src/build.js optimize=none out=builds/converse.js && ' + var rjs = path.resolve('./node_modules/.bin/r.js' + rjsext);
'./node_modules/requirejs/bin/r.js -o src/build-no-jquery.js &&' + exec(rjs + ' -o src/build.js && ' +
'./node_modules/requirejs/bin/r.js -o src/build-no-jquery.js optimize=none out=builds/converse.nojquery.js && ' + rjs + ' -o src/build.js optimize=none out=builds/converse.js && ' +
'./node_modules/requirejs/bin/r.js -o src/build-no-locales-no-otr.js && ' + rjs + ' -o src/build-no-jquery.js &&' +
'./node_modules/requirejs/bin/r.js -o src/build-no-locales-no-otr.js optimize=none out=builds/converse-no-locales-no-otr.js && ' + rjs + ' -o src/build-no-jquery.js optimize=none out=builds/converse.nojquery.js && ' +
'./node_modules/requirejs/bin/r.js -o src/build-no-otr.js &&' + rjs + ' -o src/build-no-locales-no-otr.js && ' +
'./node_modules/requirejs/bin/r.js -o src/build-no-otr.js optimize=none out=builds/converse-no-otr.js && ' + rjs + ' -o src/build-no-locales-no-otr.js optimize=none out=builds/converse-no-locales-no-otr.js && ' +
'./node_modules/requirejs/bin/r.js -o src/build-website-no-otr.js &&' + rjs + ' -o src/build-no-otr.js &&' +
'./node_modules/requirejs/bin/r.js -o src/build-website.js', callback); rjs + ' -o src/build-no-otr.js optimize=none out=builds/converse-no-otr.js && ' +
rjs + ' -o src/build-website-no-otr.js &&' +
rjs + ' -o src/build-website.js', callback);
// XXX: It might be possible to not have separate build config files. For example: // XXX: It might be possible to not have separate build config files. For example:
// 'r.js -o src/build.js paths.converse-dependencies=src/deps-no-otr paths.locales=locale/nolocales out=builds/converse-no-locales-no-otr.min.js' // 'r.js -o src/build.js paths.converse-dependencies=src/deps-no-otr paths.locales=locale/nolocales out=builds/converse-no-locales-no-otr.min.js'
}); });
......
# You can set these variables from the command line. # You can set these variables from the command line.
BOWER ?= ./node_modules/.bin/bower BOWER ?= node_modules/.bin/bower
BUILDDIR = ./docs BUILDDIR = ./docs
PAPER = PAPER =
PHANTOMJS ?= ./node_modules/.bin/phantomjs PHANTOMJS ?= ./node_modules/.bin/phantomjs
...@@ -8,6 +8,7 @@ SPHINXOPTS = ...@@ -8,6 +8,7 @@ SPHINXOPTS =
PO2JSON ?= ./node_modules/.bin/po2json PO2JSON ?= ./node_modules/.bin/po2json
SASS ?= sass SASS ?= sass
GRUNT ?= ./node_modules/.bin/grunt GRUNT ?= ./node_modules/.bin/grunt
HTTPSERVE ?= ./node_modules/.bin/http-server
# Internal variables. # Internal variables.
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) ./docs/source ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) ./docs/source
...@@ -19,18 +20,27 @@ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) ./docs/source ...@@ -19,18 +20,27 @@ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) ./docs/source
all: dev all: dev
help: help:
@echo "Please use \`make <target>' where <target> is one of" @echo "Please use \`make <target>' where <target> is one of the following"
@echo " dev to set up the development environment"
@echo " build create minified builds containing converse.js and all its dependencies" @echo " build create minified builds containing converse.js and all its dependencies"
@echo " gettext to make PO message catalogs of the documentation" @echo " changes make an overview of all changed/added/deprecated items added to the documentation"
@echo " html to make standalone HTML files of the documentation" @echo " css generate CSS from the Sass files"
@echo " pot to generate a gettext POT file to be used for translations" @echo " dev set up the development environment"
@echo " po to generate gettext PO files for each i18n language" @echo " epub export the documentation to epub"
@echo " po2json to generate JSON files from the language PO files" @echo " gettext make PO message catalogs of the documentation"
@echo " release to make a new minified release" @echo " html make standalone HTML files of the documentation"
@echo " linkcheck to check all documentation external links for integrity" @echo " linkcheck check all documentation external links for integrity"
@echo " epub to export the documentation to epub" @echo " cssmin minify the CSS files"
@echo " changes to make an overview of all changed/added/deprecated items added to the documentation" @echo " po generate gettext PO files for each i18n language"
@echo " po2json generate JSON files from the language PO files"
@echo " pot generate a gettext POT file to be used for translations"
@echo " release make a new minified release"
@echo " serve serve this directory via a webserver on port 8000"
########################################################################
## Miscellaneous
serve: dev
$(HTTPSERVE) -p 8000
######################################################################## ########################################################################
## Translation machinery ## Translation machinery
...@@ -49,12 +59,6 @@ po2json: ...@@ -49,12 +59,6 @@ po2json:
######################################################################## ########################################################################
## Release management ## Release management
jsmin:
./node_modules/requirejs/bin/r.js -o src/build.js && ./node_modules/requirejs/bin/r.js -o src/build-no-locales-no-otr.js && ./node_modules/requirejs/bin/r.js -o src/build-no-otr.js && ./node_modules/requirejs/bin/r.js -o src/build-website.js
cssmin:
$(GRUNT) cssmin
release: release:
sed -i s/Project-Id-Version:\ Converse\.js\ [0-9]\.[0-9]\.[0-9]/Project-Id-Version:\ Converse.js\ $(VERSION)/ locale/converse.pot sed -i s/Project-Id-Version:\ Converse\.js\ [0-9]\.[0-9]\.[0-9]/Project-Id-Version:\ Converse.js\ $(VERSION)/ locale/converse.pot
sed -i s/\"version\":\ \"[0-9]\.[0-9]\.[0-9]\"/\"version\":\ \"$(VERSION)\"/ bower.json sed -i s/\"version\":\ \"[0-9]\.[0-9]\.[0-9]\"/\"version\":\ \"$(VERSION)\"/ bower.json
...@@ -86,14 +90,20 @@ clean:: ...@@ -86,14 +90,20 @@ clean::
dev: clean dev: clean
npm install npm install
${BOWER} update; $(BOWER) update;
bundler install --path=. bundler install --path=.
######################################################################## ########################################################################
## Builds ## Builds
css:: css::
${SASS} sass/converse.scss > css/converse.css $(SASS) sass/converse.scss > css/converse.css
jsmin:
./node_modules/requirejs/bin/r.js -o src/build.js && ./node_modules/requirejs/bin/r.js -o src/build-no-locales-no-otr.js && ./node_modules/requirejs/bin/r.js -o src/build-no-otr.js && ./node_modules/requirejs/bin/r.js -o src/build-website.js
cssmin:
$(GRUNT) cssmin
build:: build::
$(GRUNT) jst $(GRUNT) jst
......
# You can set these variables from the command line.
GRUNT ?= node_modules\.bin\grunt.cmd
BOWER ?= node_modules\.bin\bower
PHANTOMJS ?= node_modules\.bin\phantomjs
SASS ?= sass
RMRF ?= rmdir /q /s
RMF ?= del /q
HTTPSERVE ?= ./node_modules/.bin/http-server
.PHONY: all help clean css minjs build
all: dev
help:
@echo "Please use \`make <target>' where <target> is one of the following"
@echo " dev to set up the development environment"
@echo " build create minified builds containing converse.js and all its dependencies"
@echo " serve to serve this directory via a webserver on port 8000"
########################################################################
## Miscellaneous
serve:
$(HTTPSERVE) -p 8000
########################################################################
## Install dependencies
stamp-npm: package.json
npm install
$(GRUNT) touch:npm
stamp-bower: stamp-npm bower.json
$(BOWER) install
$(GRUNT) touch:bower
clean::
@if EXIST stamp-npm $(RMF) stamp-npm
@if EXIST stamp-bower $(RMF) stamp-bower
@if EXIST node_modules\. $(RMRF) node_modules
@if EXIST components\. $(RMRF) components
dev: clean
npm install
$(BOWER) update
bundler install --path=.
########################################################################
## Builds
css::
$(SASS) sass/converse.scss > css/converse.css
build::
$(GRUNT) jst
$(GRUNT) minify
########################################################################
## Tests
check:: stamp-npm
$(PHANTOMJS) node_modules/phantom-jasmine/lib/run_jasmine_test.coffee tests.html
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
"requirejs-text": "~2.0.12", "requirejs-text": "~2.0.12",
"requirejs-tpl-jcbrand": "*", "requirejs-tpl-jcbrand": "*",
"momentjs": "~2.6.0", "momentjs": "~2.6.0",
"jquery.browser": "https://raw.githubusercontent.com/jcbrand/jquery-browser-plugin/ae5e88aa7a26f583e8865c3961ba857918c4c9c1/dist/jquery.browser.js", "jquery.browser": ">=0.0.7",
"jquery-easing-original": "https://raw.githubusercontent.com/jcbrand/jquery.easing/7de3458b1845a72c1f407debf6b223c8446396bf/jquery.easing.1.3.js", "jquery-easing-original": "https://raw.githubusercontent.com/jcbrand/jquery.easing/7de3458b1845a72c1f407debf6b223c8446396bf/jquery.easing.1.3.js",
"bootstrap": "~3.2.0", "bootstrap": "~3.2.0",
"bootstrapJS": "https://raw.githubusercontent.com/jcbrand/bootstrap/7d96a5f60d26c67b5348b270a775518b96a702c8/dist/js/bootstrap.js", "bootstrapJS": "https://raw.githubusercontent.com/jcbrand/bootstrap/7d96a5f60d26c67b5348b270a775518b96a702c8/dist/js/bootstrap.js",
......
...@@ -170,8 +170,8 @@ ...@@ -170,8 +170,8 @@
var converse = this; var converse = this;
// Logging // Logging
Strophe.log = function (level, msg) { console.log(level+' '+msg); }; Strophe.log = function (level, msg) { converse.log(level+' '+msg, level); };
Strophe.error = function (msg) { console.log('ERROR: '+msg); }; Strophe.error = function (msg) { converse.log(msg, 'error'); };
// Add Strophe Namespaces // Add Strophe Namespaces
Strophe.addNamespace('CHATSTATES', 'http://jabber.org/protocol/chatstates'); Strophe.addNamespace('CHATSTATES', 'http://jabber.org/protocol/chatstates');
...@@ -4257,7 +4257,7 @@ ...@@ -4257,7 +4257,7 @@
this.XMPPStatus = Backbone.Model.extend({ this.XMPPStatus = Backbone.Model.extend({
initialize: function () { initialize: function () {
this.set({ this.set({
'status' : this.get('status') || 'online' 'status' : this.getStatus()
}); });
this.on('change', $.proxy(function (item) { this.on('change', $.proxy(function (item) {
if (this.get('fullname') === undefined) { if (this.get('fullname') === undefined) {
...@@ -4277,12 +4277,14 @@ ...@@ -4277,12 +4277,14 @@
}, this)); }, this));
}, },
sendPresence: function (type) { sendPresence: function (type, status_message) {
if (type === undefined) { if (typeof type === 'undefined') {
type = this.get('status') || 'online'; type = this.get('status') || 'online';
} }
var status_message = this.get('status_message'), if (typeof status_message === 'undefined') {
presence; status_message = this.get('status_message');
}
var presence;
// Most of these presence types are actually not explicitly sent, // Most of these presence types are actually not explicitly sent,
// but I add all of them here fore reference and future proofing. // but I add all of them here fore reference and future proofing.
if ((type === 'unavailable') || if ((type === 'unavailable') ||
...@@ -4316,8 +4318,12 @@ ...@@ -4316,8 +4318,12 @@
this.save({'status': value}); this.save({'status': value});
}, },
getStatus: function() {
return this.get('status') || 'online';
},
setStatusMessage: function (status_message) { setStatusMessage: function (status_message) {
converse.connection.send($pres().c('show').t(this.get('status')).up().c('status').t(status_message)); this.sendPresence(this.getStatus(), status_message);
this.save({'status_message': status_message}); this.save({'status_message': status_message});
if (this.xhr_custom_status) { if (this.xhr_custom_status) {
$.ajax({ $.ajax({
......
...@@ -12,6 +12,9 @@ Changelog ...@@ -12,6 +12,9 @@ Changelog
* #292 Better support for XEP-0085 Chat State Notifications. [jcbrand] * #292 Better support for XEP-0085 Chat State Notifications. [jcbrand]
* #295 Document "allow_registration". [gbonvehi] * #295 Document "allow_registration". [gbonvehi]
* #304 Added Polish translations. [ser] * #304 Added Polish translations. [ser]
* New Makefile.win to build in Windows environments. [gbonvehi]
* Strophe.log and Strophe.error now uses converse.log to output messages. [gbonvehi]
* #305 presence/show text in XMPP request isn't allowed by specification. [gbonvehi]
0.8.6 (2014-12-07) 0.8.6 (2014-12-07)
------------------ ------------------
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
{# Custom CSS overrides #} {# Custom CSS overrides #}
{% set bootswatch_css_custom = ['_static/style.css', "../../css/converse.min.css"] %} {% set bootswatch_css_custom = ['_static/style.css', "../../css/converse.min.css"] %}
{% set script_files = script_files + ["../../builds/converse.min.js"] %} {% set script_files = script_files + ["../../builds/converse.min.js", "../../analytics.js"] %}
{# Add some extra stuff before and use existing with 'super()' call. #} {# Add some extra stuff before and use existing with 'super()' call. #}
{% block footer %} {% block footer %}
......
====================== .. _builds:
Creating custom builds
====================== ===============
Creating builds
===============
.. contents:: Table of Contents .. contents:: Table of Contents
:depth: 3 :depth: 3
...@@ -10,31 +12,53 @@ Creating custom builds ...@@ -10,31 +12,53 @@ Creating custom builds
.. warning:: There current documentation in this section does not adequately .. warning:: There current documentation in this section does not adequately
explain how to create custom builds. explain how to create custom builds.
.. _`minification`: .. note:: Please make sure to read the section :doc:`development` and that you have installed
all development dependencies (long story short, you should be able to just run ``make dev``)
Creating builds
===============
We use `require.js <http://requirejs.org>`_ to keep track of *Converse.js* and
its dependencies and to to bundle them together in a single file fit for
deployment to a production site.
To create the bundles, simply run::
make build
Minification This command does the following:
============
Minifying Javascript and CSS * It creates different Javascript bundles of Converse.js.
---------------------------- The individual javascript files will be bundled and minified with `require.js`_'s
optimization tool, using `almond <https://github.com/jrburke/almond>`_.
You can `read more about require.js's optimizer here <http://requirejs.org/docs/optimization.html>`_.
Please make sure to read the section :doc:`development` and that you have installed * It bundles the HTML templates in ``./src/templates/`` into a single file called ``templates.js``.
all development dependencies (long story short, you can run ``npm install`` This file can then be included via the ``<script>`` tag. See for example the ``non_amd.html`` example page.
and then ``grunt fetch``).
We use `require.js <http://requirejs.org>`_ to keep track of *Converse.js* and its dependencies and to * It bundles all the translation files in ``./locale/`` into a single file ``locales.js``.
to bundle them together in a single minified file fit for deployment to a This file can then be included via the ``<script>`` tag. See for example the ``non_amd.html`` example page.
production site.
To minify the Javascript and CSS, run the following command: * Also, the CSS files in the ``./css`` directory will be minified.
The built Javasript bundles are contained in the ``./builds`` directory:
.. code-block:: bash
jc@conversejs:~/converse.js (master)$ ls builds/
converse.js converse-no-locales-no-otr.js converse.website.min.js
converse.min.js converse-no-locales-no-otr.min.js converse.website-no-otr.min.js
converse.nojquery.js converse-no-otr.js locales.js
converse.nojquery.min.js converse-no-otr.min.js templates.js
.. _`minification`:
:: Minifying the CSS
-----------------
grunt minify To only minify the CSS files, nothing else, run the following command::
Javascript will be bundled and minified with `require.js`_'s optimization tool, make cssmin
using `almond <https://github.com/jrburke/almond>`_.
You can `read more about require.js's optimizer here <http://requirejs.org/docs/optimization.html>`_. The CSS files are minified via `cssmin <https://github.com/gruntjs/grunt-contrib-cssmin>`_.
CSS is minified via `cssmin <https://github.com/gruntjs/grunt-contrib-cssmin>`_.
.. _development:
=========== ===========
Development Development
=========== ===========
...@@ -12,6 +14,8 @@ follow the instructions below to create this folder and fetch Converse's ...@@ -12,6 +14,8 @@ follow the instructions below to create this folder and fetch Converse's
3rd-party dependencies. 3rd-party dependencies.
.. note:: .. note::
Windows environment: We recommend installing the required tools using `Chocolatey <https://chocolatey.org/>`_
You will need Node.js (nodejs.install), Git (git.install) and optionally to build using Makefile, GNU Make (make)
If you have trouble setting up a development environment on Windows, If you have trouble setting up a development environment on Windows,
please read `this post <http://librelist.com/browser//conversejs/2014/11/5/openfire-converse-and-visual-studio-questions/#b28387e7f8f126693b11598a8acbe810>`_ please read `this post <http://librelist.com/browser//conversejs/2014/11/5/openfire-converse-and-visual-studio-questions/#b28387e7f8f126693b11598a8acbe810>`_
in the mailing list.: in the mailing list.:
...@@ -27,6 +31,9 @@ version `here <https://nodejs.org/download>`_. ...@@ -27,6 +31,9 @@ version `here <https://nodejs.org/download>`_.
Also make sure you have ``Git`` installed. `Details <http://git-scm.com/book/en/Getting-Started-Installing-Git>`_. Also make sure you have ``Git`` installed. `Details <http://git-scm.com/book/en/Getting-Started-Installing-Git>`_.
.. note::
Windows users should use Chocolatey as recommended above.:
Once you have *Node.js* and *git* installed, run the following command inside the Converse.js Once you have *Node.js* and *git* installed, run the following command inside the Converse.js
directory: directory:
...@@ -34,6 +41,11 @@ directory: ...@@ -34,6 +41,11 @@ directory:
make dev make dev
On Windows you need to specify Makefile.win to be used by running:
::
make -f Makefile.win dev
Or alternatively, if you don't have GNU Make: Or alternatively, if you don't have GNU Make:
:: ::
...@@ -64,7 +76,6 @@ If you are curious to know what the different dependencies are: ...@@ -64,7 +76,6 @@ If you are curious to know what the different dependencies are:
Double-check the output of ```make dev``` to see if there are any errors Double-check the output of ```make dev``` to see if there are any errors
listed. For support, you can write to the mailing list: conversejs@librelist.com listed. For support, you can write to the mailing list: conversejs@librelist.com
With AMD and require.js (recommended) With AMD and require.js (recommended)
===================================== =====================================
......
...@@ -42,6 +42,7 @@ Table of Contents ...@@ -42,6 +42,7 @@ Table of Contents
setup setup
configuration configuration
development development
theming
translations translations
documentation documentation
builds builds
=======
Theming
=======
.. contents:: Table of Contents
:depth: 2
:local:
Setting up your environment
===========================
In order to theme converse.js, you'll first need to set up a `development_` environment.
You'll also want to preview the changes you make in the browser.
To set up the development environment and also start up a web browser which
will serve the files for you, simply run::
make serve
You can now open http://localhost:8000 in your webbrowser to see the
converse.js website.
However, when developing or changing the theme, you'll want to load all the
unminified JS and CSS resources. To do this, open http://localhost:8000/dev.html
instead.
Mockups
=======
Converse.js contains some mockups in the ``./mockup`` directory against which you
can preview and tweak your changes.
The ``./mockup/index.html`` file contains the most comprehensive mockup, while
the other files focus on particular UI aspects.
To see it in your browser, simply open: http://localhost:8000/mockup
Modifying the HTML templates of Converse.js
===========================================
The HTML markup of converse.js is contained small ``.html`` files in the
``./src/templates`` directory.
Modifying the CSS
=================
The CSS files are generated from `Sass <http://sass-lang.com>`_ files in
the ``./sass`` directory.
To generate the CSS you can run::
make css
Creating builds
===============
Once you've themed converse.js, you'll want to create new minified builds of
the Javascript and CSS files.
Please refer to the :doc:`builds` section for information on how this is done.
This diff is collapsed.
This diff is collapsed.
...@@ -24,7 +24,7 @@ require.config({ ...@@ -24,7 +24,7 @@ require.config({
"eventemitter": "components/otr/build/dep/eventemitter", "eventemitter": "components/otr/build/dep/eventemitter",
"jquery": "components/jquery/dist/jquery", "jquery": "components/jquery/dist/jquery",
"jquery-private": "src/jquery-private", "jquery-private": "src/jquery-private",
"jquery.browser": "components/jquery.browser/index", "jquery.browser": "components/jquery.browser/dist/jquery.browser",
"jquery.easing": "components/jquery-easing-original/index", // XXX: Only required for https://conversejs.org website "jquery.easing": "components/jquery-easing-original/index", // XXX: Only required for https://conversejs.org website
"moment": "components/momentjs/moment", "moment": "components/momentjs/moment",
"strophe-base64": "components/strophe/src/base64", "strophe-base64": "components/strophe/src/base64",
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<script type="text/javascript" src="components/backbone.browserStorage/backbone.browserStorage.js"></script> <script type="text/javascript" src="components/backbone.browserStorage/backbone.browserStorage.js"></script>
<script type="text/javascript" src="components/backbone.overview/backbone.overview.js"></script> <script type="text/javascript" src="components/backbone.overview/backbone.overview.js"></script>
<script type="text/javascript" src="components/momentjs/moment.js"></script> <script type="text/javascript" src="components/momentjs/moment.js"></script>
<script type="text/javascript" src="components/jquery.browser/index.js"></script> <script type="text/javascript" src="components/jquery.browser/dist/jquery.browser.js"></script>
<script type="text/javascript" src="components/typeahead.js/index.js"></script> <script type="text/javascript" src="components/typeahead.js/index.js"></script>
<script type="text/javascript" src="components/jed/jed.js"></script> <script type="text/javascript" src="components/jed/jed.js"></script>
<script type="text/javascript" src="builds/locales.js"></script> <script type="text/javascript" src="builds/locales.js"></script>
......
(function (root, factory) {
define([
"jquery",
"mock",
"test_utils"
], function ($, mock, test_utils) {
return factory($, mock, test_utils);
}
);
} (this, function ($, mock, test_utils) {
return describe("The XMPPStatus model", $.proxy(function(mock, test_utils) {
beforeEach($.proxy(function () {
window.localStorage.clear();
window.sessionStorage.clear();
}, converse));
it("won't send <show>online when setting a custom status message", $.proxy(function () {
this.xmppstatus.save({'status': 'online'});
spyOn(this.xmppstatus, 'setStatusMessage').andCallThrough();
spyOn(converse.connection, 'send');
this.xmppstatus.setStatusMessage("I'm also happy!");
runs (function () {
expect(converse.connection.send).toHaveBeenCalled();
var $stanza = $(converse.connection.send.argsForCall[0][0].tree());
expect($stanza.children().length).toBe(1);
expect($stanza.children('show').length).toBe(0);
});
}, converse));
}, converse, mock, test_utils));
}));
...@@ -67,7 +67,8 @@ require([ ...@@ -67,7 +67,8 @@ require([
"spec/chatroom", "spec/chatroom",
"spec/minchats", "spec/minchats",
"spec/profiling", "spec/profiling",
"spec/register" "spec/register",
"spec/xmppstatus"
], function () { ], function () {
// Make sure this callback is only called once. // Make sure this callback is only called once.
delete converse.callback; delete converse.callback;
......
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