Tweak focus/blur functions for JQuery upgrade.

Fix incorrectly scoped selector.
This commit is contained in:
cahrens
2016-02-24 21:51:02 -05:00
committed by Brian Jacobel
parent 4ba07bf7a4
commit 665f983c99
5 changed files with 6 additions and 25 deletions

View File

@@ -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"
},

View File

@@ -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() {

View File

@@ -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.'

View File

@@ -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,

View File

@@ -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,