Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
ecommerce
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
ecommerce
Commits
63b6a5e5
Commit
63b6a5e5
authored
Aug 12, 2015
by
Clinton Blackburn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added additional JS tests
XCOM-523
parent
a34dcb75
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
103 additions
and
2 deletions
+103
-2
.jshintrc
+4
-1
ecommerce/static/js/test/specs/views/course_seat_form_fields/course_seat_form_field_view_spec.js
+23
-0
ecommerce/static/js/test/specs/views/course_seat_form_fields/professional_course_seat_form_field_view_spec.js
+44
-0
ecommerce/static/js/test/specs/views/course_seat_form_fields/verified_seat_form_field_view_spec.js
+29
-0
ecommerce/static/js/views/course_seat_form_fields/course_seat_form_field_view.js
+1
-0
ecommerce/static/js/views/course_seat_form_fields/professional_course_seat_form_field_view.js
+2
-1
No files found.
.jshintrc
View file @
63b6a5e5
...
@@ -146,6 +146,9 @@
...
@@ -146,6 +146,9 @@
"gettext",
"gettext",
// App-specific
// App-specific
"analytics"
"analytics",
// Jasmine
"done"
]
]
}
}
ecommerce/static/js/test/specs/views/course_seat_form_fields/course_seat_form_field_view_spec.js
0 → 100644
View file @
63b6a5e5
define
([
'models/course_seats/course_seat'
,
'views/course_seat_form_fields/course_seat_form_field_view'
],
function
(
CourseSeat
,
CourseSeatFormFieldView
)
{
'use strict'
;
var
model
,
view
;
beforeEach
(
function
()
{
model
=
new
CourseSeat
();
view
=
new
CourseSeatFormFieldView
({
model
:
model
});
});
describe
(
'cleanIdVerificationRequired'
,
function
()
{
it
(
'should always return a boolean'
,
function
()
{
expect
(
view
.
cleanIdVerificationRequired
(
'false'
)).
toEqual
(
false
);
expect
(
view
.
cleanIdVerificationRequired
(
'true'
)).
toEqual
(
true
);
});
});
}
);
ecommerce/static/js/test/specs/views/course_seat_form_fields/professional_course_seat_form_field_view_spec.js
0 → 100644
View file @
63b6a5e5
define
([
'underscore'
,
'models/course_seats/professional_seat'
,
'views/course_seat_form_fields/professional_course_seat_form_field_view'
],
function
(
_
,
ProfessionalSeat
,
CourseSeatFormFieldView
)
{
'use strict'
;
var
model
,
view
;
beforeEach
(
function
()
{
model
=
new
ProfessionalSeat
();
view
=
new
CourseSeatFormFieldView
({
model
:
model
}).
render
();
});
describe
(
'getFieldValue'
,
function
()
{
it
(
'should return a boolean if the name is id_verification_required'
,
function
()
{
var
values
=
[
true
,
false
];
// Sanity check for the default values
expect
(
model
.
get
(
'id_verification_required'
)).
toEqual
(
false
);
expect
(
view
.
getFieldValue
(
'id_verification_required'
)).
toEqual
(
false
);
_
.
each
(
values
,
function
(
value
)
{
model
.
set
(
'id_verification_required'
,
value
);
// Wait for backbone.stickit to update the DOM
setTimeout
(
function
()
{
expect
(
view
.
getFieldValue
(
'id_verification_required'
)).
toEqual
(
value
);
done
();
},
1
);
});
});
it
(
'should always return professional if the name is certificate_type'
,
function
()
{
expect
(
view
.
getFieldValue
(
'certificate_type'
)).
toEqual
(
'professional'
);
});
});
}
);
ecommerce/static/js/test/specs/views/course_seat_form_fields/verified_seat_form_field_view_spec.js
0 → 100644
View file @
63b6a5e5
define
([
'models/course_seats/verified_seat'
,
'views/course_seat_form_fields/verified_course_seat_form_field_view'
],
function
(
VerifiedSeat
,
VerifiedCourseSeatFormFieldView
)
{
'use strict'
;
var
model
,
view
;
beforeEach
(
function
()
{
model
=
new
VerifiedSeat
();
view
=
new
VerifiedCourseSeatFormFieldView
({
model
:
model
}).
render
();
});
describe
(
'getData'
,
function
()
{
it
(
'should return the data from the DOM/model'
,
function
()
{
var
data
=
{
certificate_type
:
'verified'
,
id_verification_required
:
'true'
,
price
:
'100'
,
expires
:
''
};
expect
(
view
.
getData
()).
toEqual
(
data
);
});
});
}
);
ecommerce/static/js/views/course_seat_form_fields/course_seat_form_field_view.js
View file @
63b6a5e5
...
@@ -39,6 +39,7 @@ define([
...
@@ -39,6 +39,7 @@ define([
},
},
initialize
:
function
()
{
initialize
:
function
()
{
/* istanbul ignore next */
Backbone
.
Validation
.
bind
(
this
,
{
Backbone
.
Validation
.
bind
(
this
,
{
valid
:
function
(
view
,
attr
)
{
valid
:
function
(
view
,
attr
)
{
var
$el
=
view
.
$
(
'[name='
+
attr
+
']'
),
var
$el
=
view
.
$
(
'[name='
+
attr
+
']'
),
...
...
ecommerce/static/js/views/course_seat_form_fields/professional_course_seat_form_field_view.js
View file @
63b6a5e5
define
([
define
([
'underscore.string'
,
'underscore.string'
,
'views/course_seat_form_fields/verified_course_seat_form_field_view'
,
'views/course_seat_form_fields/verified_course_seat_form_field_view'
,
'text!templates/professional_course_seat_form_field.html'
'text!templates/professional_course_seat_form_field.html'
,
'backbone.super'
],
],
function
(
_s
,
function
(
_s
,
VerifiedCourseSeatFormFieldView
,
VerifiedCourseSeatFormFieldView
,
...
...
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