diff --git a/converse.js b/converse.js index de80d028a..8a920b345 100644 --- a/converse.js +++ b/converse.js @@ -229,6 +229,12 @@ chats.splice(_.indexOf(chats, jid), 1); } store.set(key, chats); + }, + + flush: function () { + // Clears all localstorage content handled by burry.js + // Only used in tests + store.flush(); } }); @@ -370,8 +376,6 @@ $content = this.$el.find('.chat-content'), prev_date, this_date, now, separator, i; - - for (i=0; i<_.size(msgs); i++) { var msg = msgs[i], msg_array = msg.split(' ', 2), @@ -1822,5 +1826,7 @@ } }, this)); }, xmppchat)); + + return xmppchat; })); diff --git a/tests.html b/tests.html new file mode 100644 index 000000000..146ac0d7a --- /dev/null +++ b/tests.html @@ -0,0 +1,18 @@ + + + + Converse.js Tests + + + + + + + + + + + + + diff --git a/tests_main.js b/tests_main.js new file mode 100644 index 000000000..e73e39b1e --- /dev/null +++ b/tests_main.js @@ -0,0 +1,17 @@ +require(["jquery", + "spec/StorageSpec"], function($) { + + $(function($) { + var jasmineEnv = jasmine.getEnv(); + jasmineEnv.updateInterval = 1000; + + var htmlReporter = new jasmine.HtmlReporter(); + + jasmineEnv.addReporter(htmlReporter); + + jasmineEnv.specFilter = function(spec) { + return htmlReporter.specFilter(spec); + }; + jasmineEnv.execute(); + }); +});