From 4950bb9120b2052960caca7bf72609cef0cce4f5 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Mon, 30 Jun 2014 19:21:16 +0200 Subject: [PATCH] Fixing tests after latest refactoring --- spec/chatbox.js | 22 +++++++++++----------- spec/chatroom.js | 6 +++--- spec/controlbox.js | 28 +++++++++++----------------- spec/minchats.js | 4 ++-- tests/utils.js | 4 ++-- 5 files changed, 29 insertions(+), 35 deletions(-) diff --git a/spec/chatbox.js b/spec/chatbox.js index a355f6283..a07151555 100644 --- a/spec/chatbox.js +++ b/spec/chatbox.js @@ -13,7 +13,7 @@ runs(function () { utils.closeAllChatBoxes(); utils.removeControlBox(); - converse.roster.localStorage._clear(); + converse.roster.browserStorage._clear(); utils.initConverse(); utils.createCurrentContacts(); utils.openControlBox(); @@ -115,7 +115,7 @@ expect(chatboxview.focus).toHaveBeenCalled(); }, converse)); - it("can be saved to, and retrieved from, localStorage", $.proxy(function () { + it("can be saved to, and retrieved from, browserStorage", $.proxy(function () { spyOn(converse, 'emit'); spyOn(this.chatboxviews, 'trimChats'); runs(function () { @@ -129,11 +129,11 @@ // will be empty. var newchatboxes = new this.ChatBoxes(); expect(newchatboxes.length).toEqual(0); - // The chatboxes will then be fetched from localStorage inside the + // The chatboxes will then be fetched from browserStorage inside the // onConnected method newchatboxes.onConnected(); expect(newchatboxes.length).toEqual(7); - // Check that the chatboxes items retrieved from localStorage + // Check that the chatboxes items retrieved from browserStorage // have the same attributes values as the original ones. attrs = ['id', 'box_id', 'visible']; for (i=0; i 0).toBeTruthy(); - expect(view.model.messages.localStorage.records.length > 0).toBeTruthy(); + expect(view.model.messages.browserStorage.records.length > 0).toBeTruthy(); expect(converse.emit).toHaveBeenCalledWith('onMessageSend', message); message = '/clear'; @@ -724,7 +724,7 @@ expect(view.clearMessages).toHaveBeenCalled(); expect(window.confirm).toHaveBeenCalled(); expect(view.model.messages.length, 0); // The messages must be removed from the chatbox - expect(view.model.messages.localStorage.records.length, 0); // And also from localStorage + expect(view.model.messages.browserStorage.records.length, 0); // And also from browserStorage expect(converse.emit.callCount, 1); expect(converse.emit.mostRecentCall.args, ['onMessageSend', message]); }, converse)); diff --git a/spec/chatroom.js b/spec/chatroom.js index d5abb62b2..44eb0b7dc 100644 --- a/spec/chatroom.js +++ b/spec/chatroom.js @@ -112,19 +112,19 @@ expect(converse.emit.callCount, 1); }, converse)); - it("can be saved to, and retrieved from, localStorage", $.proxy(function () { + it("can be saved to, and retrieved from, browserStorage", $.proxy(function () { // We instantiate a new ChatBoxes collection, which by default // will be empty. spyOn(this.chatboxviews, 'trimChats'); utils.openControlBox(); var newchatboxes = new this.ChatBoxes(); expect(newchatboxes.length).toEqual(0); - // The chatboxes will then be fetched from localStorage inside the + // The chatboxes will then be fetched from browserStorage inside the // onConnected method newchatboxes.onConnected(); expect(this.chatboxviews.trimChats).toHaveBeenCalled(); expect(newchatboxes.length).toEqual(2); // XXX: Includes controlbox, is this a bug? - // Check that the chatrooms retrieved from localStorage + // Check that the chatrooms retrieved from browserStorage // have the same attributes values as the original ones. attrs = ['id', 'box_id', 'visible']; for (i=0; i