Merge branch 'develop' of github.com:ether/etherpad-lite into sanitizer

pull/2348/head
John McLear 2014-11-28 00:02:16 +00:00
commit d974e881a8
13 changed files with 43 additions and 22 deletions

View File

@ -35,7 +35,7 @@ var isNodeText = Ace2Common.isNodeText,
htmlPrettyEscape = Ace2Common.htmlPrettyEscape,
noop = Ace2Common.noop;
var hooks = require('./pluginfw/hooks');
var browser = require('./browser').browser;
function Ace2Inner(){
@ -51,7 +51,6 @@ function Ace2Inner(){
var SkipList = require('./skiplist');
var undoModule = require('./undomodule').undoModule;
var AttributeManager = require('./AttributeManager');
var browser = require('./browser');
var DEBUG = false; //$$ build script replaces the string "var DEBUG=true;//$$" with "var DEBUG=false;"
// changed to false

View File

@ -3,3 +3,7 @@
## Frontend
To run the tests, point your browser to `<yourdomainhere>/tests/frontend`
## Backend
To run the tests, run ``bin/backendTests.sh``

View File

@ -10,7 +10,7 @@
<div id="iframe-container"></div>
<script src="/static/js/jquery.js"></script>
<script src="/static/js/jquery_browser.js"></script>
<script src="/static/js/browser.js"></script>
<script src="lib/underscore.js"></script>
<script src="lib/mocha.js"></script>
@ -22,6 +22,5 @@
<script src="helper.js"></script>
<script src="specs_list.js"></script>
<script src="runner.js"></script>
</html>

View File

@ -2,8 +2,9 @@
(function($) {
$.fn.purgeFrame = function() {
var deferred;
var browser = bowser;
if ($.browser.msie && parseFloat($.browser.version, 10) < 9) {
if (browser.msie && parseFloat(browser.version, 10) < 9) {
deferred = purge(this);
} else {
this.remove();
@ -36,4 +37,4 @@
return deferred.promise();
}
})(jQuery);
})(jQuery);

View File

@ -162,7 +162,8 @@ $(function(){
}
//allow cross iframe access
if ((!$.browser.msie) && (!($.browser.mozilla && $.browser.version.indexOf("1.8.") == 0))) {
var browser = bowser;
if ((!browser.msie) && (!(browser.mozilla && browser.version.indexOf("1.8.") == 0))) {
document.domain = document.domain; // for comet
}

View File

@ -43,7 +43,9 @@ describe("bold button", function(){
//select this text element
$firstTextElement.sendkeys('{selectall}');
if(inner$.browser.mozilla){ // if it's a mozilla browser
console.log(inner$(window)[0].bowser);
if(inner$(window)[0].bowser.firefox){ // if it's a mozilla browser
var evtType = "keypress";
}else{
var evtType = "keydown";

View File

@ -1,11 +1,19 @@
describe("As the caret is moved is the UI properly updated?", function(){
var padName;
var numberOfRows = 50;
/*
it("creates a pad", function(done) {
//create a new pad before each test run
beforeEach(function(cb){
helper.newPad(cb);
this.timeout(60000);
});
xit("creates a pad", function(done) {
padName = helper.newPad(done);
this.timeout(60000);
});
*/
/* Tests to do
* Keystroke up (38), down (40), left (37), right (39) with and without special keys IE control / shift
@ -20,10 +28,12 @@ describe("As the caret is moved is the UI properly updated?", function(){
* How do we keep the authors focus on a line if the lines above the author are modified? We should only redraw the user to a location if they are typing and make sure shift and arrow keys aren't redrawing the UI else highlight - copy/paste would get broken
* How can we simulate an edit event in the test framework?
*/
// THIS DOESNT WORK AS IT DOESNT MOVE THE CURSOR!
/*
// THIS DOESNT WORK IN CHROME AS IT DOESNT MOVE THE CURSOR!
it("down arrow", function(done){
var inner$ = helper.padInner$;
var chrome$ = helper.padChrome$;
var $newFirstTextElement = inner$("div").first();
$newFirstTextElement.focus();
keyEvent(inner$, 37, false, false); // arrow down
@ -31,9 +41,10 @@ describe("As the caret is moved is the UI properly updated?", function(){
done();
});
/*
it("Creates N lines", function(done){
var inner$ = helper.padInner$;
console.log(inner$);
var chrome$ = helper.padChrome$;
var $newFirstTextElement = inner$("div").first();
@ -224,7 +235,6 @@ describe("As the caret is moved is the UI properly updated?", function(){
});
var i = 0;
while(i < numberOfRows){ // press down arrow
console.log("dwn");
keyEvent(inner$, 40, false, false);
i++;
}
@ -287,7 +297,7 @@ function prepareDocument(n, target){ // generates a random document with random
}
function keyEvent(target, charCode, ctrl, shift){ // sends a charCode to the window
if(target.browser.mozilla){ // if it's a mozilla browser
if(inner$(window)[0].bowser.firefox){ // if it's a mozilla browser
var evtType = "keypress";
}else{
var evtType = "keydown";

View File

@ -15,7 +15,7 @@ describe("indentation button", function(){
//select this text element
$firstTextElement.sendkeys('{selectall}');
if(inner$.browser.mozilla){ // if it's a mozilla browser
if(inner$(window)[0].bowser.firefox){ // if it's a mozilla browser
var evtType = "keypress";
}else{
var evtType = "keydown";

View File

@ -44,7 +44,7 @@ describe("italic some text", function(){
//select this text element
$firstTextElement.sendkeys('{selectall}');
if(inner$.browser.mozilla){ // if it's a mozilla browser
if(inner$(window)[0].bowser.firefox){ // if it's a mozilla browser
var evtType = "keypress";
}else{
var evtType = "keydown";

View File

@ -47,7 +47,7 @@ describe("undo button then redo button", function(){
var modifiedValue = $firstTextElement.text(); // get the modified value
expect(modifiedValue).not.to.be(originalValue); // expect the value to change
if(inner$.browser.mozilla){ // if it's a mozilla browser
if(inner$(window)[0].bowser.firefox){ // if it's a mozilla browser
var evtType = "keypress";
}else{
var evtType = "keydown";

View File

@ -19,7 +19,7 @@ describe('Responsiveness of Editor', function() {
helper.newPad(cb);
this.timeout(6000);
});
it('Fast response to keypress in pad with large amount of contents', function(done) {
xit('Fast response to keypress in pad with large amount of contents', function(done) {
var inner$ = helper.padInner$;
var chrome$ = helper.padChrome$;
var chars = '0000000000'; // row of placeholder chars

View File

@ -4,7 +4,8 @@ describe("timeslider", function(){
helper.newPad(cb);
this.timeout(6000);
});
it("loads adds a hundred revisions", function(done) {
it("loads adds a hundred revisions", function(done) { // passes
var inner$ = helper.padInner$;
var chrome$ = helper.padChrome$;
@ -56,7 +57,10 @@ describe("timeslider", function(){
}, 6000);
}, revs*timePerRev);
});
it("changes the url when clicking on the timeslider", function(done) {
// Disabled as jquery trigger no longer works properly
xit("changes the url when clicking on the timeslider", function(done) {
var inner$ = helper.padInner$;
var chrome$ = helper.padChrome$;
@ -80,7 +84,6 @@ describe("timeslider", function(){
var $sliderBar = timeslider$('#ui-slider-bar');
var latestContents = timeslider$('#padcontent').text();
var oldUrl = $('#iframe-container iframe')[0].contentWindow.location.hash;
// Click somewhere on the timeslider
@ -111,6 +114,7 @@ describe("timeslider", function(){
var oldLength = inner$('body').text().length + newLines / 2;
expect( oldLength ).to.not.eql( 0 );
inner$("div").first().sendkeys('a');
var timeslider$;
// wait for our additional revision to be added
helper.waitFor(function(){
@ -140,6 +144,7 @@ describe("timeslider", function(){
});
});
});
it("checks the export url", function(done) {
var inner$ = helper.padInner$;
var chrome$ = helper.padChrome$;

View File

@ -44,7 +44,7 @@ describe("undo button", function(){
var modifiedValue = $firstTextElement.text(); // get the modified value
expect(modifiedValue).not.to.be(originalValue); // expect the value to change
if(inner$.browser.mozilla){ // if it's a mozilla browser
if(inner$(window)[0].bowser.firefox){ // if it's a mozilla browser
var evtType = "keypress";
}else{
var evtType = "keydown";