diff --git a/app/assets/javascripts/user-satisfaction-survey.js b/app/assets/javascripts/user-satisfaction-survey.js index 360792e1a..5c111c631 100644 --- a/app/assets/javascripts/user-satisfaction-survey.js +++ b/app/assets/javascripts/user-satisfaction-survey.js @@ -67,8 +67,8 @@ setSurveyUrl: function(href) { var $surveyLink = $('#take-survey'); var surveyUrl = $('#user-satisfaction-survey-container').data('survey-url'); - var surveyStarts = new Date("January 26, 2016").getTime(); - var surveyEnds = new Date("January 27, 2016 23:59:59").getTime(); + var surveyStarts = new Date("February 1, 2016").getTime(); + var surveyEnds = new Date("May 1, 2016 23:59:59").getTime(); if (userSatisfaction.currentDate() >= surveyStarts && userSatisfaction.currentDate() <= surveyEnds) { @@ -81,7 +81,7 @@ $surveyLink.attr('href', surveyUrl); }, - currentDate: function() { new Date().getTime(); } + currentDate: function() { return new Date().getTime(); } }; root.GOVUK.userSatisfaction = userSatisfaction; diff --git a/spec/javascripts/user-satisfaction-survey-spec.js b/spec/javascripts/user-satisfaction-survey-spec.js index 95c3a8655..ebe4e2e21 100644 --- a/spec/javascripts/user-satisfaction-survey-spec.js +++ b/spec/javascripts/user-satisfaction-survey-spec.js @@ -33,14 +33,18 @@ describe("User Satisfaction Survey", function () { expect($('#user-satisfaction-survey').attr('aria-hidden')).toBe('false'); }); - it("uses the temporary survey URL on 26/01/2016", function() { - spyOn(survey, 'currentDate').and.returnValue(new Date("January 26, 2016").getTime()); + it("actually returns a value from `currentDate`", function() { + expect(survey.currentDate()).not.toBe(undefined); + }); + + it("uses the temporary survey URL on 01/02/2016", function() { + spyOn(survey, 'currentDate').and.returnValue(new Date("February 1, 2016").getTime()); survey.showSurveyBar(); expect($('#take-survey').attr('href')).toMatch("https://www.surveymonkey.co.uk/r/2MRDLTW?"); }); - it("uses the temporary survey URL on 27/01/2016", function() { - spyOn(survey, 'currentDate').and.returnValue(new Date("January 27, 2016 12:15:30").getTime()); + it("uses the temporary survey URL on 01/05/2016", function() { + spyOn(survey, 'currentDate').and.returnValue(new Date("May 1, 2016 12:15:30").getTime()); survey.showSurveyBar(); expect($('#take-survey').attr('href')).toMatch("https://www.surveymonkey.co.uk/r/2MRDLTW?"); });