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
9cbfee98
Commit
9cbfee98
authored
May 16, 2013
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Jasmine tests related to invalid messages for section model
parent
2b01273f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
10 deletions
+7
-10
cms/static/coffee/spec/views/section_spec.coffee
+5
-8
cms/static/js/views/section.js
+2
-2
No files found.
cms/static/coffee/spec/views/section_spec.coffee
View file @
9cbfee98
...
...
@@ -31,7 +31,7 @@ describe "CMS.Views.SectionEdit", ->
setFixtures
(
$
(
"<script>"
,
{
id
:
"section-name-edit-tpl"
,
type
:
"text/template"
}).
text
(
tpl
))
spyOn
(
CMS
.
Views
.
SectionEdit
.
prototype
,
"switchToShowView"
)
.
andCallThrough
()
spyOn
(
CMS
.
Views
.
SectionEdit
.
prototype
,
"show
Error
Message"
)
spyOn
(
CMS
.
Views
.
SectionEdit
.
prototype
,
"show
Invalid
Message"
)
.
andCallThrough
()
window
.
analytics
=
jasmine
.
createSpyObj
(
'analytics'
,
[
'track'
])
window
.
course_location_analytics
=
jasmine
.
createSpy
()
...
...
@@ -68,12 +68,9 @@ describe "CMS.Views.SectionEdit", ->
@
requests
[
0
].
respond
(
200
)
expect
(
@
view
.
switchToShowView
).
toHaveBeenCalled
()
it
"should call showErrorMessage when save() is unsuccessful"
,
->
it
"should call showInvalidMessage when validation is unsuccessful"
,
->
spyOn
(
@
model
,
'validate'
).
andReturn
(
"BLARRGH"
)
@
view
.
$
(
"input[type=submit]"
).
click
()
@
requests
[
0
].
respond
(
500
)
expect
(
@
view
.
showErrorMessage
).
toHaveBeenCalled
(
)
expect
(
@
view
.
showInvalidMessage
).
toHaveBeenCalledWith
(
jasmine
.
any
(
Object
),
"BLARRGH"
,
jasmine
.
any
(
Object
)
)
expect
(
@
view
.
switchToShowView
).
not
.
toHaveBeenCalled
()
cms/static/js/views/section.js
View file @
9cbfee98
...
...
@@ -26,7 +26,7 @@ CMS.Views.SectionEdit = Backbone.View.extend({
},
initialize
:
function
()
{
this
.
template
=
_
.
template
(
$
(
"#section-name-edit-tpl"
).
text
());
this
.
listenTo
(
this
.
model
,
"invalid"
,
this
.
show
Error
Message
);
this
.
listenTo
(
this
.
model
,
"invalid"
,
this
.
show
Invalid
Message
);
this
.
render
();
},
events
:
{
...
...
@@ -58,7 +58,7 @@ CMS.Views.SectionEdit = Backbone.View.extend({
this
.
stopListening
();
this
.
showView
.
render
();
},
show
Error
Message
:
function
(
model
,
error
,
options
)
{
show
Invalid
Message
:
function
(
model
,
error
,
options
)
{
var
that
=
this
;
var
msg
=
new
CMS
.
Models
.
ErrorMessage
({
title
:
"Validation Error"
,
...
...
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