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
c8fbadb2
Commit
c8fbadb2
authored
Nov 13, 2015
by
Peter Fogg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show a message when logging in with no internet connection.
ECOM-2890
parent
b05c4af4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
lms/static/js/spec/student_account/login_spec.js
+15
-0
lms/static/js/student_account/views/LoginView.js
+8
-2
No files found.
lms/static/js/spec/student_account/login_spec.js
View file @
c8fbadb2
...
...
@@ -265,6 +265,21 @@
expect
(
view
.
$errors
).
toHaveClass
(
'hidden'
);
expect
(
authComplete
).
toBe
(
true
);
});
it
(
'displays an error if there is no internet connection'
,
function
()
{
createLoginView
(
this
);
// Submit the form, with successful validation
submitForm
(
true
);
// Simulate an error from the LMS servers
AjaxHelpers
.
respondWithError
(
requests
,
0
);
// 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.'
);
});
});
});
}).
call
(
this
,
define
||
RequireJS
.
define
);
lms/static/js/student_account/views/LoginView.js
View file @
c8fbadb2
...
...
@@ -3,9 +3,10 @@
define
([
'jquery'
,
'underscore'
,
'gettext'
,
'js/student_account/views/FormView'
],
function
(
$
,
_
,
FormView
)
{
function
(
$
,
_
,
gettext
,
FormView
)
{
return
FormView
.
extend
({
el
:
'#login-form'
,
...
...
@@ -102,7 +103,12 @@
},
saveError
:
function
(
error
)
{
this
.
errors
=
[
'<li>'
+
error
.
responseText
+
'</li>'
];
if
(
error
.
status
===
0
)
{
this
.
errors
=
[
'<li>'
+
gettext
(
'Please check your internet connection and try again.'
)
+
'</li>'
];
}
else
{
this
.
errors
=
[
'<li>'
+
error
.
responseText
+
'</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