mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 08:56:17 -04:00
[test] Fix helper tests for IE
This commit is contained in:
parent
203a48b42d
commit
92be656113
1 changed files with 10 additions and 9 deletions
|
@ -101,16 +101,17 @@ describe("the test helper", function(){
|
||||||
// function to support tests, use a single way to represent whitespaces
|
// function to support tests, use a single way to represent whitespaces
|
||||||
var cleanText = function(text){
|
var cleanText = function(text){
|
||||||
return text
|
return text
|
||||||
.replace(/\n/gi, "\\\\n") // avoid \n to be replaced by \s on next line
|
// IE replaces line breaks with a whitespace, so we need to unify its behavior
|
||||||
.replace(/\s/gi, " ")
|
// for other browsers, to have all tests running for all browsers
|
||||||
.replace(/\\\\n/gi, "\n"); // move back \n to its original state
|
.replace(/\n/gi, " ")
|
||||||
|
.replace(/\s/gi, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
before(function(done){
|
before(function(done){
|
||||||
helper.newPad(function() {
|
helper.newPad(function() {
|
||||||
// create some lines to be used on the tests
|
// create some lines to be used on the tests
|
||||||
var $firstLine = helper.padInner$("div").first();
|
var $firstLine = helper.padInner$("div").first();
|
||||||
$firstLine.sendkeys("{selectall}some{enter}short{enter}lines{enter}to test{enter}");
|
$firstLine.sendkeys("{selectall}some{enter}short{enter}lines{enter}to test{enter}{enter}");
|
||||||
|
|
||||||
// wait for lines to be split
|
// wait for lines to be split
|
||||||
helper.waitFor(function(){
|
helper.waitFor(function(){
|
||||||
|
@ -135,7 +136,7 @@ describe("the test helper", function(){
|
||||||
helper.selectLines($startLine, $endLine, startOffset, endOffset);
|
helper.selectLines($startLine, $endLine, startOffset, endOffset);
|
||||||
|
|
||||||
var selection = inner$.document.getSelection();
|
var selection = inner$.document.getSelection();
|
||||||
expect(cleanText(selection.toString())).to.be("ort \nlines \nto t");
|
expect(cleanText(selection.toString())).to.be("ort lines to t");
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -153,7 +154,7 @@ describe("the test helper", function(){
|
||||||
helper.selectLines($startLine, $endLine, startOffset, endOffset);
|
helper.selectLines($startLine, $endLine, startOffset, endOffset);
|
||||||
|
|
||||||
var selection = inner$.document.getSelection();
|
var selection = inner$.document.getSelection();
|
||||||
expect(cleanText(selection.toString())).to.be("ort \nlines \nto test\n");
|
expect(cleanText(selection.toString())).to.be("ort lines to test");
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -171,7 +172,7 @@ describe("the test helper", function(){
|
||||||
helper.selectLines($startLine, $endLine, startOffset, endOffset);
|
helper.selectLines($startLine, $endLine, startOffset, endOffset);
|
||||||
|
|
||||||
var selection = inner$.document.getSelection();
|
var selection = inner$.document.getSelection();
|
||||||
expect(cleanText(selection.toString())).to.be("ort \nlines \n");
|
expect(cleanText(selection.toString())).to.be("ort lines ");
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -189,7 +190,7 @@ describe("the test helper", function(){
|
||||||
helper.selectLines($startLine, $endLine, startOffset, endOffset);
|
helper.selectLines($startLine, $endLine, startOffset, endOffset);
|
||||||
|
|
||||||
var selection = inner$.document.getSelection();
|
var selection = inner$.document.getSelection();
|
||||||
expect(cleanText(selection.toString())).to.be("ort \nlines \nto test");
|
expect(cleanText(selection.toString())).to.be("ort lines to test");
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -204,7 +205,7 @@ describe("the test helper", function(){
|
||||||
helper.selectLines($startLine, $endLine);
|
helper.selectLines($startLine, $endLine);
|
||||||
|
|
||||||
var selection = inner$.document.getSelection();
|
var selection = inner$.document.getSelection();
|
||||||
expect(cleanText(selection.toString())).to.be("short \nlines \nto test");
|
expect(cleanText(selection.toString())).to.be("short lines to test");
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue