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
4c4476a7
Commit
4c4476a7
authored
Aug 05, 2016
by
Brian Jacobel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix lint issues on feature branch
parent
a60d456f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
84 additions
and
91 deletions
+84
-91
common/static/common/js/discussion/views/discussion_thread_list_view.js
+47
-41
common/static/common/js/spec/discussion/view/discussion_thread_list_view_spec.js
+29
-33
common/static/common/js/spec_helpers/discussion_spec_helper.js
+0
-0
lms/djangoapps/discussion/static/discussion/js/discussion_board_factory.js
+1
-1
lms/djangoapps/discussion/static/discussion/js/discussion_profile_page_factory.js
+3
-4
lms/djangoapps/discussion/static/discussion/js/spec/views/discussion_user_profile_view_spec.js
+1
-9
lms/djangoapps/discussion/static/discussion/js/views/discussion_fake_breadcrumbs.js
+1
-1
lms/static/js/spec/courseware/link_clicked_events_spec.js
+1
-1
lms/static/lms/js/spec/main.js
+1
-1
No files found.
common/static/common/js/discussion/views/discussion_thread_list_view.js
View file @
4c4476a7
This diff is collapsed.
Click to expand it.
common/static/common/js/spec/discussion/view/discussion_thread_list_view_spec.js
View file @
4c4476a7
/* globals
Discussion, DiscussionCourseSettings, DiscussionViewSpecHelper, DiscussionSpecHelper,
_,
Discussion, DiscussionCourseSettings, DiscussionViewSpecHelper, DiscussionSpecHelper,
DiscussionThreadListView, DiscussionUtil, Thread
*/
(
function
()
{
...
...
@@ -156,22 +156,22 @@
return
expect
(
this
.
view
.
$
(
'.forum-nav-filter-main-control'
).
val
()).
toEqual
(
'all'
);
});
checkThreadsOrdering
=
function
(
view
,
sort
_o
rder
,
type
)
{
checkThreadsOrdering
=
function
(
view
,
sort
O
rder
,
type
)
{
expect
(
view
.
$el
.
find
(
'.forum-nav-thread'
).
children
().
length
).
toEqual
(
4
);
expect
(
view
.
$el
.
find
(
'.forum-nav-thread:nth-child(1) .forum-nav-thread-title'
).
text
())
.
toEqual
(
sort
_o
rder
[
0
]);
.
toEqual
(
sort
O
rder
[
0
]);
expect
(
view
.
$el
.
find
(
'.forum-nav-thread:nth-child(2) .forum-nav-thread-title'
).
text
())
.
toEqual
(
sort
_o
rder
[
1
]);
.
toEqual
(
sort
O
rder
[
1
]);
expect
(
view
.
$el
.
find
(
'.forum-nav-thread:nth-child(3) .forum-nav-thread-title'
).
text
())
.
toEqual
(
sort
_o
rder
[
2
]);
.
toEqual
(
sort
O
rder
[
2
]);
expect
(
view
.
$el
.
find
(
'.forum-nav-thread:nth-child(4) .forum-nav-thread-title'
).
text
())
.
toEqual
(
sort
_o
rder
[
3
]);
.
toEqual
(
sort
O
rder
[
3
]);
return
expect
(
view
.
$el
.
find
(
'.forum-nav-sort-control'
).
val
()).
toEqual
(
type
);
};
describe
(
'thread rendering should be correct'
,
function
()
{
var
checkRender
;
checkRender
=
function
(
threads
,
type
,
sort
_o
rder
)
{
checkRender
=
function
(
threads
,
type
,
sort
O
rder
)
{
var
discussion
,
view
;
discussion
=
new
Discussion
(
_
.
map
(
threads
,
function
(
thread
)
{
return
new
Thread
(
thread
);
...
...
@@ -181,56 +181,56 @@
});
view
=
makeView
(
discussion
);
view
.
render
();
checkThreadsOrdering
(
view
,
sort
_o
rder
,
type
);
checkThreadsOrdering
(
view
,
sort
O
rder
,
type
);
expect
(
view
.
$el
.
find
(
'.forum-nav-thread-comments-count:visible'
).
length
)
.
toEqual
(
type
===
'votes'
?
0
:
4
);
expect
(
view
.
$el
.
find
(
'.forum-nav-thread-votes-count:visible'
).
length
)
.
toEqual
(
type
===
'votes'
?
4
:
0
);
if
(
type
===
'votes'
)
{
return
expect
(
_
.
map
(
view
.
$el
.
find
(
'.forum-nav-thread-votes-count'
),
function
(
element
)
{
expect
(
_
.
map
(
view
.
$el
.
find
(
'.forum-nav-thread-votes-count'
),
function
(
element
)
{
return
$
(
element
).
text
().
trim
();
})).
toEqual
([
'+25 votes'
,
'+20 votes'
,
'+42 votes'
,
'+12 votes'
]);
}
};
it
(
'with sort preference activity'
,
function
()
{
return
checkRender
(
this
.
threads
,
'activity'
,
[
'Thread1'
,
'Thread2'
,
'Thread3'
,
'Thread4'
]);
checkRender
(
this
.
threads
,
'activity'
,
[
'Thread1'
,
'Thread2'
,
'Thread3'
,
'Thread4'
]);
});
it
(
'with sort preference votes'
,
function
()
{
return
checkRender
(
this
.
threads
,
'votes'
,
[
'Thread4'
,
'Thread1'
,
'Thread2'
,
'Thread3'
]);
checkRender
(
this
.
threads
,
'votes'
,
[
'Thread4'
,
'Thread1'
,
'Thread2'
,
'Thread3'
]);
});
it
(
'with sort preference comments'
,
function
()
{
return
checkRender
(
this
.
threads
,
'comments'
,
[
'Thread1'
,
'Thread4'
,
'Thread3'
,
'Thread2'
]);
checkRender
(
this
.
threads
,
'comments'
,
[
'Thread1'
,
'Thread4'
,
'Thread3'
,
'Thread2'
]);
});
});
describe
(
'Sort change should be correct'
,
function
()
{
var
changeSorting
;
changeSorting
=
function
(
threads
,
selected
_type
,
new_type
,
sort_o
rder
)
{
var
discussion
,
sortControl
,
sorted
_t
hreads
,
view
;
changeSorting
=
function
(
threads
,
selected
Type
,
newType
,
sortO
rder
)
{
var
discussion
,
sortControl
,
sorted
T
hreads
,
view
;
discussion
=
new
Discussion
(
_
.
map
(
threads
,
function
(
thread
)
{
return
new
Thread
(
thread
);
}),
{
pages
:
1
,
sort
:
selected
_t
ype
sort
:
selected
T
ype
});
view
=
makeView
(
discussion
);
view
.
render
();
sortControl
=
view
.
$el
.
find
(
'.forum-nav-sort-control'
);
expect
(
sortControl
.
val
()).
toEqual
(
selected
_t
ype
);
sorted
_t
hreads
=
[];
if
(
new
_t
ype
===
'activity'
)
{
sorted
_t
hreads
=
[
threads
[
0
],
threads
[
3
],
threads
[
1
],
threads
[
2
]];
}
else
if
(
new
_t
ype
===
'comments'
)
{
sorted
_t
hreads
=
[
threads
[
0
],
threads
[
3
],
threads
[
2
],
threads
[
1
]];
}
else
if
(
new
_t
ype
===
'votes'
)
{
sorted
_t
hreads
=
[
threads
[
3
],
threads
[
0
],
threads
[
1
],
threads
[
2
]];
expect
(
sortControl
.
val
()).
toEqual
(
selected
T
ype
);
sorted
T
hreads
=
[];
if
(
new
T
ype
===
'activity'
)
{
sorted
T
hreads
=
[
threads
[
0
],
threads
[
3
],
threads
[
1
],
threads
[
2
]];
}
else
if
(
new
T
ype
===
'comments'
)
{
sorted
T
hreads
=
[
threads
[
0
],
threads
[
3
],
threads
[
2
],
threads
[
1
]];
}
else
if
(
new
T
ype
===
'votes'
)
{
sorted
T
hreads
=
[
threads
[
3
],
threads
[
0
],
threads
[
1
],
threads
[
2
]];
}
$
.
ajax
.
and
.
callFake
(
function
(
params
)
{
params
.
success
({
'discussion_data'
:
sorted_t
hreads
,
discussion_data
:
sortedT
hreads
,
page
:
1
,
num_pages
:
1
});
...
...
@@ -239,9 +239,9 @@
}
};
});
sortControl
.
val
(
new
_t
ype
).
change
();
sortControl
.
val
(
new
T
ype
).
change
();
expect
(
$
.
ajax
).
toHaveBeenCalled
();
checkThreadsOrdering
(
view
,
sort
_order
,
new_t
ype
);
checkThreadsOrdering
(
view
,
sort
Order
,
newT
ype
);
};
it
(
'with sort preference activity'
,
function
()
{
...
...
@@ -290,7 +290,7 @@
});
it
(
'renders search alert with custom class'
,
function
()
{
var
foo
,
messages
;
var
messages
;
testAlertMessages
([]);
this
.
view
.
addSearchAlert
(
'foo'
,
'custom-class'
);
...
...
@@ -299,7 +299,7 @@
expect
(
messages
[
0
].
text
).
toEqual
(
'foo'
);
expect
(
messages
[
0
].
css_class
).
toEqual
(
'search-alert custom-class'
);
foo
=
this
.
view
.
addSearchAlert
(
'bar'
,
'other-class'
);
this
.
view
.
addSearchAlert
(
'bar'
,
'other-class'
);
messages
=
getAlertMessagesAndClasses
();
expect
(
messages
.
length
).
toEqual
(
2
);
...
...
@@ -572,11 +572,7 @@
});
describe
(
'when shown'
,
function
()
{
beforeEach
(
function
()
{
return
$
(
'.forum-nav-browse'
).
click
();
});
it
(
'should hide when header button is clicked'
,
function
()
{
it
(
'should show again when header button is clicked'
,
function
()
{
$
(
'.forum-nav-browse'
).
click
();
return
expectBrowseMenuVisible
(
false
);
});
...
...
common/static/common/js/spec_helpers/discussion_spec_helper.js
View file @
4c4476a7
This diff is collapsed.
Click to expand it.
lms/djangoapps/discussion/static/discussion/js/discussion_board_factory.js
View file @
4c4476a7
...
...
@@ -55,7 +55,7 @@
BreadcrumbsModel
=
Backbone
.
Model
.
extend
({
defaults
:
{
contents
:
[]
,
contents
:
[]
}
});
...
...
lms/djangoapps/discussion/static/discussion/js/discussion_profile_page_factory.js
View file @
4c4476a7
...
...
@@ -11,14 +11,13 @@
numPages
=
options
.
numPages
;
// Roles are not included in user profile page, but they are not used for anything
window
.
DiscussionUtil
.
loadRoles
({
'Moderator'
:
[],
'Administrator'
:
[],
Moderator
:
[],
Administrator
:
[],
'Community TA'
:
[]
});
window
.
$$course_id
=
options
.
courseId
;
window
.
user
=
new
window
.
DiscussionUser
(
userInfo
);
// jshint nonew:false
new
DiscussionUserProfileView
({
new
DiscussionUserProfileView
({
// eslint-disable-line no-new
el
:
$element
,
collection
:
threads
,
page
:
page
,
...
...
lms/djangoapps/discussion/static/discussion/js/spec/views/discussion_user_profile_view_spec.js
View file @
4c4476a7
...
...
@@ -62,15 +62,7 @@ define(
});
describe
(
'pagination rendering should be correct'
,
function
()
{
var
baseUri
,
checkRender
,
pageInfo
;
baseUri
=
URI
(
window
.
location
);
pageInfo
=
function
(
page
)
{
return
{
url
:
baseUri
.
clone
().
addSearch
(
'page'
,
page
).
toString
(),
number
:
page
};
};
checkRender
=
function
(
params
)
{
var
checkRender
=
function
(
params
)
{
var
getPageNumber
,
paginator
,
view
;
view
=
makeView
([],
params
.
page
,
params
.
numPages
);
paginator
=
view
.
$
(
'.discussion-paginator'
);
...
...
lms/djangoapps/discussion/static/discussion/js/views/discussion_fake_breadcrumbs.js
View file @
4c4476a7
...
...
@@ -12,7 +12,7 @@
define
([
'backbone'
,
'edx-ui-toolkit/js/utils/html-utils'
,
'text!discussion/templates/fake-breadcrumbs.underscore'
,
'text!discussion/templates/fake-breadcrumbs.underscore'
],
function
(
Backbone
,
HtmlUtils
,
breadcrumbsTemplate
)
{
var
DiscussionFakeBreadcrumbs
=
Backbone
.
View
.
extend
({
...
...
lms/static/js/spec/courseware/link_clicked_events_spec.js
View file @
4c4476a7
...
...
@@ -12,7 +12,7 @@ define(['jquery', 'logger', 'js/courseware/courseware_factory'], function($, Log
$
(
'.external-link'
).
click
();
expect
(
Logger
.
log
).
toHaveBeenCalledWith
(
'edx.ui.lms.link_clicked'
,
{
target_url
:
'http://example.com/'
,
current_url
:
'http://'
+
window
.
location
.
host
+
'/context.html'
current_url
:
window
.
location
.
toString
()
});
});
...
...
lms/static/lms/js/spec/main.js
View file @
4c4476a7
...
...
@@ -8,7 +8,7 @@
paths
:
{
'gettext'
:
'xmodule_js/common_static/js/test/i18n'
,
'codemirror'
:
'xmodule_js/common_static/js/vendor/CodeMirror/codemirror'
,
'jquery'
:
'common/js/vendor/jquery'
,
jquery
:
'common/js/vendor/jquery'
,
'jquery-migrate'
:
'common/js/vendor/jquery-migrate'
,
'jquery.ui'
:
'xmodule_js/common_static/js/vendor/jquery-ui.min'
,
'jquery.eventDrag'
:
'xmodule_js/common_static/js/vendor/jquery.event.drag-2.2'
,
...
...
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