From ae25c085e03397c52b41946ade1100c6b41c07d5 Mon Sep 17 00:00:00 2001 From: johnyma22 Date: Fri, 5 Oct 2012 00:38:07 +0100 Subject: [PATCH] a better way of geting href but note that it only works if we use settimeotu but settimeout breaks mocha so it's not okay. Peter please find a way of making sendkeys allow for callbacks, k tnx --- .../specs/keystroke_urls_become_clickable.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/frontend/specs/keystroke_urls_become_clickable.js b/tests/frontend/specs/keystroke_urls_become_clickable.js index 87de3bae..0bc4d86c 100644 --- a/tests/frontend/specs/keystroke_urls_become_clickable.js +++ b/tests/frontend/specs/keystroke_urls_become_clickable.js @@ -14,16 +14,19 @@ describe("urls become clickable", function(){ // 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 + firstTextElement.sendkeys('http://etherpad.org'); // insert a URL + +// setTimeout(function(){ + //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(); + var locatedHref = newFirstTextElement.find("a").contents().text(); + var isURL = locatedHref.indexOf("http://etherpad.org") != -1; // if we found a URL and it is for etherpad.org - //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; + console.log(isURL); //expect it to be bold expect(isURL).to.be(true); +// }, 1000); }); });