Skip to content

Commit

Permalink
fix: [AXM-361] fix codestyle after review
Browse files Browse the repository at this point in the history
  • Loading branch information
NiedielnitsevIvan committed Jun 21, 2024
1 parent 0202935 commit ace7a39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lms/static/js/courseware/bridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function markProblemCompleted(message) {

data.split("&").forEach(function (item) {
const [inputId, answer] = item.split('=', 2);
problemContainer.find('input[id$="' + answer + '"], input[id$="' + inputId + '"]').each(function () {
problemContainer.find(`input[id$="${answer}"], input[id$="${inputId}"]`).each(function () {
this.disabled = true;
if (this.type === "checkbox" || this.type === "radio") {
this.checked = true;
Expand All @@ -56,14 +56,14 @@ function markProblemCompleted(message) {
}

/**
* Overrides the default $.ajax function to intercept the requests to the "problem_check" endpoint
* and send the data to the native mobile apps.
* Overrides the default $.ajax function to intercept the requests to the "handler/xmodule_handler/problem_check"
* endpoint and send the data to the native mobile apps.
*
* @param {Object} options The data object for the ajax request
*/
const originalAjax = $.ajax;
$.ajax = function (options) {
if (options.url && options.url.endsWith("problem_check")) {
if (options.url && options.url.endsWith("handler/xmodule_handler/problem_check")) {
sendMessageToIOS(JSON.stringify(options));
sendMessageToAndroid(JSON.stringify(options));
}
Expand Down
4 changes: 2 additions & 2 deletions lms/static/js/spec/courseware/bridge_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('JS bridge for communication between native mobile apps and the xblock'

it('should intercept the request to problem_check and send data to the native apps', function() {
const ajaxOptions = {
url: 'http://example.com/problem_check',
url: 'http://example.com/handler/xmodule_handler/problem_check',
data: {answer: 'test'}
};

Expand All @@ -82,7 +82,7 @@ describe('JS bridge for communication between native mobile apps and the xblock'

it('should call the original $.ajax function', function() {
const ajaxOptions = {
url: 'http://example.com/problem_check',
url: 'http://example.com/handler/xmodule_handler/problem_check',
data: {answer: 'test'}
};

Expand Down

0 comments on commit ace7a39

Please sign in to comment.