Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
df3c3874
Commit
df3c3874
authored
Nov 05, 2015
by
aamir-khan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ECOM-1447: Added the custom message if there is an internal server error on ajax call.
parent
236d251e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
5 deletions
+24
-5
lms/static/js/spec/student_account/login_spec.js
+19
-1
lms/static/js/student_account/views/LoginView.js
+5
-4
No files found.
lms/static/js/spec/student_account/login_spec.js
View file @
df3c3874
...
...
@@ -278,7 +278,25 @@
// Expect that an error is displayed and that auth complete is not triggered
expect
(
view
.
$errors
).
not
.
toHaveClass
(
'hidden'
);
expect
(
authComplete
).
toBe
(
false
);
expect
(
view
.
$errors
.
text
()).
toContain
(
'Please check your internet connection and try again.'
);
expect
(
view
.
$errors
.
text
()).
toContain
(
'An error has occurred. Check your Internet connection and try again.'
);
});
it
(
'displays an error if there is a server error'
,
function
()
{
createLoginView
(
this
);
// Submit the form, with successful validation
submitForm
(
true
);
// Simulate an error from the LMS servers
AjaxHelpers
.
respondWithError
(
requests
,
500
);
// Expect that an error is displayed and that auth complete is not triggered
expect
(
view
.
$errors
).
not
.
toHaveClass
(
'hidden'
);
expect
(
authComplete
).
toBe
(
false
);
expect
(
view
.
$errors
.
text
()).
toContain
(
'An error has occurred. Try refreshing the page, or check your Internet connection.'
);
});
});
});
...
...
lms/static/js/student_account/views/LoginView.js
View file @
df3c3874
...
...
@@ -103,12 +103,13 @@
},
saveError
:
function
(
error
)
{
var
msg
=
error
.
responseText
;
if
(
error
.
status
===
0
)
{
this
.
errors
=
[
'<li>'
+
gettext
(
'Please check your internet connection and try again.'
)
+
'</li>'
];
}
else
{
this
.
errors
=
[
'<li>'
+
error
.
responseText
+
'</li>'
];
msg
=
gettext
(
'An error has occurred. Check your Internet connection and try again.'
);
}
else
if
(
error
.
status
===
500
){
msg
=
gettext
(
'An error has occurred. Try refreshing the page, or check your Internet connection.'
);
}
this
.
errors
=
[
'<li>'
+
msg
+
'</li>'
];
this
.
setErrors
();
this
.
element
.
hide
(
this
.
$resetSuccess
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment