summaryrefslogtreecommitdiff
path: root/tests/frontend/specs/button_italic.js
diff options
context:
space:
mode:
authorPeter 'Pita' Martischka <petermartischka@googlemail.com>2012-10-04 14:35:25 +0200
committerPeter 'Pita' Martischka <petermartischka@googlemail.com>2012-10-04 14:35:25 +0200
commit95ce0aaba880ac48ba47a8a66d3c05bb74153f1c (patch)
tree0fb0514985c96cdb3b31e137c8fd7797238cb651 /tests/frontend/specs/button_italic.js
parent7aee98bce82e1ac9eee5309328505b440edc9ee3 (diff)
parent24988d659c7db1014712f5d3b753cb0e9d5e004e (diff)
downloadetherpad-lite-95ce0aaba880ac48ba47a8a66d3c05bb74153f1c.zip
merged remote feature/frontend-tests
Diffstat (limited to 'tests/frontend/specs/button_italic.js')
-rw-r--r--tests/frontend/specs/button_italic.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/frontend/specs/button_italic.js b/tests/frontend/specs/button_italic.js
new file mode 100644
index 00000000..c394723c
--- /dev/null
+++ b/tests/frontend/specs/button_italic.js
@@ -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], $inner);
+
+ //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());
+ });
+});