Browse Source

Fix tests by depending on jquery obj.

Also fixed groupchat test by getting and including correct msg id.
JC Brand 10 năm trước cách đây
mục cha
commit
4a89d28e38
9 tập tin đã thay đổi với 32 bổ sung25 xóa
  1. 1 1
      bower.json
  2. 4 3
      spec/chatbox.js
  3. 6 5
      spec/chatroom.js
  4. 4 3
      spec/controlbox.js
  5. 4 3
      spec/converse.js
  6. 4 3
      spec/eventemitter.js
  7. 4 3
      spec/minchats.js
  8. 4 3
      spec/otr.js
  9. 1 1
      tests/mock.js

+ 1 - 1
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": {}

+ 4 - 3
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 () {

+ 6 - 5
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');

+ 4 - 3
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');

+ 4 - 3
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 () {

+ 4 - 3
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();

+ 4 - 3
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 () {

+ 4 - 3
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 () {

+ 1 - 1
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',