Linting fixes to improve quality report

This commit is contained in:
Kshitij Sobti
2018-07-16 13:39:38 +05:30
parent bf6af13ed1
commit fcff921fdb
16 changed files with 32 additions and 35 deletions

View File

@@ -145,10 +145,10 @@ function($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCol
'check',
component_locator,
[
{ mode: 'youtube', video: '12345678901', type: 'youtube' },
{ mode: 'html5', video: 'video', type: 'mp4' },
{ mode: 'html5', video: 'video', type: 'webm' },
{ mode: 'edx_video_id', type: 'edx_video_id', video: 'basic tab video id' }
{mode: 'youtube', video: '12345678901', type: 'youtube'},
{mode: 'html5', video: 'video', type: 'mp4'},
{mode: 'html5', video: 'video', type: 'webm'},
{mode: 'edx_video_id', type: 'edx_video_id', video: 'basic tab video id'}
]
);
}).always(done);

View File

@@ -116,7 +116,7 @@ function($, _, Backbone, TranscriptUtils, FileUploader) {
expect(view.$form.ajaxSubmit).toHaveBeenCalled();
expect(view.$form.ajaxSubmit).toHaveBeenCalledWith(jasmine.objectContaining({
data: {'edx_video_id': videoId}
data: {edx_video_id: videoId}
}));
});
});

View File

@@ -184,7 +184,6 @@ function($, _, Backbone, Utils, MessageManager, FileUploader, sinon) {
};
it('Invoke without extraParamas', function(done) {
spyOn(Backbone, 'trigger');
sinonXhr.respondWith([
@@ -213,7 +212,6 @@ function($, _, Backbone, Utils, MessageManager, FileUploader, sinon) {
});
it('Invoke with extraParamas', function(done) {
spyOn(Backbone, 'trigger');
sinonXhr.respondWith([

View File

@@ -216,7 +216,8 @@ function($, _, Backbone, AjaxHelpers, Utils, Editor, VideoList, MetadataModel, A
it('Initialize', function(done) {
var view = createVideoListView(this.mockServer), callArgs;
var view = createVideoListView(this.mockServer),
callArgs;
waitsForResponse(this.mockServer)
.then(function() {
expect(abstractEditor.initialize).toHaveBeenCalled();

View File

@@ -76,7 +76,6 @@ define(['jquery', 'underscore', 'gettext', 'js/views/modals/base_modal', 'jquery
},
upload: function(e) {
var uploadAjaxData = _.extend({}, this.uploadData);
// don't show the generic error notification; we're in a modal,
// and we're better off modifying it instead.

View File

@@ -58,7 +58,7 @@ function($, Backbone, _, TranscriptUtils) {
*/
upload: function() {
var data = {
'edx_video_id': TranscriptUtils.Storage.get('edx_video_id') || ''
edx_video_id: TranscriptUtils.Storage.get('edx_video_id') || ''
};
if (!this.file) {

View File

@@ -149,7 +149,7 @@ EntitlementForm.propTypes = {
EntitlementForm.defaultProps = {
entitlement: {
uuid:'',
uuid: '',
courseUuid: '',
created: '',
modified: '',
@@ -158,7 +158,7 @@ EntitlementForm.defaultProps = {
orderNumber: '',
supportDetails: [],
user: '',
}
},
};
export default EntitlementForm;

View File

@@ -1,5 +1,5 @@
import { formActions, entitlementActions } from '../constants/actionTypes';
import { formTypes } from '../constants/formTypes'
import { formTypes } from '../constants/formTypes';
const clearFormState = {
formType: '',
isOpen: false,

View File

@@ -83,9 +83,9 @@ function LoggedInUser({ userInformation, setErrorState, zendeskApiHost, submitFo
{/* TODO file uploading will be done after initial release */}
{/* <FileUpload */}
{/* setErrorState={setErrorState} */}
{/* zendeskApiHost={zendeskApiHost} */}
{/* accessToken={accessToken} */}
{/* setErrorState={setErrorState} */}
{/* zendeskApiHost={zendeskApiHost} */}
{/* accessToken={accessToken} */}
{/* /> */}
<div className="row">

View File

@@ -51,7 +51,7 @@ class RenderForm extends React.Component {
data.requester = {
email: $userInfo.data('email'),
name: $userInfo.data('username')
name: $userInfo.data('username'),
};
course = $course.find(':selected').val();

View File

@@ -60,7 +60,7 @@
this.clearSearch();
},
showErrorMessage: function (error) {
showErrorMessage: function(error) {
this.$message.text(gettext(error || 'There was an error, try searching again.'));
}

View File

@@ -52,7 +52,7 @@ describe('Program Progress View', () => {
model: programModel,
courseModel: courseData,
certificateCollection,
programRecordUrl: '/foo/bar'
programRecordUrl: '/foo/bar',
});
beforeEach(() => {

View File

@@ -101,7 +101,7 @@ class UnenrollView extends Backbone.View {
this.mainPageSelector = '#dashboard-main';
this.triggerSelector = '.action-unenroll';
$(this.triggerSelector).each(function attachTriggerHandler(index, element) {
$(this.triggerSelector).each((index, element) => {
$(element).on('click', view.handleTrigger.bind($(element)));
});

View File

@@ -4,18 +4,18 @@ function playVideo(src) {
document.querySelector('#program_video iframe').style = 'display:block;';
document.querySelector('#program_video iframe').src = src;
}
$(".instructor-image, .instructor-label").leanModal({closeButton: ".modal_close", top: '10%'});
$('.instructor-image, .instructor-label').leanModal({closeButton: '.modal_close', top: '10%'});
// Create MutationObserver which prevents the body of
// the page from scrolling when a modal window is displayed
var observer = new MutationObserver(function(mutations, obv){
mutations.forEach(function(mutation) {
if ($(mutation.target).css('display') === 'block') {
$('body').css('overflow','hidden');
} else {
$('body').css('overflow', 'auto');
}
});
var observer = new MutationObserver(function(mutations, obv) {
mutations.forEach(function(mutation) {
if ($(mutation.target).css('display') === 'block') {
$('body').css('overflow', 'hidden');
} else {
$('body').css('overflow', 'auto');
}
});
});
$('.modal').each(function(index, element) {
observer.observe(element, {attributes: true, attributeFilter: ['style']});
});
$('.modal').each(function(index, element){
observer.observe(element, {attributes: true, attributeFilter:['style']});
});

View File

@@ -156,7 +156,7 @@ define([
var requests = AjaxHelpers.requests(this);
$('.discovery-input').val('asdfasdf');
$('.discovery-submit').trigger('click');
AjaxHelpers.respondWithError(requests, 404, {'error': 'some-search-error'});
AjaxHelpers.respondWithError(requests, 404, {error: 'some-search-error'});
expect($('#discovery-message')).not.toBeEmpty();
expect($('#discovery-message')).toContainHtml('some-search-error');
expect($('.courses-listing')).toBeEmpty();

View File

@@ -45,11 +45,10 @@
// If we successfully enrolled, redirect the user
// to the next page (usually the student dashboard or payment flow)
if (response.redirect_destination) {
this.redirect(response.redirect_destination)
this.redirect(response.redirect_destination);
} else if (redirectUrl) {
this.redirect(redirectUrl);
}
});
},