From fbf509ce870ac74f84e449002c82983043aad858 Mon Sep 17 00:00:00 2001 From: johnyma22 Date: Tue, 9 Oct 2012 01:30:46 +0100 Subject: [PATCH] redo button --- tests/frontend/specs/button_redo.js | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/frontend/specs/button_redo.js diff --git a/tests/frontend/specs/button_redo.js b/tests/frontend/specs/button_redo.js new file mode 100644 index 00000000..59991ebe --- /dev/null +++ b/tests/frontend/specs/button_redo.js @@ -0,0 +1,35 @@ +describe("undo button", function(){ + beforeEach(function(cb){ + helper.newPad(cb); // creates a new pad + this.timeout(5000); + }); + + it("undo some typing", function(done){ + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + + // get the first text element inside the editable space + var $firstTextElement = inner$("div span").first(); + var originalValue = $firstTextElement.text(); // get the original value + + $firstTextElement.sendkeys("foo"); // 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 + var $undoButton = chrome$(".buttonicon-undo"); + var $redoButton = chrome$(".buttonicon-redo"); + // click the buttons + $undoButton.click(); + $redoButton.click(); + + helper.waitFor(function(){ + return inner$("div span").first().text() === originalValue; + }).done(function(){ + var finalValue = inner$("div span").first().text(); + expect(finalValue).to.be(modifiedValue); // expect the value to change + done(); + }); + }); +}); +