summaryrefslogtreecommitdiff
path: root/tests/frontend/specs/keystroke_urls_become_clickable.js
diff options
context:
space:
mode:
authorjohnyma22 <john@mclear.co.uk>2012-10-03 21:55:23 +0100
committerjohnyma22 <john@mclear.co.uk>2012-10-03 21:55:23 +0100
commit24988d659c7db1014712f5d3b753cb0e9d5e004e (patch)
tree8643b9a0f57c0b4f859f37fba7f6d2f11885b4e1 /tests/frontend/specs/keystroke_urls_become_clickable.js
parent38ef46449b714c4dd4d459d6b3148bcc69814bc3 (diff)
downloadetherpad-lite-24988d659c7db1014712f5d3b753cb0e9d5e004e.zip
This test should work, Peter, why does this test not work?
Diffstat (limited to 'tests/frontend/specs/keystroke_urls_become_clickable.js')
-rw-r--r--tests/frontend/specs/keystroke_urls_become_clickable.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/frontend/specs/keystroke_urls_become_clickable.js b/tests/frontend/specs/keystroke_urls_become_clickable.js
new file mode 100644
index 00000000..87de3bae
--- /dev/null
+++ b/tests/frontend/specs/keystroke_urls_become_clickable.js
@@ -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);
+
+ });
+});