diff options
author | mluto <m@luto.at> | 2013-01-28 21:12:50 +0100 |
---|---|---|
committer | mluto <m@luto.at> | 2013-01-28 21:12:50 +0100 |
commit | 3002807741175a7b4f508346bcac9fcb7cf46fc2 (patch) | |
tree | 6585ec1a3256861f8a1209f52eafcba63f70b9c9 /tests/frontend | |
parent | f974136d0cf4e5555a81ebd655095efaa10b4643 (diff) | |
download | etherpad-lite-3002807741175a7b4f508346bcac9fcb7cf46fc2.zip |
Added tests for revision-jumping
Diffstat (limited to 'tests/frontend')
-rw-r--r-- | tests/frontend/specs/timeslider_revisions.js | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/frontend/specs/timeslider_revisions.js b/tests/frontend/specs/timeslider_revisions.js index af59051a..de8ca52f 100644 --- a/tests/frontend/specs/timeslider_revisions.js +++ b/tests/frontend/specs/timeslider_revisions.js @@ -57,4 +57,68 @@ describe("timeslider", function(){ }, 6000); }, revs*timePerRev); }); + + it("changes the url when clicking on the timeslider", function(done) { + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + + // make some changes to produce 7 revisions + var timePerRev = 900 + , revs = 7; + this.timeout(revs*timePerRev+10000); + for(var i=0; i < revs; i++) { + setTimeout(function() { + // enter 'a' in the first text element + inner$("div").first().sendkeys('a'); + }, timePerRev*i); + } + + setTimeout(function() { + // go to timeslider + $('#iframe-container iframe').attr('src', $('#iframe-container iframe').attr('src')+'/timeslider'); + + setTimeout(function() { + var timeslider$ = $('#iframe-container iframe')[0].contentWindow.$; + 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 + var e = new jQuery.Event('mousedown'); + e.clientX = e.pageX = 150; + e.clientY = e.pageY = 60; + $sliderBar.trigger(e); + + helper.waitFor(function(){ + return $('#iframe-container iframe')[0].contentWindow.location.hash != oldUrl; + }, 6000).always(function(){ + expect( $('#iframe-container iframe')[0].contentWindow.location.hash ).not.to.eql( oldUrl ); + done(); + }); + }, 6000); + }, revs*timePerRev); + }); + + it("jumps to a revision given in the url", function(done) { + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + this.timeout(11000); + inner$("div").first().sendkeys('a'); + + setTimeout(function() { + // go to timeslider + $('#iframe-container iframe').attr('src', $('#iframe-container iframe').attr('src')+'/timeslider#0'); + var timeslider$; + + helper.waitFor(function(){ + timeslider$ = $('#iframe-container iframe')[0].contentWindow.$; + return timeslider$ && timeslider$('#padcontent').text().length == 230; + }, 6000).always(function(){ + expect( timeslider$('#padcontent').text().length ).to.eql( 230 ); + done(); + }); + }, 2500); + }); }); |