fix button redo spec

This commit is contained in:
John McLear 2012-10-28 18:19:16 +00:00
parent 54f6ac451a
commit 72d40fcfd4
1 changed files with 9 additions and 7 deletions

View File

@ -1,4 +1,4 @@
describe("undo button", function(){
describe("undo button then redo button", function(){
beforeEach(function(cb){
helper.newPad(cb); // creates a new pad
this.timeout(5000);
@ -11,22 +11,24 @@ describe("undo button", function(){
// get the first text element inside the editable space
var $firstTextElement = inner$("div span").first();
var originalValue = $firstTextElement.text(); // get the original value
var newString = "Foo";
$firstTextElement.sendkeys("foo"); // send line 1 to the pad
$firstTextElement.sendkeys(newString); // send line 1 to the pad
var modifiedValue = $firstTextElement.text(); // get the modified value
expect(modifiedValue).not.to.be(originalValue); // expect the value to change
// get clear authorship button as a variable
// get undo and redo buttons
var $undoButton = chrome$(".buttonicon-undo");
var $redoButton = chrome$(".buttonicon-redo");
// click the buttons
$undoButton.click();
$redoButton.click();
$undoButton.click(); // removes foo
$redoButton.click(); // resends foo
helper.waitFor(function(){
return inner$("div span").first().text() === originalValue;
console.log(inner$("div span").first().text());
return inner$("div span").first().text() === newString;
}).done(function(){
var finalValue = inner$("div span").first().text();
var finalValue = inner$("div").first().text();
expect(finalValue).to.be(modifiedValue); // expect the value to change
done();
});