mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
tests: remove white space from getSelection(). This HACK fixes Firefox tests
This is a bit of a hack, because it appears that getSelection() behaviour is not consistent across browsers.
This commit is contained in:
parent
d05e02a681
commit
93ee98ea4b
1 changed files with 45 additions and 5 deletions
|
@ -136,7 +136,15 @@ 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 lines to t");
|
|
||||||
|
/*
|
||||||
|
* replace() is required here because Firefox keeps the line breaks.
|
||||||
|
*
|
||||||
|
* I'm not sure this is ideal behavior of getSelection() where the text
|
||||||
|
* is not consistent between browsers but that's the situation so that's
|
||||||
|
* how I'm covering it in this test.
|
||||||
|
*/
|
||||||
|
expect(cleanText(selection.toString().replace(/(\r\n|\n|\r)/gm,""))).to.be("ort lines to t");
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -154,7 +162,15 @@ 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 lines to test");
|
|
||||||
|
/*
|
||||||
|
* replace() is required here because Firefox keeps the line breaks.
|
||||||
|
*
|
||||||
|
* I'm not sure this is ideal behavior of getSelection() where the text
|
||||||
|
* is not consistent between browsers but that's the situation so that's
|
||||||
|
* how I'm covering it in this test.
|
||||||
|
*/
|
||||||
|
expect(cleanText(selection.toString().replace(/(\r\n|\n|\r)/gm,""))).to.be("ort lines to test");
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -172,7 +188,15 @@ 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 lines ");
|
|
||||||
|
/*
|
||||||
|
* replace() is required here because Firefox keeps the line breaks.
|
||||||
|
*
|
||||||
|
* I'm not sure this is ideal behavior of getSelection() where the text
|
||||||
|
* is not consistent between browsers but that's the situation so that's
|
||||||
|
* how I'm covering it in this test.
|
||||||
|
*/
|
||||||
|
expect(cleanText(selection.toString().replace(/(\r\n|\n|\r)/gm,""))).to.be("ort lines ");
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -190,7 +214,15 @@ 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 lines to test");
|
|
||||||
|
/*
|
||||||
|
* replace() is required here because Firefox keeps the line breaks.
|
||||||
|
*
|
||||||
|
* I'm not sure this is ideal behavior of getSelection() where the text
|
||||||
|
* is not consistent between browsers but that's the situation so that's
|
||||||
|
* how I'm covering it in this test.
|
||||||
|
*/
|
||||||
|
expect(cleanText(selection.toString().replace(/(\r\n|\n|\r)/gm,""))).to.be("ort lines to test");
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -205,7 +237,15 @@ 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 lines to test");
|
|
||||||
|
/*
|
||||||
|
* replace() is required here because Firefox keeps the line breaks.
|
||||||
|
*
|
||||||
|
* I'm not sure this is ideal behavior of getSelection() where the text
|
||||||
|
* is not consistent between browsers but that's the situation so that's
|
||||||
|
* how I'm covering it in this test.
|
||||||
|
*/
|
||||||
|
expect(cleanText(selection.toString().replace(/(\r\n|\n|\r)/gm,""))).to.be("short lines to test");
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue