summaryrefslogtreecommitdiff
path: root/tests/frontend
diff options
context:
space:
mode:
authormluto <m@luto.at>2013-01-14 17:45:11 +0100
committermluto <m@luto.at>2013-01-14 17:45:11 +0100
commitadf5c97664172ef61c3817167d53f4a3f109cc58 (patch)
treee3180418c2f06a3f7605d8554b034f7c47735293 /tests/frontend
parent77401f275960b68ec1bf8cbd330201d08ff33731 (diff)
downloadetherpad-lite-adf5c97664172ef61c3817167d53f4a3f109cc58.zip
Added test for empty-message-block
Diffstat (limited to 'tests/frontend')
-rw-r--r--tests/frontend/specs/keystroke_chat.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/frontend/specs/keystroke_chat.js b/tests/frontend/specs/keystroke_chat.js
index d6a7d2fd..060c5aa2 100644
--- a/tests/frontend/specs/keystroke_chat.js
+++ b/tests/frontend/specs/keystroke_chat.js
@@ -36,4 +36,31 @@ describe("send chat message", function(){
});
});
+
+ it("makes sure that an empty message can't be sent", function(done) {
+ var inner$ = helper.padInner$;
+ var chrome$ = helper.padChrome$;
+
+ //click on the chat button to make chat visible
+ var $chatButton = chrome$("#chaticon");
+ $chatButton.click();
+ var $chatInput = chrome$("#chatinput");
+ $chatInput.sendkeys('{enter}'); // simulate a keypress of enter (to send an empty message)
+ $chatInput.sendkeys('mluto'); // simulate a keypress of typing mluto
+ $chatInput.sendkeys('{enter}'); // simulate a keypress of enter (to send 'mluto')
+
+ //check if chat shows up
+ helper.waitFor(function(){
+ return chrome$("#chattext").children("p").length !== 0; // wait until the chat message shows up
+ }).done(function(){
+ // check that the empty message is not there
+ expect(chrome$("#chattext").children("p").length).to.be(1);
+ // check that the received message is not the empty one
+ var $firstChatMessage = chrome$("#chattext").children("p");
+ var containsMessage = $firstChatMessage.text().indexOf("mluto") !== -1;
+ expect(containsMessage).to.be(true);
+ done();
+ });
+
+ });
});