mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
an undo button test
This commit is contained in:
parent
c9dd620e2a
commit
2db2683c98
2 changed files with 36 additions and 1 deletions
|
@ -18,8 +18,10 @@
|
||||||
<script src="lib/jquery.iframe.js"></script>
|
<script src="lib/jquery.iframe.js"></script>
|
||||||
<script src="helper.js"></script>
|
<script src="helper.js"></script>
|
||||||
|
|
||||||
|
<!--
|
||||||
<script src="specs/helper.js"></script>
|
<script src="specs/helper.js"></script>
|
||||||
<script src="specs/button_clear_authorship_colors.js"></script>
|
-->
|
||||||
|
<script src="specs/button_undo.js"></script>
|
||||||
<!--
|
<!--
|
||||||
<script src="specs/button_bold.js"></script>
|
<script src="specs/button_bold.js"></script>
|
||||||
<script src="specs/button_italic.js"></script>
|
<script src="specs/button_italic.js"></script>
|
||||||
|
|
33
tests/frontend/specs/button_undo.js
Normal file
33
tests/frontend/specs/button_undo.js
Normal file
|
@ -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();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue