summaryrefslogtreecommitdiff
path: root/tests/frontend/specs/button_undo.js
diff options
context:
space:
mode:
authorjohnyma22 <john@mclear.co.uk>2012-10-09 00:52:46 +0100
committerjohnyma22 <john@mclear.co.uk>2012-10-09 00:52:46 +0100
commit2db2683c985cff1c7a7c4b07b1ef202eb9711e0c (patch)
tree07e19d2f954f594d15f3f9b0aecd2dd2d3a4d104 /tests/frontend/specs/button_undo.js
parentc9dd620e2ab8aeebde547a27fa6f7fccfc273388 (diff)
downloadetherpad-lite-2db2683c985cff1c7a7c4b07b1ef202eb9711e0c.zip
an undo button test
Diffstat (limited to 'tests/frontend/specs/button_undo.js')
-rw-r--r--tests/frontend/specs/button_undo.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/frontend/specs/button_undo.js b/tests/frontend/specs/button_undo.js
new file mode 100644
index 00000000..ea6a2835
--- /dev/null
+++ b/tests/frontend/specs/button_undo.js
@@ -0,0 +1,33 @@
+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");
+ // click the button
+ $undoButton.click();
+
+ helper.waitFor(function(){
+ return inner$("div span").first().text() === originalValue;
+ }).done(function(){
+ var finalValue = inner$("div span").first().text();
+ expect(finalValue).to.be(originalValue); // expect the value to change
+ done();
+ });
+ });
+});
+