clean up the change user name tests to be a bit more sane

pull/1158/merge
johnyma22 2012-10-30 17:45:37 +00:00
parent 83a2f3c1a9
commit fc36f6e9ef
1 changed files with 27 additions and 14 deletions

View File

@ -5,7 +5,7 @@ describe("change username value", function(){
this.timeout(5000);
});
it("makes sure changing username works", function(done) {
it("Changing username from one value to another sticks", function(done) {
var inner$ = helper.padInner$;
var chrome$ = helper.padChrome$;
@ -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
});
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();
});
});