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
6ed5a2aa
Commit
6ed5a2aa
authored
May 15, 2013
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests for Backbone section models
parent
56d8a467
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
1 deletions
+55
-1
cms/envs/common.py
+2
-1
cms/static/coffee/spec/models/section_spec.coffee
+53
-0
No files found.
cms/envs/common.py
View file @
6ed5a2aa
...
...
@@ -222,7 +222,8 @@ PIPELINE_JS = {
rooted_glob
(
COMMON_ROOT
/
'static/'
,
'coffee/src/**/*.js'
)
+
rooted_glob
(
PROJECT_ROOT
/
'static/'
,
'coffee/src/**/*.js'
)
)
+
[
'js/hesitate.js'
,
'js/base.js'
,
'js/models/feedback.js'
,
'js/views/feedback.js'
],
'js/models/feedback.js'
,
'js/views/feedback.js'
,
'js/models/section.js'
,
'js/views/section.js'
],
'output_filename'
:
'js/cms-application.js'
,
'test_order'
:
0
},
...
...
cms/static/coffee/spec/models/section_spec.coffee
0 → 100644
View file @
6ed5a2aa
describe
"CMS.Models.Section"
,
->
describe
"basic"
,
->
beforeEach
->
@
model
=
new
CMS
.
Models
.
Section
({
id
:
42
,
name
:
"Life, the Universe, and Everything"
})
it
"should take an id argument"
,
->
expect
(
@
model
.
get
(
"id"
)).
toEqual
(
42
)
it
"should take a name argument"
,
->
expect
(
@
model
.
get
(
"name"
)).
toEqual
(
"Life, the Universe, and Everything"
)
it
"should have a URL set"
,
->
expect
(
@
model
.
url
).
toEqual
(
"/save_item"
)
it
"should serialize to JSON correctly"
,
->
expect
(
@
model
.
toJSON
()).
toEqual
({
id
:
42
,
metadata
:
{
display_name
:
"Life, the Universe, and Everything"
}
})
describe
"XHR"
,
->
beforeEach
->
spyOn
(
CMS
.
Models
.
Section
.
prototype
,
'showNotification'
)
spyOn
(
CMS
.
Models
.
Section
.
prototype
,
'hideNotification'
)
@
model
=
new
CMS
.
Models
.
Section
({
id
:
42
,
name
:
"Life, the Universe, and Everything"
})
@
requests
=
requests
=
[]
@
xhr
=
sinon
.
useFakeXMLHttpRequest
()
@
xhr
.
onCreate
=
(
xhr
)
->
requests
.
push
(
xhr
)
afterEach
->
@
xhr
.
restore
()
it
"show/hide a notification when it saves to the server"
,
->
@
model
.
save
()
expect
(
CMS
.
Models
.
Section
.
prototype
.
showNotification
).
toHaveBeenCalled
()
@
requests
[
0
].
respond
(
200
)
expect
(
CMS
.
Models
.
Section
.
prototype
.
hideNotification
).
toHaveBeenCalled
()
it
"show/hide a notification when saving fails"
,
->
@
model
.
save
()
expect
(
CMS
.
Models
.
Section
.
prototype
.
showNotification
).
toHaveBeenCalled
()
@
requests
[
0
].
respond
(
500
)
expect
(
CMS
.
Models
.
Section
.
prototype
.
hideNotification
).
toHaveBeenCalled
()
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