Commit 44fe406a authored by JC Brand's avatar JC Brand

Refactored tests.

Split MainSpec out into ChatBoxSpec and ControlBoxSpec.

Part of trying to have looser coupling between tests so that they can be run
independently.
parent b0f12d0f
This diff is collapsed.
......@@ -9,10 +9,11 @@
} (this, function (mock, utils) {
return describe("ChatRooms", $.proxy(function (mock, utils) {
describe("A Chat Room", $.proxy(function () {
beforeEach($.proxy(function () {
if (!$("div#controlbox").is(':visible')) {
$('.toggle-online-users').click();
}
utils.closeAllChatBoxes();
utils.openControlBox();
utils.openRoomsPanel();
var roomspanel = this.chatboxesview.views.controlbox.roomspanel;
var $input = roomspanel.$el.find('input.new-chatroom-name');
var $nick = roomspanel.$el.find('input.new-chatroom-nick');
......
This diff is collapsed.
This diff is collapsed.
(function (root, factory) {
define("utils", ['jquery'],
function($) {
return factory($);
define("utils", [
'jquery',
'mock'
],
function($, mock) {
return factory($, mock);
});
}(this, function ($) {
}(this, function ($, mock) {
var utils = {};
utils.closeAllChatBoxes = function () {
......@@ -45,14 +48,22 @@
$tabs.find('li').first().find('a').click();
};
utils.createContactsRoster = function () {
for (i=0; i<cur_names.length; i++) {
this.roster.create({
jid: cur_names[i].replace(' ','.').toLowerCase() + '@localhost',
utils.openRoomsPanel = function () {
var cbview = converse.chatboxesview.views.controlbox;
var $tabs = cbview.$el.find('#controlbox-tabs');
$tabs.find('li').last().find('a').click();
};
utils.createCurrentContacts = function () {
// Create current (as opposed to requesting or pending) contacts
// for the user's roster.
for (i=0; i<mock.cur_names.length; i++) {
converse.roster.create({
jid: mock.cur_names[i].replace(' ','.').toLowerCase() + '@localhost',
subscription: 'both',
ask: null,
fullname: cur_names[i],
is_last: i===(cur_names.length-1)
fullname: mock.cur_names[i],
is_last: i===(mock.cur_names.length-1)
});
}
return this;
......
......@@ -102,7 +102,8 @@ require([
require([
"jasmine-console-reporter",
"jasmine-junit-reporter",
"spec/MainSpec",
"spec/ControlBoxSpec",
"spec/ChatBoxSpec",
"spec/ChatRoomSpec"
], function () {
// Jasmine stuff
......@@ -119,7 +120,7 @@ require([
jasmineEnv.specFilter = function(spec) {
return htmlReporter.specFilter(spec);
};
jasmineEnv.updateInterval = 20;
jasmineEnv.updateInterval = 100;
}
jasmineEnv.execute();
});
......
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