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
8227a8c3
Commit
8227a8c3
authored
Jun 14, 2013
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Started adding tests for textbook backbone views
parent
609c299f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
1 deletions
+38
-1
cms/envs/common.py
+1
-1
cms/static/coffee/fixtures/textbook-show.underscore
+2
-0
cms/static/coffee/spec/views/textbook_spec.coffee
+35
-0
No files found.
cms/envs/common.py
View file @
8227a8c3
...
...
@@ -242,7 +242,7 @@ PIPELINE_JS = {
)
+
[
'js/hesitate.js'
,
'js/base.js'
,
'js/views/feedback.js'
,
'js/models/section.js'
,
'js/views/section.js'
,
'js/models/metadata_model.js'
,
'js/views/metadata_editor_view.js'
,
'js/models/textbook.js'
,
'js/views/textbook
s
.js'
,
'js/models/textbook.js'
,
'js/views/textbook.js'
,
'js/views/assets.js'
],
'output_filename'
:
'js/cms-application.js'
,
'test_order'
:
0
...
...
cms/static/coffee/fixtures/textbook-show.underscore
0 → 120000
View file @
8227a8c3
../../../templates/js/textbook-show.underscore
\ No newline at end of file
cms/static/coffee/spec/views/textbook_spec.coffee
0 → 100644
View file @
8227a8c3
feedbackTpl
=
readFixtures
(
'system-feedback.underscore'
)
beforeEach
->
# remove this when we upgrade jasmine-jquery
@
addMatchers
toContainText
:
(
text
)
->
trimmedText
=
$
.
trim
(
@
actual
.
text
())
if
text
and
$
.
isFunction
(
text
.
test
)
return
text
.
test
(
trimmedText
)
else
return
trimmedText
.
indexOf
(
text
)
!=
-
1
;
describe
"CMS.Views.TextbookShow"
,
->
describe
"Basic"
,
->
tpl
=
readFixtures
(
'textbook-show.underscore'
)
beforeEach
->
setFixtures
(
$
(
"<script>"
,
{
id
:
"show-textbook-tpl"
,
type
:
"text/template"
}).
text
(
tpl
))
appendSetFixtures
(
$
(
"<script>"
,
{
id
:
"system-feedback-tpl"
,
type
:
"text/template"
}).
text
(
feedbackTpl
))
appendSetFixtures
(
sandbox
({
id
:
"page-notification"
}))
appendSetFixtures
(
sandbox
({
id
:
"page-prompt"
}))
@
model
=
new
CMS
.
Models
.
Textbook
({
name
:
"Life Sciences"
})
@
collection
=
new
CMS
.
Collections
.
TextbookSet
()
@
collection
.
add
(
@
model
)
@
view
=
new
CMS
.
Views
.
TextbookShow
({
model
:
@
model
})
it
"should render properly"
,
->
@
view
.
render
()
expect
(
@
view
.
$el
).
toContainText
(
"Life Sciences"
)
it
"should trigger an editOne event on the collection when the edit button is clicked"
,
->
spyOn
(
@
collection
,
"trigger"
).
andCallThrough
()
@
view
.
render
().
$
(
".edit"
).
click
()
expect
(
@
collection
.
trigger
).
toHaveBeenCalledWith
(
"editOne"
,
@
model
)
expect
(
@
collection
.
editing
).
toEqual
(
@
model
)
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