started button_indention test

pull/3713/head
Peter 'Pita' Martischka 2012-10-08 21:04:09 +01:00
parent 6fefadee88
commit 0927b13f78
2 changed files with 44 additions and 6 deletions

View File

@ -26,10 +26,7 @@
<script src="specs/font_type.js"></script>
<script src="specs/embed_value.js"></script>
<script src="specs/keystroke_urls_become_clickable.js"></script>
<!-- TODO: port to new test helper
<script src="specs/button_indentation.js"></script>
-->
<script src="runner.js"></script>
</html>

View File

@ -1,9 +1,50 @@
describe("indentation button", function(){
//create a new pad before each test run
beforeEach(function(cb){
testHelper.newPad(cb);
helper.newPad(cb);
this.timeout(5000);
});
it("indent text", function(done){
var inner$ = helper.padInner$;
var chrome$ = helper.padChrome$;
var $indentButton = chrome$(".buttonicon-indent");
$indentButton.click();
helper.waitFor(function(){
return inner$("div").first().find("ul li").length === 1;
}).done(done);
});
it("keeps the indent on enter for the new line", function(done){
var inner$ = helper.padInner$;
var chrome$ = helper.padChrome$;
var $indentButton = chrome$(".buttonicon-indent");
$indentButton.click();
//type a bit, make a line break and type again
var $firstTextElement = inner$("div span").first();
$firstTextElement.sendkeys('line 1');
$firstTextElement.sendkeys('{enter}');
$firstTextElement.sendkeys('line 2');
$firstTextElement.sendkeys('{enter}');
helper.waitFor(function(){
return inner$("div span").first().text().indexOf("line 2") === -1;
}).done(function(){
var $newSecondLine = inner$("div").first().next();
var hasULElement = $newSecondLine.find("ul li").length === 1;
expect(hasULElement).to.be(true);
expect($newSecondLine.text()).to.be("line 2");
done();
});
});
/*
it("makes text indented and outdented", function() {
//get the inner iframe
@ -94,7 +135,7 @@ describe("indentation button", function(){
/* this test creates the below content, both should have double indentation
line1
line2
*/
firstTextElement.sendkeys('{rightarrow}'); // simulate a keypress of enter
firstTextElement.sendkeys('{enter}'); // simulate a keypress of enter
@ -134,5 +175,5 @@ describe("indentation button", function(){
//expect it to be part of a list
expect(isLI).to.be(true);
},1000);
});
});*/
});