summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohn McLear <john@mclear.co.uk>2013-02-06 15:43:54 -0800
committerJohn McLear <john@mclear.co.uk>2013-02-06 15:43:54 -0800
commit7bf8dad6f993b6656e2900f11a75d5acfa105093 (patch)
tree1d08a5e6702e1b339155426393d7beea6f10c295 /tests
parent488ebc20a4a3b20e30ad666407c28fda1ebf09cb (diff)
parente4032f4d7438403c89fe7147b9fc7daca5f80d88 (diff)
downloadetherpad-lite-7bf8dad6f993b6656e2900f11a75d5acfa105093.zip
Merge pull request #1460 from ether/timeslider-labels
timeslider label tests, fix and fix firefox page up down
Diffstat (limited to 'tests')
-rw-r--r--tests/frontend/specs/timeslider_labels.js64
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/frontend/specs/timeslider_labels.js b/tests/frontend/specs/timeslider_labels.js
new file mode 100644
index 00000000..d39685ef
--- /dev/null
+++ b/tests/frontend/specs/timeslider_labels.js
@@ -0,0 +1,64 @@
+describe("timeslider", function(){
+ //create a new pad before each test run
+ beforeEach(function(cb){
+ helper.newPad(cb);
+ this.timeout(60000);
+ });
+
+ it("Shows a date and time in the timeslider and make sure it doesn't include NaN", function(done) {
+ var inner$ = helper.padInner$;
+ var chrome$ = helper.padChrome$;
+
+ // make some changes to produce 100 revisions
+ var revs = 10;
+ this.timeout(60000);
+ for(var i=0; i < revs; i++) {
+ setTimeout(function() {
+ // enter 'a' in the first text element
+ inner$("div").first().sendkeys('a');
+ }, 200);
+ }
+
+ 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();
+
+ // Expect the date and time to be shown
+
+ // Click somewhere on the timeslider
+ var e = new jQuery.Event('mousedown');
+ e.clientX = e.pageX = 150;
+ e.clientY = e.pageY = 45;
+ $sliderBar.trigger(e);
+
+ e = new jQuery.Event('mousedown');
+ e.clientX = e.pageX = 150;
+ e.clientY = e.pageY = 40;
+ $sliderBar.trigger(e);
+
+ e = new jQuery.Event('mousedown');
+ e.clientX = e.pageX = 150;
+ e.clientY = e.pageY = 50;
+ $sliderBar.trigger(e);
+
+ $sliderBar.trigger('mouseup')
+
+ setTimeout(function() {
+ //make sure the text has changed
+ expect( timeslider$('#timer').text() ).not.to.eql( "" );
+ expect( timeslider$('#revision_date').text() ).not.to.eql( "" );
+ expect( timeslider$('#revision_label').text() ).not.to.eql( "" );
+ var includesNaN = timeslider$('#revision_label').text().indexOf("NaN"); // NaN is bad. Naan ist gut
+ expect( includesNaN ).to.eql( -1 ); // not quite so tasty, I like curry.
+ done();
+ }, 400);
+ }, 2000);
+ }, 2000);
+ });
+});