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
21e5805b
Commit
21e5805b
authored
Oct 21, 2014
by
Renzo Lucioni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: Add JS tests of access, login, register, and password reset views
parent
5671392a
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
65 additions
and
19 deletions
+65
-19
lms/static/js/spec/student_account/access_spec.js
+33
-4
lms/static/js/spec/student_account/login_spec.js
+8
-3
lms/static/js/spec/student_account/password_reset_spec.js
+8
-3
lms/static/js/spec/student_account/register_spec.js
+8
-3
lms/static/js/student_account/views/AccessView.js
+2
-3
lms/static/js/student_account/views/LoginView.js
+2
-1
lms/static/js/student_account/views/PasswordResetView.js
+2
-1
lms/static/js/student_account/views/RegisterView.js
+2
-1
lms/templates/student_account/login_and_register.html
+0
-0
No files found.
lms/static/js/spec/student_account/access_spec.js
View file @
21e5805b
define
([
'js/student_account/views/AccessView'
],
function
()
{
define
([
'js/common_helpers/template_helpers'
,
'js/student_account/views/AccessView'
],
function
(
TemplateHelpers
)
{
describe
(
"edx.student.account.AccessView"
,
function
()
{
'use strict'
;
describe
(
"edx.student.account.AccessView"
,
function
()
{
var
view
=
null
,
ajaxSuccess
=
true
;
beforeEach
(
function
()
{
var
mainFixture
=
"<div id='login-and-registration-container'class='login-register'data-initial-mode='${initial_mode}'data-third-party-auth-providers='${third_party_auth_providers}'/>"
;
setFixtures
(
mainFixture
);
TemplateHelpers
.
installTemplate
(
"templates/student_account/access"
);
TemplateHelpers
.
installTemplate
(
"templates/student_account/login"
);
// Stub AJAX calls to return success / failure
spyOn
(
$
,
"ajax"
).
andCallFake
(
function
()
{
return
$
.
Deferred
(
function
(
defer
)
{
if
(
ajaxSuccess
)
{
defer
.
resolve
();
}
else
{
defer
.
reject
();
}
}).
promise
();
});
view
=
new
edx
.
student
.
account
.
AccessView
({
mode
:
'login'
,
thirdPartyAuth
:
false
});
});
it
(
"initially displays the correct form"
,
function
()
{
// TODO
expect
(
view
.
subview
.
login
.
$form
).
not
.
toHaveClass
(
'hidden'
);
expect
(
$
(
"#register-form"
)).
toHaveClass
(
'hidden'
);
expect
(
$
(
"#password-reset-wrapper"
)).
toBeEmpty
();
});
it
(
"toggles between the login and registration forms"
,
function
()
{
...
...
lms/static/js/spec/student_account/login_spec.js
View file @
21e5805b
define
([
'js/student_account/views/LoginView'
],
function
()
{
define
([
'js/common_helpers/template_helpers'
,
'js/student_account/views/LoginView'
],
function
(
TemplateHelpers
)
{
describe
(
"edx.student.account.LoginView"
,
function
()
{
'use strict'
;
describe
(
"edx.student.account.LoginView"
,
function
()
{
beforeEach
(
function
()
{
setFixtures
(
"<div></div>"
);
TemplateHelpers
.
installTemplate
(
"templates/student_account/login"
);
});
it
(
"logs the user in"
,
function
()
{
// TODO
});
...
...
lms/static/js/spec/student_account/password_reset_spec.js
View file @
21e5805b
define
([
'js/student_account/views/PasswordResetView'
],
function
()
{
define
([
'js/common_helpers/template_helpers'
,
'js/student_account/views/PasswordResetView'
],
function
(
TemplateHelpers
)
{
describe
(
"edx.student.account.PasswordResetView"
,
function
()
{
'use strict'
;
describe
(
"edx.student.account.PasswordResetView"
,
function
()
{
beforeEach
(
function
()
{
setFixtures
(
"<div></div>"
);
TemplateHelpers
.
installTemplate
(
"templates/student_account/password_reset"
);
});
it
(
"allows the user to request a new password"
,
function
()
{
// TODO
});
...
...
lms/static/js/spec/student_account/register_spec.js
View file @
21e5805b
define
([
'js/student_account/views/RegisterView'
],
function
()
{
define
([
'js/common_helpers/template_helpers'
,
'js/student_account/views/RegisterView'
],
function
(
TemplateHelpers
)
{
describe
(
"edx.student.account.RegisterView"
,
function
()
{
'use strict'
;
describe
(
"edx.student.account.RegisterView"
,
function
()
{
beforeEach
(
function
()
{
setFixtures
(
"<div></div>"
);
TemplateHelpers
.
installTemplate
(
"templates/student_account/register"
);
});
it
(
"registers a new user"
,
function
()
{
// TODO
});
...
...
lms/static/js/student_account/views/AccessView.js
View file @
21e5805b
...
...
@@ -9,7 +9,7 @@ var edx = edx || {};
edx
.
student
.
account
.
AccessView
=
Backbone
.
View
.
extend
({
el
:
'#login-and-registration-container'
,
tpl
:
$
(
'#access-tpl'
).
html
()
,
tpl
:
'#access-tpl'
,
events
:
{
'change .form-toggle'
:
'toggleForm'
...
...
@@ -25,9 +25,8 @@ var edx = edx || {};
activeForm
:
''
,
initialize
:
function
(
obj
)
{
this
.
tpl
=
$
(
this
.
tpl
).
html
();
this
.
activeForm
=
obj
.
mode
;
console
.
log
(
obj
);
this
.
render
();
},
...
...
lms/static/js/student_account/views/LoginView.js
View file @
21e5805b
...
...
@@ -11,7 +11,7 @@ var edx = edx || {};
el
:
'#login-form'
,
tpl
:
$
(
'#login-tpl'
).
html
()
,
tpl
:
'#login-tpl'
,
fieldTpl
:
$
(
'#form_field-tpl'
).
html
(),
...
...
@@ -25,6 +25,7 @@ var edx = edx || {};
$form
:
{},
initialize
:
function
()
{
this
.
tpl
=
$
(
this
.
tpl
).
html
();
this
.
getInitialData
();
},
...
...
lms/static/js/student_account/views/PasswordResetView.js
View file @
21e5805b
...
...
@@ -11,7 +11,7 @@ var edx = edx || {};
el
:
'#password-reset-wrapper'
,
tpl
:
$
(
'#password_reset-tpl'
).
html
()
,
tpl
:
'#password_reset-tpl'
,
fieldTpl
:
$
(
'#form_field-tpl'
).
html
(),
...
...
@@ -35,6 +35,7 @@ var edx = edx || {};
restrictions
:
[]
}]);
this
.
tpl
=
$
(
this
.
tpl
).
html
();
this
.
initModel
();
this
.
render
(
fields
);
},
...
...
lms/static/js/student_account/views/RegisterView.js
View file @
21e5805b
...
...
@@ -11,7 +11,7 @@ var edx = edx || {};
el
:
'#register-form'
,
tpl
:
$
(
'#register-tpl'
).
html
()
,
tpl
:
'#register-tpl'
,
fieldTpl
:
$
(
'#form_field-tpl'
).
html
(),
...
...
@@ -24,6 +24,7 @@ var edx = edx || {};
$form
:
{},
initialize
:
function
()
{
this
.
tpl
=
$
(
this
.
tpl
).
html
();
this
.
getInitialData
();
},
...
...
lms/templates/student_account/login_and_register.html
View file @
21e5805b
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