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
c0c5e920
Commit
c0c5e920
authored
May 30, 2013
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Go back to setFixtures.
parent
2f504ec4
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
29 deletions
+30
-29
cms/static/coffee/spec/main_spec.coffee
+1
-1
cms/static/coffee/spec/views/feedback_spec.coffee
+1
-1
cms/static/coffee/spec/views/metadata_edit_spec.coffee
+26
-25
cms/static/coffee/spec/views/module_edit_spec.coffee
+1
-1
cms/static/coffee/spec/views/section_spec.coffee
+1
-1
No files found.
cms/static/coffee/spec/main_spec.coffee
View file @
c0c5e920
...
...
@@ -27,7 +27,7 @@ describe "AJAX Errors", ->
tpl
=
readFixtures
(
'system-feedback.underscore'
)
beforeEach
->
appendS
etFixtures
(
$
(
"<script>"
,
{
id
:
"system-feedback-tpl"
,
type
:
"text/template"
}).
text
(
tpl
))
s
etFixtures
(
$
(
"<script>"
,
{
id
:
"system-feedback-tpl"
,
type
:
"text/template"
}).
text
(
tpl
))
appendSetFixtures
(
sandbox
({
id
:
"page-notification"
}))
@
requests
=
requests
=
[]
@
xhr
=
sinon
.
useFakeXMLHttpRequest
()
...
...
cms/static/coffee/spec/views/feedback_spec.coffee
View file @
c0c5e920
tpl
=
readFixtures
(
'system-feedback.underscore'
)
beforeEach
->
appendS
etFixtures
(
sandbox
({
id
:
"page-alert"
}))
s
etFixtures
(
sandbox
({
id
:
"page-alert"
}))
appendSetFixtures
(
sandbox
({
id
:
"page-notification"
}))
appendSetFixtures
(
sandbox
({
id
:
"page-prompt"
}))
appendSetFixtures
(
$
(
"<script>"
,
{
id
:
"system-feedback-tpl"
,
type
:
"text/template"
}).
text
(
tpl
))
...
...
cms/static/coffee/spec/views/metadata_edit_spec.coffee
View file @
c0c5e920
editorTemplate
=
readFixtures
(
'metadata-editor.underscore'
)
numberEntryTemplate
=
readFixtures
(
'metadata-number-entry.underscore'
)
stringEntryTemplate
=
readFixtures
(
'metadata-string-entry.underscore'
)
optionEntryTemplate
=
readFixtures
(
'metadata-option-entry.underscore'
)
describe
"Test Metadata Editor"
,
->
editorTemplate
=
readFixtures
(
'metadata-editor.underscore'
)
numberEntryTemplate
=
readFixtures
(
'metadata-number-entry.underscore'
)
stringEntryTemplate
=
readFixtures
(
'metadata-string-entry.underscore'
)
optionEntryTemplate
=
readFixtures
(
'metadata-option-entry.underscore'
)
beforeEach
->
appendS
etFixtures
(
$
(
"<script>"
,
{
id
:
"metadata-editor-tpl"
,
type
:
"text/template"
}).
text
(
editorTemplate
))
beforeEach
->
s
etFixtures
(
$
(
"<script>"
,
{
id
:
"metadata-editor-tpl"
,
type
:
"text/template"
}).
text
(
editorTemplate
))
appendSetFixtures
(
$
(
"<script>"
,
{
id
:
"metadata-number-entry"
,
type
:
"text/template"
}).
text
(
numberEntryTemplate
))
appendSetFixtures
(
$
(
"<script>"
,
{
id
:
"metadata-string-entry"
,
type
:
"text/template"
}).
text
(
stringEntryTemplate
))
appendSetFixtures
(
$
(
"<script>"
,
{
id
:
"metadata-option-entry"
,
type
:
"text/template"
}).
text
(
optionEntryTemplate
))
genericEntry
=
{
genericEntry
=
{
default_value
:
'default value'
,
display_name
:
"Display Name"
,
explicitly_set
:
true
,
...
...
@@ -19,9 +20,9 @@ genericEntry = {
options
:
[],
type
:
CMS
.
Models
.
Metadata
.
GENERIC_TYPE
,
value
:
"Word cloud"
}
}
selectEntry
=
{
selectEntry
=
{
default_value
:
"answered"
,
display_name
:
"Show Answer"
,
explicitly_set
:
false
,
...
...
@@ -35,9 +36,9 @@ selectEntry = {
],
type
:
CMS
.
Models
.
Metadata
.
SELECT_TYPE
,
value
:
"always"
}
}
integerEntry
=
{
integerEntry
=
{
default_value
:
5
,
display_name
:
"Inputs"
,
explicitly_set
:
false
,
...
...
@@ -47,9 +48,9 @@ integerEntry = {
options
:
{
min
:
1
},
type
:
CMS
.
Models
.
Metadata
.
INTEGER_TYPE
,
value
:
5
}
}
floatEntry
=
{
floatEntry
=
{
default_value
:
2.7
,
display_name
:
"Weight"
,
explicitly_set
:
true
,
...
...
@@ -59,10 +60,10 @@ floatEntry = {
options
:
{
min
:
1.3
,
max
:
100.2
,
step
:
0.1
},
type
:
CMS
.
Models
.
Metadata
.
FLOAT_TYPE
,
value
:
10.2
}
}
# Test for the editor that creates the individual views.
describe
"CMS.Views.Metadata.Editor creates editors for each field"
,
->
# Test for the editor that creates the individual views.
describe
"CMS.Views.Metadata.Editor creates editors for each field"
,
->
beforeEach
->
@
model
=
new
Backbone
.
Model
({
num_inputs
:
integerEntry
,
...
...
@@ -141,32 +142,32 @@ describe "CMS.Views.Metadata.Editor creates editors for each field", ->
num_inputs
:
20
})
# Tests for individual views.
assertInputType
=
(
view
,
expectedType
)
->
# Tests for individual views.
assertInputType
=
(
view
,
expectedType
)
->
input
=
view
.
$el
.
find
(
'.setting-input'
)
expect
(
input
.
length
).
toBe
(
1
)
expect
(
input
[
0
].
type
).
toBe
(
expectedType
)
assertValueInView
=
(
view
,
expectedValue
)
->
assertValueInView
=
(
view
,
expectedValue
)
->
expect
(
view
.
getValueFromEditor
()).
toBe
(
expectedValue
)
assertCanUpdateView
=
(
view
,
newValue
)
->
assertCanUpdateView
=
(
view
,
newValue
)
->
view
.
setValueInEditor
(
newValue
)
expect
(
view
.
getValueFromEditor
()).
toBe
(
newValue
)
assertClear
=
(
view
,
modelValue
,
editorValue
=
modelValue
)
->
assertClear
=
(
view
,
modelValue
,
editorValue
=
modelValue
)
->
view
.
clear
()
expect
(
view
.
model
.
getValue
()).
toBe
(
null
)
expect
(
view
.
model
.
getDisplayValue
()).
toBe
(
modelValue
)
expect
(
view
.
getValueFromEditor
()).
toBe
(
editorValue
)
assertUpdateModel
=
(
view
,
originalValue
,
newValue
)
->
assertUpdateModel
=
(
view
,
originalValue
,
newValue
)
->
view
.
setValueInEditor
(
newValue
)
expect
(
view
.
model
.
getValue
()).
toBe
(
originalValue
)
view
.
updateModel
()
expect
(
view
.
model
.
getValue
()).
toBe
(
newValue
)
describe
"CMS.Views.Metadata.String is a basic string input with clear functionality"
,
->
describe
"CMS.Views.Metadata.String is a basic string input with clear functionality"
,
->
beforeEach
->
model
=
new
CMS
.
Models
.
Metadata
(
genericEntry
)
@
view
=
new
CMS
.
Views
.
Metadata
.
String
({
model
:
model
})
...
...
@@ -186,7 +187,7 @@ describe "CMS.Views.Metadata.String is a basic string input with clear functiona
it
"has an update model method"
,
->
assertUpdateModel
(
@
view
,
'Word cloud'
,
'updated'
)
describe
"CMS.Views.Metadata.Option is an option input type with clear functionality"
,
->
describe
"CMS.Views.Metadata.Option is an option input type with clear functionality"
,
->
beforeEach
->
model
=
new
CMS
.
Models
.
Metadata
(
selectEntry
)
@
view
=
new
CMS
.
Views
.
Metadata
.
Option
({
model
:
model
})
...
...
@@ -210,7 +211,7 @@ describe "CMS.Views.Metadata.Option is an option input type with clear functiona
@
view
.
setValueInEditor
(
"not an option"
)
expect
(
@
view
.
getValueFromEditor
()).
toBe
(
'always'
)
describe
"CMS.Views.Metadata.Number supports integer or float type and has clear functionality"
,
->
describe
"CMS.Views.Metadata.Number supports integer or float type and has clear functionality"
,
->
beforeEach
->
integerModel
=
new
CMS
.
Models
.
Metadata
(
integerEntry
)
@
integerView
=
new
CMS
.
Views
.
Metadata
.
Number
({
model
:
integerModel
})
...
...
cms/static/coffee/spec/views/module_edit_spec.coffee
View file @
c0c5e920
...
...
@@ -4,7 +4,7 @@ describe "CMS.Views.ModuleEdit", ->
@
stubModule
.
id
=
'stub-id'
appendS
etFixtures
"""
s
etFixtures
"""
<li class="component" id="stub-id">
<div class="component-editor">
<div class="module-editor">
...
...
cms/static/coffee/spec/views/section_spec.coffee
View file @
c0c5e920
...
...
@@ -29,7 +29,7 @@ describe "CMS.Views.SectionEdit", ->
feedback_tpl
=
readFixtures
(
'system-feedback.underscore'
)
beforeEach
->
appendS
etFixtures
(
$
(
"<script>"
,
{
id
:
"section-name-edit-tpl"
,
type
:
"text/template"
}).
text
(
tpl
))
s
etFixtures
(
$
(
"<script>"
,
{
id
:
"section-name-edit-tpl"
,
type
:
"text/template"
}).
text
(
tpl
))
appendSetFixtures
(
$
(
"<script>"
,
{
id
:
"system-feedback-tpl"
,
type
:
"text/template"
}).
text
(
feedback_tpl
))
spyOn
(
CMS
.
Views
.
SectionEdit
.
prototype
,
"switchToShowView"
)
.
andCallThrough
()
...
...
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