diff options
author | johnyma22 <john@mclear.co.uk> | 2012-10-30 17:45:37 +0000 |
---|---|---|
committer | johnyma22 <john@mclear.co.uk> | 2012-10-30 17:45:37 +0000 |
commit | fc36f6e9ef23a3544d4d0f449777b81330eb165d (patch) | |
tree | f2e338f938660c93feeb13096b9573ad274c2302 | |
parent | 83a2f3c1a9cf7067614e0c57c99eb94e19d631e7 (diff) | |
download | etherpad-lite-fc36f6e9ef23a3544d4d0f449777b81330eb165d.zip |
clean up the change user name tests to be a bit more sane
-rw-r--r-- | tests/frontend/specs/change_user_name.js | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/tests/frontend/specs/change_user_name.js b/tests/frontend/specs/change_user_name.js index 9bfba4ed..2d825f1c 100644 --- a/tests/frontend/specs/change_user_name.js +++ b/tests/frontend/specs/change_user_name.js @@ -5,9 +5,9 @@ describe("change username value", function(){ this.timeout(5000); }); - it("makes sure changing username works", function(done) { - var inner$ = helper.padInner$; - var chrome$ = helper.padChrome$; + it("Changing username from one value to another sticks", function(done) { + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; //click on the settings button to make settings visible var $userButton = chrome$(".buttonicon-showusers"); @@ -31,8 +31,13 @@ describe("change username value", function(){ //check if the username has been changed to John McLear expect(correctUsernameValue).to.be(true); + done(); + }); + it("changing username is to the value we expect", function(done) { + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; //click on the chat button to make chat visible var $chatButton = chrome$("#chaticon"); @@ -46,18 +51,26 @@ describe("change username value", function(){ return chrome$("#chattext").children("p").length !== 0; // wait until the chat message shows up }).done(function(){ var $firstChatMessage = chrome$("#chattext").children("p"); - var containsJohnMcLear = $firstChatMessage.text().indexOf("John McLear") !== -1; // does the string contain Jo$ + var containsJohnMcLear = $firstChatMessage.text().indexOf("John McLear") !== -1; // does the string contain John McLear expect(containsJohnMcLear).to.be(true); // expect the first chat message to contain JohnMcLear - - beforeEach(function(cb){ // create another pad.. - helper.newPad(cb); - this.timeout(5000); - }); - var rememberedName = $usernameInput.val() === "John McLear"; - var rememberedWrongName = $usernameInput.val() === "Hairy Robot"; - expect(rememberedName).to.be(true); // expect it to remember the name of the user - expect(rememberedWrongName).to.be(false); // expect it to forget any old names.. - }); + }); done(); }); + + it("make sure the username has stuck when we create a new pad", function(done){ + beforeEach(function(cb){ // create another pad.. + helper.newPad(cb); + this.timeout(5000); + }); + + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + var $usernameInput = chrome$("#myusernameedit"); + + var rememberedName = $usernameInput.val() === "John McLear"; + var rememberedWrongName = $usernameInput.val() === "Hairy Robot"; + expect(rememberedName).to.be(true); // expect it to remember the name of the user + expect(rememberedWrongName).to.be(false); // expect it to forget any old names.. + done(); + }); }); |