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
10ec6046
Commit
10ec6046
authored
May 14, 2013
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Got jasmine tests working with fixtures properly
parent
0c368011
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
9 deletions
+27
-9
cms/static/coffee/fixtures/system-feedback.underscore
+2
-0
cms/static/coffee/spec/helpers.coffee
+2
-0
cms/static/coffee/spec/views/feedback_spec.coffee
+23
-9
No files found.
cms/static/coffee/fixtures/system-feedback.underscore
0 → 120000
View file @
10ec6046
../../../templates/js/system-feedback.underscore
\ No newline at end of file
cms/static/coffee/spec/helpers.coffee
View file @
10ec6046
jasmine
.
getFixtures
().
fixturesPath
=
'fixtures'
# Stub jQuery.cookie
@
stubCookies
=
csrftoken
:
"stubCSRFToken"
...
...
cms/static/coffee/spec/views/feedback_spec.coffee
View file @
10ec6046
describe
"CMS.Views.SystemFeedback"
,
->
tpl
=
readFixtures
(
'system-feedback.underscore'
)
# CMS.Views.SystemFeedback looks for a template on the page when the code
# is loaded, and even if we set that template on the page using a fixture,
# CMS.Views.SystemFeedback has already been loaded, and so that template
# won't be picked up. This is a dirty hack, to load that template into
# the code after the code has been loaded already.
CMS
.
Views
.
SystemFeedback
.
prototype
.
template
=
_
.
template
(
tpl
)
beforeEach
->
setFixtures
(
sandbox
({
id
:
"page-notification"
}))
# CMS.Views.SystemFeedback looks for a template on the page when the code
# is loaded, and even if we set that template on the page using a fixture,
# CMS.Views.SystemFeedback has already been loaded, and so that template
# won't be picked up. This is a dirty hack, to load that template into
# the code after the code has been loaded already.
CMS
.
Views
.
SystemFeedback
.
prototype
.
template
=
_
.
template
"""
<h1><%= title %></h1>
<p><%= message %></p>
"""
@
model
=
new
CMS
.
Models
.
ConfirmationMessage
({
"title"
:
"Portal"
"message"
:
"Welcome to the Aperture Science Computer-Aided Enrichment Center"
close
:
true
})
# it will be interesting to see when this.render is called, so lets spy on it
spyOn
(
CMS
.
Views
.
SystemFeedback
.
prototype
,
'render'
).
andCallThrough
()
...
...
@@ -24,7 +24,21 @@ describe "CMS.Views.SystemFeedback", ->
it
"renders the template"
,
->
view
=
new
CMS
.
Views
.
Notification
({
model
:
@
model
})
expect
(
view
.
$
(
".action-close"
)).
toBeDefined
()
expect
(
view
.
$
(
'.wrapper'
)).
toHaveClass
(
"is-shown"
)
text
=
view
.
$el
.
text
()
expect
(
text
).
toMatch
(
/Portal/
)
expect
(
text
).
toMatch
(
/Aperture Science/
)
it
"close button sends a .hide() message"
,
->
spyOn
(
CMS
.
Views
.
SystemFeedback
.
prototype
,
'hide'
).
andCallThrough
()
view
=
new
CMS
.
Views
.
Notification
({
model
:
@
model
})
view
.
$
(
".action-close"
).
click
()
expect
(
CMS
.
Views
.
SystemFeedback
.
prototype
.
hide
).
toHaveBeenCalled
()
expect
(
view
.
$
(
'.wrapper'
)).
not
.
toHaveClass
(
"is-shown"
)
expect
(
view
.
$
(
'.wrapper'
)).
toHaveClass
(
"is-hiding"
)
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