first user contributed test, note the two files that needed to be edited, this kinda sucks
This commit is contained in:
parent
ba4ebbba3b
commit
649a28b6c6
|
@ -17,6 +17,7 @@
|
|||
<script src="helper.js"></script>
|
||||
|
||||
<script src="specs/button_bold.js"></script>
|
||||
<script src="specs/button_italic.js"></script>
|
||||
|
||||
<script src="runner.js"></script>
|
||||
</html>
|
|
@ -0,0 +1,33 @@
|
|||
describe("italic button", function(){
|
||||
//create a new pad before each test run
|
||||
beforeEach(function(cb){
|
||||
testHelper.newPad(cb);
|
||||
});
|
||||
|
||||
it("makes text italic", function() {
|
||||
//get the inner iframe
|
||||
var $inner = testHelper.$getPadInner();
|
||||
|
||||
//get the first text element out of the inner iframe
|
||||
var firstTextElement = $inner.find("div").first();
|
||||
|
||||
//select this text element
|
||||
testHelper.selectText(firstTextElement[0]);
|
||||
|
||||
//get the bold button and click it
|
||||
var $italicButton = testHelper.$getPadChrome().find(".buttonicon-italic");
|
||||
$italicButton.click();
|
||||
|
||||
//ace creates a new dom element when you press a button, so just get the first text element again
|
||||
var newFirstTextElement = $inner.find("div").first();
|
||||
|
||||
// is there a <b> element now?
|
||||
var isItalic = newFirstTextElement.find("i").length === 1;
|
||||
|
||||
//expect it to be bold
|
||||
expect(isItalic).to.be(true);
|
||||
|
||||
//make sure the text hasn't changed
|
||||
expect(newFirstTextElement.text()).to.eql(firstTextElement.text());
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue