Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
20308867
Commit
20308867
authored
Aug 10, 2016
by
Luke Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Review changes
parent
0013e59f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
43 deletions
+23
-43
spec/features/merge_requests/diff_notes_spec.rb
spec/features/merge_requests/diff_notes_spec.rb
+23
-43
No files found.
spec/features/merge_requests/diff_notes_spec.rb
View file @
20308867
...
@@ -22,129 +22,109 @@ feature 'Diff notes', js: true, feature: true do
...
@@ -22,129 +22,109 @@ feature 'Diff notes', js: true, feature: true do
end
end
context
'with an old line on the left and no line on the right'
do
context
'with an old line on the left and no line on the right'
do
let
(
:line_holder
)
{
find
(
'[id="6eb14e00385d2fb284765eb1cd8d420d33d63fc9_23_22"]'
).
find
(
:xpath
,
'..'
)
}
it
'should allow commenting on the left side'
do
it
'should allow commenting on the left side'
do
should_allow_commenting
line_holder
,
'left'
should_allow_commenting
(
find
(
'[id="6eb14e00385d2fb284765eb1cd8d420d33d63fc9_23_22"]'
).
find
(
:xpath
,
'..'
),
'left'
)
end
end
it
'should not allow commenting on the right side'
do
it
'should not allow commenting on the right side'
do
should_not_allow_commenting
line_holder
,
'right'
should_not_allow_commenting
(
find
(
'[id="6eb14e00385d2fb284765eb1cd8d420d33d63fc9_23_22"]'
).
find
(
:xpath
,
'..'
),
'right'
)
end
end
end
end
context
'with no line on the left and a new line on the right'
do
context
'with no line on the left and a new line on the right'
do
let
(
:line_holder
)
{
find
(
'[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_15"]'
).
find
(
:xpath
,
'..'
)
}
it
'should not allow commenting on the left side'
do
it
'should not allow commenting on the left side'
do
should_not_allow_commenting
line_holder
,
'left'
should_not_allow_commenting
(
find
(
'[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_15"]'
).
find
(
:xpath
,
'..'
),
'left'
)
end
end
it
'should allow commenting on the right side'
do
it
'should allow commenting on the right side'
do
should_allow_commenting
line_holder
,
'right'
should_allow_commenting
(
find
(
'[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_15_15"]'
).
find
(
:xpath
,
'..'
),
'right'
)
end
end
end
end
context
'with an old line on the left and a new line on the right'
do
context
'with an old line on the left and a new line on the right'
do
let
(
:line_holder
)
{
find
(
'[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_9_9"]'
).
find
(
:xpath
,
'..'
)
}
it
'should allow commenting on the left side'
do
it
'should allow commenting on the left side'
do
should_allow_commenting
line_holder
,
'left'
should_allow_commenting
(
find
(
'[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_9_9"]'
).
find
(
:xpath
,
'..'
),
'left'
)
end
end
it
'should allow commenting on the right side'
do
it
'should allow commenting on the right side'
do
should_allow_commenting
line_holder
,
'right'
should_allow_commenting
(
find
(
'[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_9_9"]'
).
find
(
:xpath
,
'..'
),
'right'
)
end
end
end
end
context
'with an unchanged line on the left and an unchanged line on the right'
do
context
'with an unchanged line on the left and an unchanged line on the right'
do
let
(
:line_holder
)
{
first
(
'[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_7_7"]'
).
find
(
:xpath
,
'..'
)
}
it
'should allow commenting on the left side'
do
it
'should allow commenting on the left side'
do
should_allow_commenting
line_holder
,
'left'
should_allow_commenting
(
first
(
'[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_7_7"]'
).
find
(
:xpath
,
'..'
),
'left'
)
end
end
it
'should allow commenting on the right side'
do
it
'should allow commenting on the right side'
do
should_allow_commenting
line_holder
,
'right'
should_allow_commenting
(
first
(
'[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_7_7"]'
).
find
(
:xpath
,
'..'
),
'right'
)
end
end
end
end
context
'with a match line'
do
context
'with a match line'
do
let
(
:line_holder
)
{
first
(
'.match'
).
find
(
:xpath
,
'..'
)
}
it
'should not allow commenting on the left side'
do
it
'should not allow commenting on the left side'
do
should_not_allow_commenting
line_holder
,
'left'
should_not_allow_commenting
(
first
(
'.match'
).
find
(
:xpath
,
'..'
),
'left'
)
end
end
it
'should not allow commenting on the right side'
do
it
'should not allow commenting on the right side'
do
should_not_allow_commenting
line_holder
,
'right'
should_not_allow_commenting
(
first
(
'.match'
).
find
(
:xpath
,
'..'
),
'right'
)
end
end
end
end
end
end
context
'when hovering over the inline view diff file'
do
context
'when hovering over the inline view diff file'
do
let
(
:comment_button_class
)
{
'.add-diff-note'
}
before
do
before
(
:each
)
do
visit
diffs_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
)
visit
diffs_namespace_project_merge_request_path
(
@project
.
namespace
,
@project
,
@merge_request
)
click_link
'Inline'
click_link
'Inline'
end
end
context
'with a new line'
do
context
'with a new line'
do
let
(
:line_holder
)
{
find
(
'[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"]'
)
}
it
'should allow commenting'
do
it
'should allow commenting'
do
should_allow_commenting
line_holder
should_allow_commenting
(
find
(
'[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9"]'
))
end
end
end
end
context
'with an old line'
do
context
'with an old line'
do
let
(
:line_holder
)
{
find
(
'[id="6eb14e00385d2fb284765eb1cd8d420d33d63fc9_22_22"]'
)
}
it
'should allow commenting'
do
it
'should allow commenting'
do
should_allow_commenting
line_holder
should_allow_commenting
(
find
(
'[id="6eb14e00385d2fb284765eb1cd8d420d33d63fc9_22_22"]'
))
end
end
end
end
context
'with an unchanged line'
do
context
'with an unchanged line'
do
let
(
:line_holder
)
{
find
(
'[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_7_7"]'
)
}
it
'should allow commenting'
do
it
'should allow commenting'
do
should_allow_commenting
line_holder
should_allow_commenting
(
find
(
'[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd_7_7"]'
))
end
end
end
end
context
'with a match line'
do
context
'with a match line'
do
let
(
:line_holder
)
{
first
(
'.match'
)
}
it
'should not allow commenting'
do
it
'should not allow commenting'
do
should_not_allow_commenting
line_holder
should_not_allow_commenting
(
first
(
'.match'
))
end
end
end
end
end
end
def
should_allow_commenting
(
line_holder
,
diff_side
=
nil
)
def
should_allow_commenting
(
line_holder
,
diff_side
=
nil
)
line
=
get_line_components
line_holder
,
diff_side
line
=
get_line_components
(
line_holder
,
diff_side
)
line
[
:content
].
hover
line
[
:content
].
hover
expect
(
line
[
:num
]).
to
have_css
comment_button_class
expect
(
line
[
:num
]).
to
have_css
comment_button_class
comment_on_line
line_holder
,
line
comment_on_line
(
line_holder
,
line
)
wait_for_ajax
wait_for_ajax
assert_comment_persistence
line_holder
assert_comment_persistence
(
line_holder
)
end
end
def
should_not_allow_commenting
(
line_holder
,
diff_side
=
nil
)
def
should_not_allow_commenting
(
line_holder
,
diff_side
=
nil
)
line
=
get_line_components
line_holder
,
diff_side
line
=
get_line_components
(
line_holder
,
diff_side
)
line
[
:content
].
hover
line
[
:content
].
hover
expect
(
line
[
:num
]).
not_to
have_css
comment_button_class
expect
(
line
[
:num
]).
not_to
have_css
comment_button_class
end
end
def
get_line_components
(
line_holder
,
diff_side
=
nil
)
def
get_line_components
(
line_holder
,
diff_side
=
nil
)
if
diff_side
.
nil?
if
diff_side
.
nil?
get_inline_line_components
line_holder
get_inline_line_components
(
line_holder
)
else
else
get_parallel_line_components
line_holder
,
diff_side
get_parallel_line_components
(
line_holder
,
diff_side
)
end
end
end
end
...
@@ -162,7 +142,7 @@ feature 'Diff notes', js: true, feature: true do
...
@@ -162,7 +142,7 @@ feature 'Diff notes', js: true, feature: true do
expect
(
line_holder
).
to
have_xpath
notes_holder_input_xpath
expect
(
line_holder
).
to
have_xpath
notes_holder_input_xpath
notes_holder_input
=
line_holder
.
find
(
:xpath
,
notes_holder_input_xpath
)
notes_holder_input
=
line_holder
.
find
(
:xpath
,
notes_holder_input_xpath
)
expect
(
notes_holder_input
[
:class
]
.
include?
notes_holder_input_class
).
to
be
true
expect
(
notes_holder_input
[
:class
]
).
to
include
(
notes_holder_input_class
)
notes_holder_input
.
fill_in
'note[note]'
,
with:
test_note_comment
notes_holder_input
.
fill_in
'note[note]'
,
with:
test_note_comment
click_button
'Comment'
click_button
'Comment'
...
@@ -172,7 +152,7 @@ feature 'Diff notes', js: true, feature: true do
...
@@ -172,7 +152,7 @@ feature 'Diff notes', js: true, feature: true do
expect
(
line_holder
).
to
have_xpath
notes_holder_input_xpath
expect
(
line_holder
).
to
have_xpath
notes_holder_input_xpath
notes_holder_saved
=
line_holder
.
find
(
:xpath
,
notes_holder_input_xpath
)
notes_holder_saved
=
line_holder
.
find
(
:xpath
,
notes_holder_input_xpath
)
expect
(
notes_holder_saved
[
:class
]
.
include?
notes_holder_input_class
).
to
be
false
expect
(
notes_holder_saved
[
:class
]
).
not_to
include
(
notes_holder_input_class
)
expect
(
notes_holder_saved
).
to
have_content
test_note_comment
expect
(
notes_holder_saved
).
to
have_content
test_note_comment
end
end
end
end
...
...
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