From 665f983c99ce9f8910393e6b9bdfbc49bf6bd151 Mon Sep 17 00:00:00 2001 From: cahrens Date: Wed, 24 Feb 2016 21:51:02 -0500 Subject: [PATCH] Tweak focus/blur functions for JQuery upgrade. Fix incorrectly scoped selector. --- cms/static/js/views/course_info_update.js | 4 ++-- cms/static/js/views/experiment_group_edit.js | 4 ++-- .../coffee/spec/feedback_form_spec.coffee | 3 --- lms/static/js/edxnotes/views/shim.js | 17 ----------------- .../js/spec/student_account/login_spec.js | 3 ++- 5 files changed, 6 insertions(+), 25 deletions(-) diff --git a/cms/static/js/views/course_info_update.js b/cms/static/js/views/course_info_update.js index 0a3c0277c0..938579b825 100644 --- a/cms/static/js/views/course_info_update.js +++ b/cms/static/js/views/course_info_update.js @@ -10,8 +10,8 @@ define(["js/views/validation", "codemirror", "js/models/course_update", // collection is CourseUpdateCollection events: { "click .new-update-button" : "onNew", - "click #course-update-view .save-button" : "onSave", - "click #course-update-view .cancel-button" : "onCancel", + "click .save-button" : "onSave", + "click .cancel-button" : "onCancel", "click .post-actions > .edit-button" : "onEdit", "click .post-actions > .delete-button" : "onDelete" }, diff --git a/cms/static/js/views/experiment_group_edit.js b/cms/static/js/views/experiment_group_edit.js index c513b1a4d5..6e87553023 100644 --- a/cms/static/js/views/experiment_group_edit.js +++ b/cms/static/js/views/experiment_group_edit.js @@ -12,8 +12,8 @@ function(BaseView, _, str, gettext, groupEditTemplate) { events: { 'click .action-close': 'removeGroup', 'change .group-name': 'changeName', - 'focus .groups-fields input': 'onFocus', - 'blur .groups-fields input': 'onBlur' + 'focus .group-name': 'onFocus', + 'blur .group-name': 'onBlur' }, className: function() { diff --git a/lms/static/coffee/spec/feedback_form_spec.coffee b/lms/static/coffee/spec/feedback_form_spec.coffee index f4bc900bf4..c821ee5153 100644 --- a/lms/static/coffee/spec/feedback_form_spec.coffee +++ b/lms/static/coffee/spec/feedback_form_spec.coffee @@ -8,9 +8,6 @@ describe 'FeedbackForm', -> spyOn($, 'postWithPrefix').and.callFake (url, data, callback, format) -> callback() - it 'binds to the #feedback_button', -> - expect($('#feedback_button')).toHandle 'click' - it 'post data to /send_feedback on click', -> $('#feedback_subject').val 'Awesome!' $('#feedback_message').val 'This site is really good.' diff --git a/lms/static/js/edxnotes/views/shim.js b/lms/static/js/edxnotes/views/shim.js index 7595cef755..7d965dd2d7 100644 --- a/lms/static/js/edxnotes/views/shim.js +++ b/lms/static/js/edxnotes/views/shim.js @@ -5,23 +5,6 @@ define([ ], function ($, _, Annotator, Utils) { var _t = Annotator._t; - /** - * We currently run JQuery 1.7.2 in Jasmine tests and LMS. - * AnnotatorJS 1.2.9. uses two calls to addBack (in the two functions - * 'isAnnotator' and 'onHighlightMouseover') which was only defined in - * JQuery 1.8.0. In LMS, it works without throwing an error because - * JQuery.UI 1.10.0 adds support to jQuery<1.8 by augmenting '$.fn' with - * that missing function. It is not the case for all Jasmine unit tests, - * so we add it here if necessary. - **/ - if (!$.fn.addBack) { - $.fn.addBack = function (selector) { - return this.add( - selector === null ? this.prevObject : this.prevObject.filter(selector) - ); - }; - } - /** * The original _setupDynamicStyle uses a very expensive call to * Util.maxZIndex(...) that sets the z-index of .annotator-adder, diff --git a/lms/static/js/spec/student_account/login_spec.js b/lms/static/js/spec/student_account/login_spec.js index cd835a1230..ea4125d538 100644 --- a/lms/static/js/spec/student_account/login_spec.js +++ b/lms/static/js/spec/student_account/login_spec.js @@ -3,13 +3,14 @@ define([ 'jquery', 'underscore', + 'sinon', 'common/js/spec_helpers/template_helpers', 'common/js/spec_helpers/ajax_helpers', 'js/student_account/models/LoginModel', 'js/student_account/views/LoginView', 'js/student_account/models/PasswordResetModel' ], - function($, _, TemplateHelpers, AjaxHelpers, LoginModel, LoginView, PasswordResetModel) { + function($, _, sinon, TemplateHelpers, AjaxHelpers, LoginModel, LoginView, PasswordResetModel) { describe('edx.student.account.LoginView', function() { var model = null,