mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 16:06:16 -04:00
Setted up an enviroment for frontend tests, first steps
This commit is contained in:
parent
3578e36616
commit
ba4ebbba3b
9 changed files with 6501 additions and 0 deletions
33
tests/frontend/specs/button_bold.js
Normal file
33
tests/frontend/specs/button_bold.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
describe("bold button", function(){
|
||||
//create a new pad before each test run
|
||||
beforeEach(function(cb){
|
||||
testHelper.newPad(cb);
|
||||
});
|
||||
|
||||
it("makes text bold", 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]);
|
||||
|
||||
//get the bold button and click it
|
||||
var $boldButton = testHelper.$getPadChrome().find(".buttonicon-bold");
|
||||
$boldButton.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 isBold = newFirstTextElement.find("b").length === 1;
|
||||
|
||||
//expect it to be bold
|
||||
expect(isBold).to.be(true);
|
||||
|
||||
//make sure the text hasn't changed
|
||||
expect(newFirstTextElement.text()).to.eql(firstTextElement.text());
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue