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
Tatuya Kamada
gitlab-ce
Commits
ef5a5d0b
Commit
ef5a5d0b
authored
Jul 25, 2016
by
Luke Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidying up spec for new implementation of css ID selectors
parent
59ddf726
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
22 deletions
+38
-22
spec/features/merge_requests/diffs_spec.rb
spec/features/merge_requests/diffs_spec.rb
+38
-22
No files found.
spec/features/merge_requests/diffs_spec.rb
View file @
ef5a5d0b
...
...
@@ -30,12 +30,12 @@ feature 'Diffs URL', js: true, feature: true do
let
(
:notes_holder_input_class
)
{
'js-temp-notes-holder'
}
let
(
:notes_holder_input_xpath
)
{
'./following-sibling::*[contains(concat(" ", @class, " "), " notes_holder ")]'
}
let
(
:test_note_comment
)
{
'this is a test note!'
}
# line_holder =
//*[contains(concat(" ", @class, " "), " line_holder "]
# old_line =
child::*[contains(concat(" ", @class, " "), " line_content ") and contains(concat(" ", @class, " "), " old ")]
# new_line =
child::*[contains(concat(" ", @class, " ")," line_content ") and contains(concat(" ", @class, " ")," new ")]
# match_line =
child::*[contains(concat(" ", @class, " ")," line_content ") and contains(concat(" ", @class, " ")," match ")]
# unchanged_line =
child::*[contains(concat(" ", @class, " ")," line_content ") and not(contains(concat(" ", @class, " ")," old ")) and not(contains(concat(" ", @class, " ")," new ")) and not(contains(concat(" ", @class, " ")," match ")) and boolean(node()[1])]
# no_line =
child::*[contains(concat(" ", @class, " ")," line_content ") and not(contains(concat(" ", @class, " ")," old ")) and not(contains(concat(" ", @class, " ")," new ")) and not(contains(concat(" ", @class, " ")," match ")) and not(boolean(node()[1]))]
# line_holder =
# old_line =
# new_line =
# match_line =
# unchanged_line =
# no_line =
context
'when hovering over the parallel view diff file'
do
before
(
:each
)
do
...
...
@@ -146,35 +146,51 @@ feature 'Diffs URL', js: true, feature: true do
end
def
should_allow_commenting
(
line_holder
,
diff_side
=
nil
)
line
=
get_line
diff_side
line
=
get_line
_components
line_holder
,
diff_side
line
[
:content
].
hover
expect
(
line
[
:num
]).
to
have_css
comment_button_class
line
[
:num
].
find
(
comment_button_class
).
trigger
'click'
expect
(
line_holder
).
to
have_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
notes_holder_input
.
fill_in
'note[note]'
,
with:
test_note_comment
click_button
'Comment'
comment_on_line
line_holder
,
line
wait_for_ajax
expect
(
line_holder
).
to
have_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
).
to
have_content
test_note_comment
assert_comment_persistence
end
def
should_not_allow_commenting
(
line_holder
,
diff_side
=
nil
)
line
=
get_line
diff_side
line
=
get_line
_components
line_holder
,
diff_side
line
[
:content
].
hover
expect
(
line
[
:num
]).
not_to
have_css
comment_button_class
end
def
get_line
(
diff_side
=
nil
)
def
get_line
_components
(
line_holder
,
diff_side
=
nil
)
if
diff_side
.
nil?
{
content:
line_holder
.
first
(
'.line_content'
),
num:
line_holder
.
first
(
'.diff-line-num'
)
}
get_inline_line_components
line_holder
else
get_parallel_line_components
line_holder
,
diff_side
end
end
def
get_inline_line_components
(
line_holder
)
{
content:
line_holder
.
first
(
'.line_content'
),
num:
line_holder
.
first
(
'.diff-line-num'
)
}
end
def
get_parallel_line_components
(
line_holder
,
diff_side
=
nil
)
side_index
=
diff_side
==
'left'
?
0
:
1
{
content:
line_holder
.
all
(
'.line_content'
)[
side_index
],
num:
line_holder
.
all
(
'.diff-line-num'
)[
side_index
]
}
end
def
comment_on_line
(
line_holder
,
line
)
line
[
:num
].
find
(
comment_button_class
).
trigger
'click'
expect
(
line_holder
).
to
have_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
notes_holder_input
.
fill_in
'note[note]'
,
with:
test_note_comment
click_button
'Comment'
end
def
assert_comment_persistence
(
line_holder
)
expect
(
line_holder
).
to
have_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
).
to
have_content
test_note_comment
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