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
dd3ddeb9
Commit
dd3ddeb9
authored
Jul 06, 2012
by
Prem Sichanugrist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMS.Views.Week is tested
parent
b11b9169
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
0 deletions
+71
-0
cms/static/coffee/spec/views/week_spec.coffee
+71
-0
No files found.
cms/static/coffee/spec/views/week_spec.coffee
0 → 100644
View file @
dd3ddeb9
describe
"CMS.Views.Week"
,
->
beforeEach
->
setFixtures
"""
<div id="week" data-id="i4x://mitx.edu/course/week">
<div class="editable"></div>
<textarea class="editable-textarea"></textarea>
<a href="#" class="week-edit" >edit</a>
<ul class="modules">
<li id="module-one" class="module"></li>
<li id="module-two" class="module"></li>
</ul>
</div>
"""
CMS
.
unbind
()
describe
"render"
,
->
beforeEach
->
spyOn
(
CMS
.
Views
,
"Module"
).
andReturn
(
jasmine
.
createSpyObj
(
"Module"
,
[
"render"
]))
$
.
fn
.
inlineEdit
=
jasmine
.
createSpy
(
"$.fn.inlineEdit"
)
@
view
=
new
CMS
.
Views
.
Week
(
el
:
$
(
"#week"
),
height
:
100
).
render
()
it
"set the height of the element"
,
->
expect
(
@
view
.
el
).
toHaveCss
(
height
:
"100px"
)
it
"make .editable as inline editor"
,
->
expect
(
$
.
fn
.
inlineEdit
.
calls
[
0
].
object
.
get
(
0
))
.
toEqual
(
$
(
".editable"
).
get
(
0
))
it
"make .editable-test as inline editor"
,
->
expect
(
$
.
fn
.
inlineEdit
.
calls
[
1
].
object
.
get
(
0
))
.
toEqual
(
$
(
".editable-textarea"
).
get
(
0
))
it
"create module subview for each module"
,
->
expect
(
CMS
.
Views
.
Module
.
calls
[
0
].
args
[
0
])
.
toEqual
({
el
:
$
(
"#module-one"
).
get
(
0
)
})
expect
(
CMS
.
Views
.
Module
.
calls
[
1
].
args
[
0
])
.
toEqual
({
el
:
$
(
"#module-two"
).
get
(
0
)
})
describe
"edit"
,
->
beforeEach
->
@
view
=
new
CMS
.
Views
.
Week
(
el
:
$
(
"#week"
),
height
:
100
).
render
()
spyOn
(
CMS
,
"replaceView"
)
spyOn
(
CMS
.
Views
,
"WeekEdit"
)
.
andReturn
(
@
view
=
jasmine
.
createSpy
(
"Views.WeekEdit"
))
spyOn
(
CMS
.
Models
,
"Week"
)
.
andReturn
(
@
model
=
jasmine
.
createSpy
(
"Models.Week"
))
$
(
".week-edit"
).
click
()
it
"replace the content with edit week view"
,
->
expect
(
CMS
.
replaceView
).
toHaveBeenCalledWith
@
view
expect
(
CMS
.
Views
.
WeekEdit
).
toHaveBeenCalledWith
model
:
@
model
expect
(
CMS
.
Models
.
Week
).
toHaveBeenCalledWith
id
:
"i4x://mitx.edu/course/week"
describe
"on content.show"
,
->
beforeEach
->
@
view
=
new
CMS
.
Views
.
Week
(
el
:
$
(
"#week"
),
height
:
100
).
render
()
@
view
.
$el
.
height
(
""
)
@
view
.
setHeight
()
it
"set the correct height"
,
->
expect
(
@
view
.
el
).
toHaveCss
(
height
:
"100px"
)
describe
"on content.hide"
,
->
beforeEach
->
@
view
=
new
CMS
.
Views
.
Week
(
el
:
$
(
"#week"
),
height
:
100
).
render
()
@
view
.
$el
.
height
(
"100px"
)
@
view
.
resetHeight
()
it
"remove height from the element"
,
->
expect
(
@
view
.
el
).
not
.
toHaveCss
(
height
:
"100px"
)
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