This test should work, Peter, why does this test not work?

pull/1097/merge
johnyma22 2012-10-03 21:55:23 +01:00
parent 38ef46449b
commit 24988d659c
2 changed files with 32 additions and 1 deletions

View File

@ -16,9 +16,11 @@
<script src="helper.js"></script>
<script src="sendkeys.js"></script>
<script src="specs/keystroke_urls_become_clickable.js"></script>
<!--
<script src="specs/button_bold.js"></script>
<script src="specs/button_italic.js"></script>
<script src="specs/keystroke_delete.js"></script>
-->
<script src="runner.js"></script>
</html>

View File

@ -0,0 +1,29 @@
describe("urls become clickable", function(){
//create a new pad before each test run
beforeEach(function(cb){
testHelper.newPad(cb);
});
it("adds a url and makes sure it's clickable", 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();
// simulate key presses to delete content
firstTextElement.sendkeys('{selectall}'); // select all
firstTextElement.sendkeys('{del}'); // clear the first line
firstTextElement.sendkeys('http://etherpad.org'); // add a url to the pad
//ace creates a new dom element when you press a keystroke, so just get the first text element again
var newFirstTextElement = $inner.find("div").first();
// is there a url class now?
var isURL = newFirstTextElement.find("href").length === 1;
//expect it to be bold
expect(isURL).to.be(true);
});
});