Commit 5effbf14 by Zia Fazal

scroll to top after saving

fixed broken bok choy tests
parent d2659326
...@@ -174,6 +174,12 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails ...@@ -174,6 +174,12 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails
this.view.$('.action-delete .delete').click(); this.view.$('.action-delete .delete').click();
}); });
it('should scroll to top after rendering if necessary', function () {
$.smoothScroll = jasmine.createSpy('jQuery.smoothScroll');
appendSetFixtures(this.view.render().el);
expect($.smoothScroll).toHaveBeenCalled();
});
}); });
describe('Signatory details', function(){ describe('Signatory details', function(){
......
...@@ -8,7 +8,8 @@ define([ // jshint ignore:line ...@@ -8,7 +8,8 @@ define([ // jshint ignore:line
'js/views/baseview', 'js/views/baseview',
'js/certificates/models/signatory', 'js/certificates/models/signatory',
'js/certificates/views/signatory_details', 'js/certificates/views/signatory_details',
'common/js/components/utils/view_utils' 'common/js/components/utils/view_utils',
'jquery.smoothScroll'
], ],
function($, _, str, gettext, BaseView, SignatoryModel, SignatoryDetailsView, ViewUtils) { function($, _, str, gettext, BaseView, SignatoryModel, SignatoryDetailsView, ViewUtils) {
'use strict'; 'use strict';
...@@ -72,7 +73,11 @@ function($, _, str, gettext, BaseView, SignatoryModel, SignatoryDetailsView, Vie ...@@ -72,7 +73,11 @@ function($, _, str, gettext, BaseView, SignatoryModel, SignatoryDetailsView, Vie
if(this.model.collection.length > 0 && window.certWebPreview) { if(this.model.collection.length > 0 && window.certWebPreview) {
window.certWebPreview.show(); window.certWebPreview.show();
} }
$.smoothScroll({
offset: 0,
easing: 'swing',
speed: 1000
});
return this; return this;
} }
}); });
......
...@@ -11,6 +11,7 @@ The methods in these classes are organized into several conceptual buckets: ...@@ -11,6 +11,7 @@ The methods in these classes are organized into several conceptual buckets:
import os import os
from bok_choy.promise import EmptyPromise from bok_choy.promise import EmptyPromise
from ...tests.helpers import disable_animations
from .course_page import CoursePage from .course_page import CoursePage
...@@ -284,6 +285,7 @@ class Certificate(object): ...@@ -284,6 +285,7 @@ class Certificate(object):
""" """
Create a new certificate. Create a new certificate.
""" """
disable_animations(self.page)
self.find_css('.action-primary').first.click() self.find_css('.action-primary').first.click()
self.page.wait_for_ajax() self.page.wait_for_ajax()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment