mirror of
				https://github.com/ether/etherpad-lite.git
				synced 2025-10-31 08:11:10 +01:00 
			
		
		
		
	clean up the change user name tests to be a bit more sane
This commit is contained in:
		
							parent
							
								
									83a2f3c1a9
								
							
						
					
					
						commit
						fc36f6e9ef
					
				| @ -5,7 +5,7 @@ describe("change username value", function(){ | |||||||
|     this.timeout(5000); |     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 inner$ = helper.padInner$; | ||||||
|     var chrome$ = helper.padChrome$; |     var chrome$ = helper.padChrome$; | ||||||
| 
 | 
 | ||||||
| @ -31,8 +31,13 @@ describe("change username value", function(){ | |||||||
| 
 | 
 | ||||||
|     //check if the username has been changed to John McLear
 |     //check if the username has been changed to John McLear
 | ||||||
|     expect(correctUsernameValue).to.be(true); |     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
 |     //click on the chat button to make chat visible
 | ||||||
|     var $chatButton = chrome$("#chaticon"); |     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
 |       return chrome$("#chattext").children("p").length !== 0; // wait until the chat message shows up
 | ||||||
|     }).done(function(){ |     }).done(function(){ | ||||||
|       var $firstChatMessage = chrome$("#chattext").children("p"); |       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
 |       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(); |     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(); | ||||||
|  |   });  | ||||||
| }); | }); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user