2012-10-06 21:38:17 +00:00
|
|
|
describe("urls", function(){
|
2012-10-03 20:55:23 +00:00
|
|
|
//create a new pad before each test run
|
|
|
|
beforeEach(function(cb){
|
2012-10-06 19:45:46 +00:00
|
|
|
helper.newPad(cb);
|
2012-10-03 20:55:23 +00:00
|
|
|
});
|
|
|
|
|
2012-10-06 21:38:17 +00:00
|
|
|
it("when you enter an url, it becomes clickable", function(done) {
|
2012-10-06 19:45:46 +00:00
|
|
|
var inner$ = helper.jQueryOf("inner");
|
|
|
|
var chrome$ = helper.jQueryOf("chrome");
|
2012-10-03 20:55:23 +00:00
|
|
|
|
|
|
|
//get the first text element out of the inner iframe
|
2012-10-06 19:45:46 +00:00
|
|
|
var firstTextElement = inner$("div").first();
|
2012-10-03 20:55:23 +00:00
|
|
|
|
|
|
|
// simulate key presses to delete content
|
|
|
|
firstTextElement.sendkeys('{selectall}'); // select all
|
|
|
|
firstTextElement.sendkeys('{del}'); // clear the first line
|
2012-10-04 23:38:07 +00:00
|
|
|
firstTextElement.sendkeys('http://etherpad.org'); // insert a URL
|
|
|
|
|
2012-10-06 19:45:46 +00:00
|
|
|
helper.waitFor(function(){
|
2012-10-04 23:38:07 +00:00
|
|
|
//ace creates a new dom element when you press a keystroke, so just get the first text element again
|
2012-10-06 19:45:46 +00:00
|
|
|
var newFirstTextElement = inner$("div").first();
|
|
|
|
var locatedHref = newFirstTextElement.find("a");
|
|
|
|
var isURL = locatedHref.length == 1; // if we found a URL and it is for etherpad.org
|
2012-10-03 20:55:23 +00:00
|
|
|
|
2012-10-06 19:45:46 +00:00
|
|
|
//expect it to be bold
|
|
|
|
expect(isURL).to.be(true);
|
2012-10-03 20:55:23 +00:00
|
|
|
|
2012-10-06 19:45:46 +00:00
|
|
|
//it will only come to this point if the expect statement above doesn't throw
|
|
|
|
done();
|
|
|
|
return true;
|
|
|
|
});
|
2012-10-03 20:55:23 +00:00
|
|
|
});
|
|
|
|
});
|