From 4a89d28e3823fc13eac84ff648adb3ece5e0a8d9 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Wed, 15 Oct 2014 19:16:02 +0200 Subject: [PATCH] Fix tests by depending on jquery obj. Also fixed groupchat test by getting and including correct msg id. --- bower.json | 2 +- spec/chatbox.js | 7 ++++--- spec/chatroom.js | 11 ++++++----- spec/controlbox.js | 7 ++++--- spec/converse.js | 7 ++++--- spec/eventemitter.js | 7 ++++--- spec/minchats.js | 7 ++++--- spec/otr.js | 7 ++++--- tests/mock.js | 2 +- 9 files changed, 32 insertions(+), 25 deletions(-) diff --git a/bower.json b/bower.json index 9bd66b362..594e1c7bf 100644 --- a/bower.json +++ b/bower.json @@ -29,7 +29,7 @@ "bootstrap": "~3.2.0", "bootstrapJS": "https://raw.githubusercontent.com/jcbrand/bootstrap/7d96a5f60d26c67b5348b270a775518b96a702c8/dist/js/bootstrap.js", "fontawesome": "~4.1.0", - "typeahead.js": "https://raw.githubusercontent.com/jcbrand/typeahead.js/eedfb10505dd3a20123d1fafc07c1352d83f0ab3/dist/typeahead.jquery.js" + "typeahead.js": "https://raw.githubusercontent.com/jcbrand/typeahead.js/eedfb10505dd3a20123d1fafc07c1352d83f0ab3/dist/typeahead.jquery.js", "strophejs-plugins": "~0.0.4" }, "exportsOverride": {} diff --git a/spec/chatbox.js b/spec/chatbox.js index 5a36a71aa..ac4dc0518 100644 --- a/spec/chatbox.js +++ b/spec/chatbox.js @@ -1,12 +1,13 @@ (function (root, factory) { define([ + "jquery", "mock", "test_utils" - ], function (mock, test_utils) { - return factory(mock, test_utils); + ], function ($, mock, test_utils) { + return factory($, mock, test_utils); } ); -} (this, function (mock, test_utils) { +} (this, function ($, mock, test_utils) { return describe("Chatboxes", $.proxy(function(mock, test_utils) { describe("A Chatbox", $.proxy(function () { beforeEach(function () { diff --git a/spec/chatroom.js b/spec/chatroom.js index 225ca8b15..d9562b114 100644 --- a/spec/chatroom.js +++ b/spec/chatroom.js @@ -1,12 +1,13 @@ (function (root, factory) { define([ + "jquery", "mock", "test_utils" - ], function (mock, test_utils) { - return factory(mock, test_utils); + ], function ($, mock, test_utils) { + return factory($, mock, test_utils); } ); -} (this, function (mock, test_utils) { +} (this, function ($, mock, test_utils) { return describe("ChatRooms", $.proxy(function (mock, test_utils) { describe("A Chat Room", $.proxy(function () { beforeEach(function () { @@ -139,9 +140,9 @@ var message = $msg({ from: 'lounge@localhost/dummy', - id: '2', to: 'dummy@localhost.com', - type: 'groupchat' + type: 'groupchat', + id: view.model.messages.at(0).get('msgid') }).c('body').t(text); view.onChatRoomMessage(message.nodeTree); var $chat_content = view.$el.find('.chat-content'); diff --git a/spec/controlbox.js b/spec/controlbox.js index 3752309e8..74bcab738 100644 --- a/spec/controlbox.js +++ b/spec/controlbox.js @@ -1,12 +1,13 @@ (function (root, factory) { define([ + "jquery", "mock", "test_utils" - ], function (mock, test_utils) { - return factory(mock, test_utils); + ], function ($, mock, test_utils) { + return factory($, mock, test_utils); } ); -} (this, function (mock, test_utils) { +} (this, function ($, mock, test_utils) { var checkHeaderToggling = function ($header) { var $toggle = $header.find('a.group-toggle'); diff --git a/spec/converse.js b/spec/converse.js index f2a4e04eb..632cce89b 100644 --- a/spec/converse.js +++ b/spec/converse.js @@ -1,12 +1,13 @@ (function (root, factory) { define([ + "jquery", "mock", "test_utils" - ], function (mock, test_utils) { - return factory(mock, test_utils); + ], function ($, mock, test_utils) { + return factory($, mock, test_utils); } ); -} (this, function (mock, test_utils) { +} (this, function ($, mock, test_utils) { return describe("Converse", $.proxy(function(mock, test_utils) { beforeEach($.proxy(function () { diff --git a/spec/eventemitter.js b/spec/eventemitter.js index 7ebea9db4..29da8ea5b 100644 --- a/spec/eventemitter.js +++ b/spec/eventemitter.js @@ -1,12 +1,13 @@ (function (root, factory) { define([ + "jquery", "mock", "test_utils" - ], function (mock, test_utils) { - return factory(mock, test_utils); + ], function ($, mock, test_utils) { + return factory($, mock, test_utils); } ); -} (this, function (mock, test_utils) { +} (this, function ($, mock, test_utils) { return describe("The Converse Event Emitter", $.proxy(function(mock, test_utils) { window.localStorage.clear(); window.sessionStorage.clear(); diff --git a/spec/minchats.js b/spec/minchats.js index 21db4ab4d..1f94c7b77 100644 --- a/spec/minchats.js +++ b/spec/minchats.js @@ -1,12 +1,13 @@ (function (root, factory) { define([ + "jquery", "mock", "test_utils" - ], function (mock, test_utils) { - return factory(mock, test_utils); + ], function ($, mock, test_utils) { + return factory($, mock, test_utils); } ); -} (this, function (mock, test_utils) { +} (this, function ($, mock, test_utils) { return describe("The Minimized Chats Widget", $.proxy(function(mock, test_utils) { beforeEach(function () { runs(function () { diff --git a/spec/otr.js b/spec/otr.js index a02b6b5bf..8c18734f9 100644 --- a/spec/otr.js +++ b/spec/otr.js @@ -1,12 +1,13 @@ (function (root, factory) { define([ + "jquery", "mock", "test_utils" - ], function (mock, test_utils) { - return factory(mock, test_utils); + ], function ($, mock, test_utils) { + return factory($, mock, test_utils); } ); -} (this, function (mock, test_utils) { +} (this, function ($, mock, test_utils) { return describe("The OTR module", $.proxy(function(mock, test_utils) { beforeEach($.proxy(function () { diff --git a/tests/mock.js b/tests/mock.js index f2a16a1fa..213edb797 100644 --- a/tests/mock.js +++ b/tests/mock.js @@ -46,7 +46,7 @@ 'join': function () {}, 'leave': function () {}, 'rooms': {}, - 'groupchat': function () {} + 'groupchat': function () {return String((new Date()).getTime()); } }, 'service': 'jasmine tests', 'jid': 'dummy@localhost',