etherpad-lite/tests/frontend/specs/button_clear_authorship_col...

55 lines
1.8 KiB
JavaScript
Raw Normal View History

2012-10-09 17:33:47 +02:00
describe("clear authorship colors button", function(){
//create a new pad before each test run
beforeEach(function(cb){
helper.newPad(cb);
2012-11-02 00:19:59 +01:00
this.timeout(60000);
2012-10-09 17:33:47 +02:00
});
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
2012-11-04 01:25:54 +01:00
$firstTextElement.sendkeys('{selectall}');
2012-10-09 17:33:47 +02:00
$firstTextElement.sendkeys(sentText);
2012-11-04 01:25:54 +01:00
$firstTextElement.sendkeys('{rightarrow}');
2012-10-09 17:33:47 +02:00
helper.waitFor(function(){
2012-11-03 23:02:09 +01:00
return inner$("div span").first().attr("class").indexOf("author") !== -1; // wait until we have the full value available
2012-10-09 17:33:47 +02:00
}).done(function(){
2012-11-04 01:25:54 +01:00
//IE hates you if you don't give focus to the inner frame bevore you do a clearAuthorship
inner$("div").first().focus();
2012-10-09 17:33:47 +02:00
//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?
2012-11-04 01:25:54 +01:00
console.log(inner$("div span").first().attr("class"));
2012-10-09 17:33:47 +02:00
var hasAuthorClass = inner$("div span").first().attr("class").indexOf("author") !== -1;
2012-11-04 01:25:54 +01:00
//expect(hasAuthorClass).to.be(false);
2012-10-09 17:33:47 +02:00
// does the first div include an author class?
var hasAuthorClass = inner$("div").first().attr("class").indexOf("author") !== -1;
expect(hasAuthorClass).to.be(false);
done();
});
});
});