From 103e0f6747fa5fbf97df9596b86431a806b61aa4 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Mon, 26 Nov 2012 21:15:10 +0100 Subject: [PATCH] Add the basic structure of a timeslider test --- tests/frontend/specs/timeslider_revisions.js | 49 ++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/frontend/specs/timeslider_revisions.js diff --git a/tests/frontend/specs/timeslider_revisions.js b/tests/frontend/specs/timeslider_revisions.js new file mode 100644 index 000000000..b779935dc --- /dev/null +++ b/tests/frontend/specs/timeslider_revisions.js @@ -0,0 +1,49 @@ +describe("timeslider", function(){ + //create a new pad before each test run + beforeEach(function(cb){ + helper.newPad(cb); + this.timeout(6000); + }); + + it("loads adds a hundred revisions", function(done) { + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + + // make some changes to produce 100 revisions + var timePerRev = 900 + , revs = 150; + this.timeout(revs*timePerRev+10000); + for(var i=0; i < revs; i++) { + setTimeout(function() { + // type 'a' in the first text element + inner$("div").first().sendkeys('a'); + }, timePerRev*i); + } + + setTimeout(function() { + $('#iframe-container iframe').attr('src', $('#iframe-container iframe').attr('src')+'/timeslider'); + + var timeslider$ = $('#iframe-container iframe')[0].contentWindow.$; + + var $sliderHandle = timeslider$('#timeslider-slider ui-slider-handle'); + /* + //get the strikethrough button and click it + var $strikethroughButton = chrome$(".buttonicon-strikethrough"); + $strikethroughButton.click(); + + //ace creates a new dom element when you press a button, so just get the first text element again + var $newFirstTextElement = inner$("div").first(); + + // is there a element now? + var isstrikethrough = $newFirstTextElement.find("s").length === 1; + + //expect it to be strikethrough + expect(isstrikethrough).to.be(true); + + //make sure the text hasn't changed + expect($newFirstTextElement.text()).to.eql($firstTextElement.text()); + */ + done(); + }, revs*timePerRev); + }); +});