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
307c6c17
Commit
307c6c17
authored
Jun 25, 2013
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMS.Views.Notification.Saving should have sensible defaults
minShown = 1250, closeIcon = false
parent
7b502ced
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
13 deletions
+30
-13
cms/static/coffee/spec/views/feedback_spec.coffee
+22
-7
cms/static/js/models/section.js
+1
-3
cms/static/js/views/feedback.js
+6
-0
cms/static/js/views/textbook.js
+1
-3
No files found.
cms/static/coffee/spec/views/feedback_spec.coffee
View file @
307c6c17
...
...
@@ -98,6 +98,16 @@ describe "CMS.Views.Prompt", ->
view
.
hide
()
# expect($("body")).not.toHaveClass("prompt-is-shown")
describe
"CMS.Views.Notification.Saving"
,
->
beforeEach
->
@
view
=
new
CMS
.
Views
.
Notification
.
Saving
()
it
"should have minShown set to 1250 by default"
,
->
expect
(
@
view
.
options
.
minShown
).
toEqual
(
1250
)
it
"should have closeIcon set to false by default"
,
->
expect
(
@
view
.
options
.
closeIcon
).
toBeFalsy
()
describe
"CMS.Views.SystemFeedback click events"
,
->
beforeEach
->
@
primaryClickSpy
=
jasmine
.
createSpy
(
'primaryClick'
)
...
...
@@ -204,17 +214,22 @@ describe "CMS.Views.SystemFeedback multiple secondary actions", ->
describe
"CMS.Views.Notification minShown and maxShown"
,
->
beforeEach
->
@
showSpy
=
spyOn
(
CMS
.
Views
.
Notification
.
Saving
.
prototype
,
'show'
)
@
showSpy
=
spyOn
(
CMS
.
Views
.
Notification
.
Confirmation
.
prototype
,
'show'
)
@
showSpy
.
andCallThrough
()
@
hideSpy
=
spyOn
(
CMS
.
Views
.
Notification
.
Saving
.
prototype
,
'hide'
)
@
hideSpy
=
spyOn
(
CMS
.
Views
.
Notification
.
Confirmation
.
prototype
,
'hide'
)
@
hideSpy
.
andCallThrough
()
@
clock
=
sinon
.
useFakeTimers
()
afterEach
->
@
clock
.
restore
()
it
"should not have minShown or maxShown by default"
,
->
view
=
new
CMS
.
Views
.
Notification
.
Confirmation
()
expect
(
view
.
options
.
minShown
).
toEqual
(
0
)
expect
(
view
.
options
.
maxShown
).
toEqual
(
Infinity
)
it
"a minShown view should not hide too quickly"
,
->
view
=
new
CMS
.
Views
.
Notification
.
Saving
({
minShown
:
1000
})
view
=
new
CMS
.
Views
.
Notification
.
Confirmation
({
minShown
:
1000
})
view
.
show
()
expect
(
view
.
$
(
'.wrapper'
)).
toBeShown
()
...
...
@@ -227,7 +242,7 @@ describe "CMS.Views.Notification minShown and maxShown", ->
expect
(
view
.
$
(
'.wrapper'
)).
toBeHiding
()
it
"a maxShown view should hide by itself"
,
->
view
=
new
CMS
.
Views
.
Notification
.
Saving
({
maxShown
:
1000
})
view
=
new
CMS
.
Views
.
Notification
.
Confirmation
({
maxShown
:
1000
})
view
.
show
()
expect
(
view
.
$
(
'.wrapper'
)).
toBeShown
()
...
...
@@ -236,7 +251,7 @@ describe "CMS.Views.Notification minShown and maxShown", ->
expect
(
view
.
$
(
'.wrapper'
)).
toBeHiding
()
it
"a minShown view can stay visible longer"
,
->
view
=
new
CMS
.
Views
.
Notification
.
Saving
({
minShown
:
1000
})
view
=
new
CMS
.
Views
.
Notification
.
Confirmation
({
minShown
:
1000
})
view
.
show
()
expect
(
view
.
$
(
'.wrapper'
)).
toBeShown
()
...
...
@@ -250,7 +265,7 @@ describe "CMS.Views.Notification minShown and maxShown", ->
expect
(
view
.
$
(
'.wrapper'
)).
toBeHiding
()
it
"a maxShown view can hide early"
,
->
view
=
new
CMS
.
Views
.
Notification
.
Saving
({
maxShown
:
1000
})
view
=
new
CMS
.
Views
.
Notification
.
Confirmation
({
maxShown
:
1000
})
view
.
show
()
expect
(
view
.
$
(
'.wrapper'
)).
toBeShown
()
...
...
@@ -264,7 +279,7 @@ describe "CMS.Views.Notification minShown and maxShown", ->
expect
(
view
.
$
(
'.wrapper'
)).
toBeHiding
()
it
"a view can have both maxShown and minShown"
,
->
view
=
new
CMS
.
Views
.
Notification
.
Saving
({
minShown
:
1000
,
maxShown
:
2000
})
view
=
new
CMS
.
Views
.
Notification
.
Confirmation
({
minShown
:
1000
,
maxShown
:
2000
})
view
.
show
()
# can't hide early
...
...
cms/static/js/models/section.js
View file @
307c6c17
...
...
@@ -23,9 +23,7 @@ CMS.Models.Section = Backbone.Model.extend({
showNotification
:
function
()
{
if
(
!
this
.
msg
)
{
this
.
msg
=
new
CMS
.
Views
.
Notification
.
Saving
({
title
:
gettext
(
"Saving…"
),
closeIcon
:
false
,
minShown
:
1250
title
:
gettext
(
"Saving…"
)
});
}
this
.
msg
.
show
();
...
...
cms/static/js/views/feedback.js
View file @
307c6c17
...
...
@@ -186,3 +186,9 @@ _.each(types, function(type) {
klass
[
capitalCamel
(
intent
)]
=
subklass
;
});
});
// set more sensible defaults for Notification-Saving views
var
savingOptions
=
CMS
.
Views
.
Notification
.
Saving
.
prototype
.
options
;
savingOptions
.
minShown
=
1250
;
savingOptions
.
closeIcon
=
false
;
cms/static/js/views/textbook.js
View file @
307c6c17
...
...
@@ -120,9 +120,7 @@ CMS.Views.EditTextbook = Backbone.View.extend({
if
(
e
&&
e
.
preventDefault
)
{
e
.
preventDefault
();
}
this
.
setValues
();
var
saving
=
new
CMS
.
Views
.
Notification
.
Saving
({
title
:
gettext
(
"Saving…"
),
closeIcon
:
false
,
minShown
:
1250
title
:
gettext
(
"Saving…"
)
});
var
that
=
this
;
this
.
model
.
collection
.
save
({
...
...
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