From f20af4818c9dd0059ddf872b5ea93ad82b9e8aab Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sun, 18 Nov 2012 19:55:13 +0100 Subject: [PATCH 1/2] Revert "Make language frontend test pass" Shouldn't have used setTimeout here... This reverts commit ff0c9bb4a0c3c814c5f6373a38025b22fab26414. --- tests/frontend/specs/language.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/frontend/specs/language.js b/tests/frontend/specs/language.js index 377e4a7f8..254493c46 100644 --- a/tests/frontend/specs/language.js +++ b/tests/frontend/specs/language.js @@ -21,7 +21,13 @@ describe("Language select and change", function(){ $languageoption.attr('selected','selected'); $language.change(); - setTimeout(function(){ + helper.waitFor(function(){ + + var $boldButton = chrome$(".buttonicon-bold").parent(); + //get the title of the bold button + var boldButtonTitle = $boldButton[0]["title"]; + return boldButtonTitle !== undefined; + }).done(function(){ //get the value of the bold button var $boldButton = chrome$(".buttonicon-bold").parent(); @@ -33,7 +39,7 @@ describe("Language select and change", function(){ expect(boldButtonTitle).to.be("Fett (Strg-B)"); done(); - }, 1000); + }); }); it("makes text English", function(done) { @@ -52,7 +58,13 @@ describe("Language select and change", function(){ $languageoption.attr('selected','selected'); $language.change(); - setTimeout(function(){ + helper.waitFor(function(){ + + var $boldButton = chrome$(".buttonicon-bold").parent(); + //get the title of the bold button + var boldButtonTitle = $boldButton[0]["title"]; + return boldButtonTitle !== undefined; + }).done(function(){ //get the value of the bold button var $boldButton = chrome$(".buttonicon-bold").parent(); @@ -64,7 +76,7 @@ describe("Language select and change", function(){ expect(boldButtonTitle).to.be("Bold (Ctrl-B)"); done(); - }, 1000); + }); }); }); From c1f9028d19d08faceaf55891c1db999fd1148f07 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sun, 18 Nov 2012 20:11:16 +0100 Subject: [PATCH 2/2] Fix lang frontend test to 'waitFor' the 'localized' event --- tests/frontend/specs/language.js | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/tests/frontend/specs/language.js b/tests/frontend/specs/language.js index 254493c46..83bb84583 100644 --- a/tests/frontend/specs/language.js +++ b/tests/frontend/specs/language.js @@ -21,14 +21,13 @@ describe("Language select and change", function(){ $languageoption.attr('selected','selected'); $language.change(); - helper.waitFor(function(){ - - var $boldButton = chrome$(".buttonicon-bold").parent(); - //get the title of the bold button - var boldButtonTitle = $boldButton[0]["title"]; - return boldButtonTitle !== undefined; - }).done(function(){ + var localizedEventFired = false; + $(chrome$.window).bind('localized', function() { + localizedEventFired = true; + }) + helper.waitFor(function() { return localizedEventFired;}) + .done(function(){ //get the value of the bold button var $boldButton = chrome$(".buttonicon-bold").parent(); @@ -38,7 +37,6 @@ describe("Language select and change", function(){ //check if the language is now german expect(boldButtonTitle).to.be("Fett (Strg-B)"); done(); - }); }); @@ -58,13 +56,13 @@ describe("Language select and change", function(){ $languageoption.attr('selected','selected'); $language.change(); - helper.waitFor(function(){ + var localizedEventFired = false; + $(chrome$.window).bind('localized', function() { + localizedEventFired = true; + }) - var $boldButton = chrome$(".buttonicon-bold").parent(); - //get the title of the bold button - var boldButtonTitle = $boldButton[0]["title"]; - return boldButtonTitle !== undefined; - }).done(function(){ + helper.waitFor(function() { return localizedEventFired;}) + .done(function(){ //get the value of the bold button var $boldButton = chrome$(".buttonicon-bold").parent();