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
c929cdb5
Commit
c929cdb5
authored
Aug 14, 2015
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an additional test case related to re-fetching data.
parent
1d01da07
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
9 deletions
+29
-9
common/static/common/js/spec_helpers/ajax_helpers.js
+1
-0
lms/djangoapps/teams/static/teams/js/collections/topic.js
+2
-2
lms/djangoapps/teams/static/teams/js/spec/collections/topic_collection_spec.js
+0
-1
lms/djangoapps/teams/static/teams/js/spec/views/my_teams_spec.js
+1
-1
lms/djangoapps/teams/static/teams/js/spec/views/topics_spec.js
+25
-5
No files found.
common/static/common/js/spec_helpers/ajax_helpers.js
View file @
c929cdb5
...
...
@@ -83,6 +83,7 @@ define(['sinon', 'underscore', 'URI'], function(sinon, _, URI) {
requestIndex
=
requests
.
length
-
1
;
}
request
=
requests
[
requestIndex
];
expect
(
new
URI
(
request
.
url
).
path
()).
toEqual
(
expectedUrl
);
parameters
=
new
URI
(
request
.
url
).
query
(
true
);
delete
parameters
.
_
;
// Ignore the cache-busting argument
expect
(
parameters
).
toEqual
(
expectedParameters
);
...
...
lms/djangoapps/teams/static/teams/js/collections/topic.js
View file @
c929cdb5
;(
function
(
define
)
{
'use strict'
;
define
([
'teams/js/collections/base'
,
'teams/js/models/topic'
,
'gettext'
],
function
(
BaseCollection
,
TopicModel
,
gettext
)
{
define
([
'teams/js/collections/base'
,
'teams/js/models/topic'
,
'gettext'
,
'underscore'
],
function
(
BaseCollection
,
TopicModel
,
gettext
,
_
)
{
var
TopicCollection
=
BaseCollection
.
extend
({
initialize
:
function
(
topics
,
options
)
{
var
self
=
this
;
...
...
lms/djangoapps/teams/static/teams/js/spec/collections/topic_collection_spec.js
View file @
c929cdb5
...
...
@@ -7,7 +7,6 @@ define(['backbone', 'URI', 'underscore', 'common/js/spec_helpers/ajax_helpers',
topicCollection
=
new
TopicCollection
(
{
"count"
:
6
,
"num_pages"
:
2
,
"current_page"
:
1
,
"start"
:
0
,
"results"
:
[
...
...
lms/djangoapps/teams/static/teams/js/spec/views/my_teams_spec.js
View file @
c929cdb5
...
...
@@ -64,7 +64,7 @@ define([
myTeamsView
.
render
();
AjaxHelpers
.
expectJsonRequestURL
(
requests
,
'
foo
'
,
'
api/teams/team_memberships
'
,
{
expand
:
'team'
,
username
:
'testUser'
,
...
...
lms/djangoapps/teams/static/teams/js/spec/views/topics_spec.js
View file @
c929cdb5
define
([
'backbone'
,
'teams/js/collections/topic'
,
'teams/js/views/topics'
,
'teams/js/spec_helpers/team_spec_helpers'
],
function
(
Backbone
,
TopicCollection
,
TopicsView
,
TeamSpec
Helpers
)
{
'backbone'
,
'
underscore'
,
'
teams/js/collections/topic'
,
'teams/js/views/topics'
,
'teams/js/spec_helpers/team_spec_helpers'
,
'common/js/spec_helpers/ajax_helpers'
],
function
(
Backbone
,
_
,
TopicCollection
,
TopicsView
,
TeamSpecHelpers
,
Ajax
Helpers
)
{
'use strict'
;
describe
(
'TopicsView'
,
function
()
{
var
initialTopics
,
topicCollection
,
createTopicsView
,
...
...
@@ -33,12 +33,14 @@ define([
"num_pages"
:
2
,
"current_page"
:
1
,
"start"
:
0
,
"results"
:
initialTopics
"results"
:
initialTopics
,
"sort_order"
:
"name"
},
{
teamEvents
:
TeamSpecHelpers
.
teamEvents
,
course_id
:
'my/course/id'
,
parse
:
true
parse
:
true
,
url
:
'api/teams/topics'
}
);
});
...
...
@@ -57,5 +59,23 @@ define([
expect
(
footerEl
.
text
()).
toMatch
(
'1
\\
s+out of
\\
s+
\
/
\\
s+2'
);
expect
(
footerEl
).
not
.
toHaveClass
(
'hidden'
);
});
it
(
'refreshes the topics when a team is created'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
),
topicsView
=
createTopicsView
();
topicsView
.
collection
.
teamEvents
.
trigger
(
'teams:update'
,
{
action
:
'create'
});
topicsView
.
render
();
AjaxHelpers
.
expectJsonRequestURL
(
requests
,
'api/teams/topics'
,
{
course_id
:
'my/course/id'
,
page
:
'1'
,
page_size
:
'5'
,
// currently the page size is determined by the size of the collection
order_by
:
'name'
}
);
});
});
});
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