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
7671005f
Commit
7671005f
authored
Jun 26, 2014
by
Waqas Khalid
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3770 from mlkwaqas/waqas/for578-post-selection-broken-span
Update the discussion area broken span tags
parents
35aacfb6
3b9afe7e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
2 deletions
+81
-2
common/static/coffee/spec/discussion/view/new_post_view_spec.coffee
+79
-0
common/static/coffee/src/discussion/views/new_post_view.coffee
+2
-2
No files found.
common/static/coffee/spec/discussion/view/new_post_view_spec.coffee
0 → 100644
View file @
7671005f
# -*- coding: utf-8 -*-
describe
"NewPostView"
,
->
beforeEach
->
setFixtures
(
"""
<article class="new-post-article" style="display: block;">
<div class="inner-wrapper">
<form class="new-post-form">
<div class="left-column" >
<div class="form-topic-drop">
<a href="#" aria-labelledby="topic-dropdown-label" class="topic_dropdown_button">… / TA Feedba …
<span class="drop-arrow">▾</span></a>
<div class="topic_menu_wrapper">
<ul class="topic_menu" role="menu">
<li role="menuitem">
<a href="#"><span class="category-menu-span">Basic Question Types</span></a>
<ul role="menu">
<li role="menuitem"><a href="#" class="topic"
data-discussion_id="a22e81688d154e059f9a2012a26b27af"
aria-describedby="topic-name-span-a22e81688d154e059f9a2012a26b27af"
cohorted="False">Selection from Options</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</form>
</div>
</article>
"""
)
window
.
$
$course_id
=
"edX/999/test"
spyOn
(
DiscussionUtil
,
"makeWmdEditor"
)
@
discussion
=
new
Discussion
([],
{
pages
:
1
})
@
view
=
new
NewPostView
(
el
:
$
(
".new-post-article"
),
collection
:
@
discussion
,
)
@
parent_category_text
=
@
view
.
$el
.
find
(
"ul.topic_menu li[role='menuitem'] > a"
)[
0
].
text
@
selected_option_text
=
@
view
.
$el
.
find
(
"ul.topic_menu li[role='menuitem'] > a"
)[
1
].
text
describe
"Drop down works correct"
,
->
it
"completely show parent category and sub-category"
,
->
complete_text
=
@
parent_category_text
+
" / "
+
@
selected_option_text
selected_text_width
=
@
view
.
getNameWidth
(
complete_text
)
@
view
.
maxNameWidth
=
selected_text_width
+
1
@
view
.
$el
.
find
(
"ul.topic_menu li[role='menuitem'] > a"
)[
1
].
click
()
dropdown_text
=
@
view
.
$el
.
find
(
".form-topic-drop > a"
).
text
()
expect
(
complete_text
+
' ▾'
).
toEqual
(
dropdown_text
)
it
"completely show just sub-category"
,
->
complete_text
=
@
parent_category_text
+
" / "
+
@
selected_option_text
selected_text_width
=
@
view
.
getNameWidth
(
complete_text
)
@
view
.
maxNameWidth
=
selected_text_width
-
10
@
view
.
$el
.
find
(
"ul.topic_menu li[role='menuitem'] > a"
)[
1
].
click
()
dropdown_text
=
@
view
.
$el
.
find
(
".form-topic-drop > a"
).
text
()
expect
(
dropdown_text
.
indexOf
(
"…"
)).
toEqual
(
0
)
expect
(
dropdown_text
).
toContain
(
@
selected_option_text
)
it
"partially show sub-category"
,
->
parent_width
=
@
view
.
getNameWidth
(
@
parent_category_text
)
complete_text
=
@
parent_category_text
+
" / "
+
@
selected_option_text
selected_text_width
=
@
view
.
getNameWidth
(
complete_text
)
@
view
.
maxNameWidth
=
selected_text_width
-
parent_width
@
view
.
$el
.
find
(
"ul.topic_menu li[role='menuitem'] > a"
)[
1
].
click
()
dropdown_text
=
@
view
.
$el
.
find
(
".form-topic-drop > a"
).
text
()
expect
(
dropdown_text
.
indexOf
(
"…"
)).
toEqual
(
0
)
expect
(
dropdown_text
.
lastIndexOf
(
"…"
)).
toBeGreaterThan
(
0
)
it
"broken span doesn't occur"
,
->
complete_text
=
@
parent_category_text
+
" / "
+
@
selected_option_text
selected_text_width
=
@
view
.
getNameWidth
(
complete_text
)
@
view
.
maxNameWidth
=
@
view
.
getNameWidth
(
@
selected_option_text
)
+
100
@
view
.
$el
.
find
(
"ul.topic_menu li[role='menuitem'] > a"
)[
1
].
click
()
dropdown_text
=
@
view
.
$el
.
find
(
".form-topic-drop > a"
).
text
()
expect
(
dropdown_text
.
indexOf
(
"/ span>"
)).
toEqual
(
-
1
)
common/static/coffee/src/discussion/views/new_post_view.coffee
View file @
7671005f
...
...
@@ -51,7 +51,7 @@ if Backbone?
# Set here because 1) the window might get resized and things could
# change and 2) can't set in initialize because the button is hidden
@
maxNameWidth
=
@
dropdownButton
.
width
()
*
0.9
@
maxNameWidth
=
@
dropdownButton
.
width
()
-
40
# Need a fat arrow because hideTopicDropdown is passed as a callback to bind
hideTopicDropdown
:
()
=>
...
...
@@ -81,7 +81,7 @@ if Backbone?
getFullTopicName
:
(
topicElement
)
->
name
=
topicElement
.
html
()
topicElement
.
parents
(
'ul'
).
not
(
'.topic_menu'
).
each
->
name
=
$
(
this
).
siblings
(
'a'
).
html
()
+
' / '
+
name
name
=
$
(
this
).
siblings
(
'a'
).
text
()
+
' / '
+
name
return
name
getNameWidth
:
(
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