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
ca0d048b
Commit
ca0d048b
authored
Oct 27, 2014
by
Renzo Lucioni
Committed by
AlasdairSwan
Oct 27, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix failing JS tests
parent
0b9ed031
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
10 deletions
+39
-10
lms/static/js/spec/main.js
+16
-3
lms/static/js/spec/student_account/password_reset_spec.js
+23
-7
No files found.
lms/static/js/spec/main.js
View file @
ca0d048b
...
@@ -263,13 +263,20 @@
...
@@ -263,13 +263,20 @@
// Student account registration/login
// Student account registration/login
// Loaded explicitly until these are converted to RequireJS
// Loaded explicitly until these are converted to RequireJS
'js/student_account/views/FormView'
:
{
exports
:
'js/student_account/views/FormView'
,
deps
:
[
'jquery'
,
'underscore'
,
'backbone'
,
'gettext'
]
},
'js/student_account/models/LoginModel'
:
{
'js/student_account/models/LoginModel'
:
{
exports
:
'js/student_account/models/LoginModel'
,
exports
:
'js/student_account/models/LoginModel'
,
deps
:
[
'jquery'
,
'underscore'
,
'backbone'
,
'gettext'
,
'jquery.cookie'
]
deps
:
[
'jquery'
,
'underscore'
,
'backbone'
,
'gettext'
,
'jquery.cookie'
]
},
},
'js/student_account/views/LoginView'
:
{
'js/student_account/views/LoginView'
:
{
exports
:
'js/student_account/views/LoginView'
,
exports
:
'js/student_account/views/LoginView'
,
deps
:
[
'js/student_account/models/LoginModel'
]
deps
:
[
'js/student_account/models/LoginModel'
,
'js/student_account/views/FormView'
]
},
},
'js/student_account/models/PasswordResetModel'
:
{
'js/student_account/models/PasswordResetModel'
:
{
exports
:
'js/student_account/models/PasswordResetModel'
,
exports
:
'js/student_account/models/PasswordResetModel'
,
...
@@ -277,7 +284,10 @@
...
@@ -277,7 +284,10 @@
},
},
'js/student_account/views/PasswordResetView'
:
{
'js/student_account/views/PasswordResetView'
:
{
exports
:
'js/student_account/views/PasswordResetView'
,
exports
:
'js/student_account/views/PasswordResetView'
,
deps
:
[
'js/student_account/models/PasswordResetModel'
]
deps
:
[
'js/student_account/models/PasswordResetModel'
,
'js/student_account/views/FormView'
]
},
},
'js/student_account/models/RegisterModel'
:
{
'js/student_account/models/RegisterModel'
:
{
exports
:
'js/student_account/models/RegisterModel'
,
exports
:
'js/student_account/models/RegisterModel'
,
...
@@ -285,7 +295,10 @@
...
@@ -285,7 +295,10 @@
},
},
'js/student_account/views/RegisterView'
:
{
'js/student_account/views/RegisterView'
:
{
exports
:
'js/student_account/views/RegisterView'
,
exports
:
'js/student_account/views/RegisterView'
,
deps
:
[
'js/student_account/models/RegisterModel'
]
deps
:
[
'js/student_account/models/RegisterModel'
,
'js/student_account/views/FormView'
]
},
},
'js/student_account/views/AccessView'
:
{
'js/student_account/views/AccessView'
:
{
exports
:
'js/student_account/views/AccessView'
,
exports
:
'js/student_account/views/AccessView'
,
...
...
lms/static/js/spec/student_account/password_reset_spec.js
View file @
ca0d048b
...
@@ -4,11 +4,21 @@ define(['js/common_helpers/template_helpers', 'js/student_account/views/Password
...
@@ -4,11 +4,21 @@ define(['js/common_helpers/template_helpers', 'js/student_account/views/Password
'use strict'
;
'use strict'
;
var
view
=
null
,
var
view
=
null
,
ajaxSuccess
=
true
;
ajaxSuccess
=
true
,
model
=
new
edx
.
student
.
account
.
PasswordResetModel
(),
data
=
[{
label
:
'E-mail'
,
instructions
:
'This is the e-mail address you used to register with edX'
,
name
:
'email'
,
required
:
true
,
type
:
'email'
,
restrictions
:
[],
defaultValue
:
''
}];
var
submitEmail
=
function
(
validationSuccess
)
{
var
submitEmail
=
function
(
validationSuccess
)
{
// Simulate manual entry of an email address
// Simulate manual entry of an email address
$
(
'#
reset-password
-email'
).
val
(
'foo@bar.baz'
);
$
(
'#
password-reset
-email'
).
val
(
'foo@bar.baz'
);
// Create a fake click event
// Create a fake click event
var
clickEvent
=
$
.
Event
(
'click'
);
var
clickEvent
=
$
.
Event
(
'click'
);
...
@@ -16,7 +26,10 @@ define(['js/common_helpers/template_helpers', 'js/student_account/views/Password
...
@@ -16,7 +26,10 @@ define(['js/common_helpers/template_helpers', 'js/student_account/views/Password
// Used to avoid spying on view.validate twice
// Used to avoid spying on view.validate twice
if
(
typeof
validationSuccess
!==
'undefined'
)
{
if
(
typeof
validationSuccess
!==
'undefined'
)
{
// Force validation to return as expected
// Force validation to return as expected
spyOn
(
view
,
'validate'
).
andReturn
(
validationSuccess
);
spyOn
(
view
,
'validate'
).
andReturn
({
isValid
:
validationSuccess
,
message
:
"We're all good."
});
}
}
// Submit the email address
// Submit the email address
...
@@ -43,12 +56,15 @@ define(['js/common_helpers/template_helpers', 'js/student_account/views/Password
...
@@ -43,12 +56,15 @@ define(['js/common_helpers/template_helpers', 'js/student_account/views/Password
if
(
ajaxSuccess
)
{
if
(
ajaxSuccess
)
{
defer
.
resolve
();
defer
.
resolve
();
}
else
{
}
else
{
defer
.
reject
(
);
defer
.
reject
With
(
this
,
[
"The server could not be contacted."
]
);
}
}
}).
promise
();
}).
promise
();
});
});
view
=
new
edx
.
student
.
account
.
PasswordResetView
();
view
=
new
edx
.
student
.
account
.
PasswordResetView
({
fields
:
data
,
model
:
model
});
});
});
it
(
"allows the user to request a new password"
,
function
()
{
it
(
"allows the user to request a new password"
,
function
()
{
...
@@ -72,13 +88,13 @@ define(['js/common_helpers/template_helpers', 'js/student_account/views/Password
...
@@ -72,13 +88,13 @@ define(['js/common_helpers/template_helpers', 'js/student_account/views/Password
// If we get an error status on the AJAX request, display an error
// If we get an error status on the AJAX request, display an error
ajaxSuccess
=
false
;
ajaxSuccess
=
false
;
submitEmail
(
true
);
submitEmail
(
true
);
expect
(
view
.
$
resetFail
).
not
.
toHaveClass
(
'hidden'
);
expect
(
view
.
$
'#submission-error'
).
not
.
toHaveClass
(
'hidden'
);
// If we try again and succeed, the error should go away
// If we try again and succeed, the error should go away
ajaxSuccess
=
true
;
ajaxSuccess
=
true
;
// No argument means we won't spy on view.validate again
// No argument means we won't spy on view.validate again
submitEmail
();
submitEmail
();
expect
(
view
.
$
resetFail
).
toHaveClass
(
'hidden'
);
expect
(
view
.
$
'#submission-error'
).
toHaveClass
(
'hidden'
);
});
});
});
});
}
}
...
...
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