summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjohnyma22 <john@mclear.co.uk>2012-10-09 16:33:47 +0100
committerjohnyma22 <john@mclear.co.uk>2012-10-09 16:33:47 +0100
commitc975d81b411404099eedd852bc7b1ebb160884ea (patch)
treeaf069e47b36d75c59c35f5bc5a769092aff0489c
parentf79bc7f1d862b3b5e7bc10157008e397da352c43 (diff)
downloadetherpad-lite-c975d81b411404099eedd852bc7b1ebb160884ea.zip
clear authorship colors test
-rw-r--r--tests/frontend/specs/button_clear_authorship_colors.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/frontend/specs/button_clear_authorship_colors.js b/tests/frontend/specs/button_clear_authorship_colors.js
new file mode 100644
index 00000000..8949a5f7
--- /dev/null
+++ b/tests/frontend/specs/button_clear_authorship_colors.js
@@ -0,0 +1,52 @@
+describe("clear authorship colors button", function(){
+ //create a new pad before each test run
+ beforeEach(function(cb){
+ helper.newPad(cb);
+ this.timeout(5000);
+ });
+
+ it("makes text clear authorship colors", function(done) {
+ var inner$ = helper.padInner$;
+ var chrome$ = helper.padChrome$;
+
+ // override the confirm dialogue functioon
+ helper.padChrome$.window.confirm = function(){
+ return true;
+ }
+
+ //get the first text element out of the inner iframe
+ var $firstTextElement = inner$("div").first();
+
+ // Get the original text
+ var originalText = inner$("div").first().text();
+
+ // Set some new text
+ var sentText = "Hello";
+
+ //select this text element
+ $firstTextElement.sendkeys(sentText);
+
+ helper.waitFor(function(){
+ return inner$("div").first().text() === sentText + originalText; // wait until we have the full value available
+ }).done(function(){
+ // does the first divs span include an author class?
+ var hasAuthorClass = inner$("div span").first().attr("class").indexOf("author") !== -1;
+ expect(hasAuthorClass).to.be(true);
+
+ //get the clear authorship colors button and click it
+ var $clearauthorshipcolorsButton = chrome$(".buttonicon-clearauthorship");
+ $clearauthorshipcolorsButton.click();
+
+ // does the first divs span include an author class?
+ var hasAuthorClass = inner$("div span").first().attr("class").indexOf("author") !== -1;
+ expect(hasAuthorClass).to.be(false);
+
+ // does the first div include an author class?
+ var hasAuthorClass = inner$("div").first().attr("class").indexOf("author") !== -1;
+ expect(hasAuthorClass).to.be(false);
+
+ done();
+ });
+
+ });
+});