Commit ac98d74a authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'file_css' into 'master'

Better css class names for diff elements
parents 05c5b770 76ad6046
...@@ -117,11 +117,11 @@ $ -> ...@@ -117,11 +117,11 @@ $ ->
# Commit show suppressed diff # Commit show suppressed diff
$(".content").on "click", ".supp_diff_link", -> $(".diff-content").on "click", ".supp_diff_link", ->
$(@).next('table').show() $(@).next('table').show()
$(@).remove() $(@).remove()
$(".content").on "click", ".js-details-expand", -> $(".diff-content").on "click", ".js-details-expand", ->
$(@).next('.js-details-contain').removeClass("hide") $(@).next('.js-details-contain').removeClass("hide")
$(@).remove() $(@).remove()
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
@import "sections/header.scss"; @import "sections/header.scss";
@import "sections/nav.scss"; @import "sections/nav.scss";
@import "sections/commits.scss"; @import "sections/commits.scss";
@import "sections/diff.scss";
@import "sections/issues.scss"; @import "sections/issues.scss";
@import "sections/projects.scss"; @import "sections/projects.scss";
@import "sections/snippets.scss"; @import "sections/snippets.scss";
......
...@@ -10,336 +10,6 @@ ...@@ -10,336 +10,6 @@
} }
} }
.file {
border: 1px solid #CCC;
margin-bottom: 1em;
.header {
@extend .clearfix;
background: #DDD;
border-bottom: 1px solid #CCC;
padding: 5px 5px 5px 10px;
color: #555;
> span {
font-family: $monospace_font;
font-size: 14px;
line-height: 2;
}
.diff-btn-group {
float: right;
.btn {
background-color: #EEE;
color: #666;
font-weight: bolder;
}
}
.commit-short-id {
font-family: $monospace_font;
font-size: smaller;
}
.file-mode {
font-family: $monospace_font;
}
}
.content {
overflow: auto;
overflow-y: hidden;
background: #FFF;
color: #333;
font-size: 12px;
.old {
span.idiff {
background-color: #FAA;
}
}
.new {
span.idiff {
background-color: #AFA;
}
}
table {
width: 100%;
font-family: $monospace_font;
border: none;
margin: 0px;
padding: 0px;
td {
line-height: 18px;
font-size: 12px;
}
}
.old_line, .new_line, .diff_line {
margin: 0px;
padding: 0px;
border: none;
background: #EEE;
color: #666;
padding: 0px 5px;
border-right: 1px solid #ccc;
text-align: right;
min-width: 35px;
max-width: 50px;
width: 35px;
@include user-select(none);
a {
float: left;
width: 35px;
font-weight: normal;
color: #666;
&:hover {
text-decoration: underline;
}
}
&.new {
background: #CFD;
}
&.old {
background: #FDD;
}
}
.diff_line {
padding: 0;
}
.line_holder {
&.old .old_line,
&.old .new_line {
background: #FCC;
border-color: #E7BABA;
}
&.new .old_line,
&.new .new_line {
background: #CFC;
border-color: #B9ECB9;
}
}
.line_content {
display: block;
white-space: pre;
height: 18px;
margin: 0px;
padding: 0px 0.5em;
border: none;
&.new {
background: #CFD;
}
&.old {
background: #FDD;
}
&.matched {
color: #ccc;
background: #fafafa;
}
&.parallel {
display: table-cell;
overflow: hidden;
width: 50%;
}
}
}
.image {
background: #ddd;
text-align: center;
padding: 30px;
.wrap{
display: inline-block;
}
.frame {
display: inline-block;
background-color: #fff;
line-height: 0;
img{
border: 1px solid #FFF;
background: url('trans_bg.gif');
max-width: 100%;
}
&.deleted {
border: 1px solid $deleted;
}
&.added {
border: 1px solid $added;
}
}
.image-info{
font-size: 12px;
margin: 5px 0 0 0;
color: grey;
}
.view.swipe{
position: relative;
.swipe-frame{
display: block;
margin: auto;
position: relative;
}
.swipe-wrap{
overflow: hidden;
border-left: 1px solid #999;
position: absolute;
display: block;
top: 13px;
right: 7px;
}
.frame{
top: 0;
right: 0;
position: absolute;
&.deleted{
margin: 0;
display: block;
top: 13px;
right: 7px;
}
}
.swipe-bar{
display: block;
height: 100%;
width: 15px;
z-index: 100;
position: absolute;
cursor: pointer;
&:hover{
.top-handle{
background-position: -15px 3px;
}
.bottom-handle{
background-position: -15px -11px;
}
};
.top-handle{
display: block;
height: 14px;
width: 15px;
position: absolute;
top: 0px;
background: url('swipemode_sprites.gif') 0 3px no-repeat;
}
.bottom-handle{
display: block;
height: 14px;
width: 15px;
position: absolute;
bottom: 0px;
background: url('swipemode_sprites.gif') 0 -11px no-repeat;
}
}
} //.view.swipe
.view.onion-skin{
.onion-skin-frame{
display: block;
margin: auto;
position: relative;
}
.frame.added, .frame.deleted {
position: absolute;
display: block;
top: 0px;
left: 0px;
}
.controls{
display: block;
height: 14px;
width: 300px;
z-index: 100;
position: absolute;
bottom: 0px;
left: 50%;
margin-left: -150px;
.drag-track{
display: block;
position: absolute;
left: 12px;
height: 10px;
width: 276px;
background: url('onion_skin_sprites.gif') -4px -20px repeat-x;
}
.dragger {
display: block;
position: absolute;
left: 0px;
top: 0px;
height: 14px;
width: 14px;
background: url('onion_skin_sprites.gif') 0px -34px repeat-x;
cursor: pointer;
}
.transparent {
display: block;
position: absolute;
top: 2px;
right: 0px;
height: 10px;
width: 10px;
background: url('onion_skin_sprites.gif') -2px 0px no-repeat;
}
.opaque {
display: block;
position: absolute;
top: 2px;
left: 0px;
height: 10px;
width: 10px;
background: url('onion_skin_sprites.gif') -2px -10px no-repeat;
}
}
} //.view.onion-skin
}
.view-modes{
padding: 10px;
text-align: center;
background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, #eee), to(#dfdfdf));
background-image: -webkit-linear-gradient(#eee 6.6%, #dfdfdf);
background-image: -moz-linear-gradient(#eee 6.6%, #dfdfdf);
background-image: -ms-linear-gradient(#eee 6.6%, #dfdfdf);
background-image: -o-linear-gradient(#eee 6.6%, #dfdfdf);
ul, li{
list-style: none;
margin: 0;
padding: 0;
display: inline-block;
}
li{
color: grey;
border-left: 1px solid #c1c1c1;
padding: 0 12px 0 16px;
cursor: pointer;
&:first-child{
border-left: none;
}
&:hover{
text-decoration: underline;
}
&.active{
&:hover{
text-decoration: none;
}
cursor: default;
color: #333;
}
&.disabled{
display: none;
}
}
}
}
/** COMMIT BLOCK **/ /** COMMIT BLOCK **/
.commit-title{ .commit-title{
display: block; display: block;
......
.diff-file {
border: 1px solid #CCC;
margin-bottom: 1em;
.diff-header {
@extend .clearfix;
background: #DDD;
border-bottom: 1px solid #CCC;
padding: 5px 5px 5px 10px;
color: #555;
> span {
font-family: $monospace_font;
font-size: 14px;
line-height: 2;
}
.diff-btn-group {
float: right;
.btn {
background-color: #EEE;
color: #666;
font-weight: bolder;
}
}
.commit-short-id {
font-family: $monospace_font;
font-size: smaller;
}
.file-mode {
font-family: $monospace_font;
}
}
.diff-content {
overflow: auto;
overflow-y: hidden;
background: #FFF;
color: #333;
font-size: 12px;
.old {
span.idiff {
background-color: #FAA;
}
}
.new {
span.idiff {
background-color: #AFA;
}
}
table {
width: 100%;
font-family: $monospace_font;
border: none;
margin: 0px;
padding: 0px;
td {
line-height: 18px;
font-size: 12px;
}
}
.old_line, .new_line, .diff_line {
margin: 0px;
padding: 0px;
border: none;
background: #EEE;
color: #666;
padding: 0px 5px;
border-right: 1px solid #ccc;
text-align: right;
min-width: 35px;
max-width: 50px;
width: 35px;
@include user-select(none);
a {
float: left;
width: 35px;
font-weight: normal;
color: #666;
&:hover {
text-decoration: underline;
}
}
&.new {
background: #CFD;
}
&.old {
background: #FDD;
}
}
.diff_line {
padding: 0;
}
.line_holder {
&.old .old_line,
&.old .new_line {
background: #FCC;
border-color: #E7BABA;
}
&.new .old_line,
&.new .new_line {
background: #CFC;
border-color: #B9ECB9;
}
}
.line_content {
display: block;
white-space: pre;
height: 18px;
margin: 0px;
padding: 0px 0.5em;
border: none;
&.new {
background: #CFD;
}
&.old {
background: #FDD;
}
&.matched {
color: #ccc;
background: #fafafa;
}
&.parallel {
display: table-cell;
overflow: hidden;
width: 50%;
}
}
}
.image {
background: #ddd;
text-align: center;
padding: 30px;
.wrap{
display: inline-block;
}
.frame {
display: inline-block;
background-color: #fff;
line-height: 0;
img{
border: 1px solid #FFF;
background: url('trans_bg.gif');
max-width: 100%;
}
&.deleted {
border: 1px solid $deleted;
}
&.added {
border: 1px solid $added;
}
}
.image-info{
font-size: 12px;
margin: 5px 0 0 0;
color: grey;
}
.view.swipe{
position: relative;
.swipe-frame{
display: block;
margin: auto;
position: relative;
}
.swipe-wrap{
overflow: hidden;
border-left: 1px solid #999;
position: absolute;
display: block;
top: 13px;
right: 7px;
}
.frame{
top: 0;
right: 0;
position: absolute;
&.deleted{
margin: 0;
display: block;
top: 13px;
right: 7px;
}
}
.swipe-bar{
display: block;
height: 100%;
width: 15px;
z-index: 100;
position: absolute;
cursor: pointer;
&:hover{
.top-handle{
background-position: -15px 3px;
}
.bottom-handle{
background-position: -15px -11px;
}
};
.top-handle{
display: block;
height: 14px;
width: 15px;
position: absolute;
top: 0px;
background: url('swipemode_sprites.gif') 0 3px no-repeat;
}
.bottom-handle{
display: block;
height: 14px;
width: 15px;
position: absolute;
bottom: 0px;
background: url('swipemode_sprites.gif') 0 -11px no-repeat;
}
}
} //.view.swipe
.view.onion-skin{
.onion-skin-frame{
display: block;
margin: auto;
position: relative;
}
.frame.added, .frame.deleted {
position: absolute;
display: block;
top: 0px;
left: 0px;
}
.controls{
display: block;
height: 14px;
width: 300px;
z-index: 100;
position: absolute;
bottom: 0px;
left: 50%;
margin-left: -150px;
.drag-track{
display: block;
position: absolute;
left: 12px;
height: 10px;
width: 276px;
background: url('onion_skin_sprites.gif') -4px -20px repeat-x;
}
.dragger {
display: block;
position: absolute;
left: 0px;
top: 0px;
height: 14px;
width: 14px;
background: url('onion_skin_sprites.gif') 0px -34px repeat-x;
cursor: pointer;
}
.transparent {
display: block;
position: absolute;
top: 2px;
right: 0px;
height: 10px;
width: 10px;
background: url('onion_skin_sprites.gif') -2px 0px no-repeat;
}
.opaque {
display: block;
position: absolute;
top: 2px;
left: 0px;
height: 10px;
width: 10px;
background: url('onion_skin_sprites.gif') -2px -10px no-repeat;
}
}
} //.view.onion-skin
}
.view-modes{
padding: 10px;
text-align: center;
background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, #eee), to(#dfdfdf));
background-image: -webkit-linear-gradient(#eee 6.6%, #dfdfdf);
background-image: -moz-linear-gradient(#eee 6.6%, #dfdfdf);
background-image: -ms-linear-gradient(#eee 6.6%, #dfdfdf);
background-image: -o-linear-gradient(#eee 6.6%, #dfdfdf);
ul, li{
list-style: none;
margin: 0;
padding: 0;
display: inline-block;
}
li{
color: grey;
border-left: 1px solid #c1c1c1;
padding: 0 12px 0 16px;
cursor: pointer;
&:first-child{
border-left: none;
}
&:hover{
text-decoration: underline;
}
&.active{
&:hover{
text-decoration: none;
}
cursor: default;
color: #333;
}
&.disabled{
display: none;
}
}
}
}
...@@ -47,13 +47,13 @@ ul.notes { ...@@ -47,13 +47,13 @@ ul.notes {
.discussion-body { .discussion-body {
margin-left: 50px; margin-left: 50px;
.file, .diff-file,
.discussion-hidden, .discussion-hidden,
.notes { .notes {
@extend .borders; @extend .borders;
background-color: #F9F9F9; background-color: #F9F9F9;
} }
.file .notes { .diff-file .notes {
/* reset */ /* reset */
background: inherit; background: inherit;
border: none; border: none;
...@@ -114,7 +114,7 @@ ul.notes { ...@@ -114,7 +114,7 @@ ul.notes {
} }
} }
.file .notes_holder { .diff-file .notes_holder {
font-size: 13px; font-size: 13px;
line-height: 18px; line-height: 18px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
...@@ -184,7 +184,7 @@ ul.notes { ...@@ -184,7 +184,7 @@ ul.notes {
} }
} }
} }
.file .note .note-actions { .diff-file .note .note-actions {
right: 0; right: 0;
top: 0; top: 0;
} }
...@@ -195,7 +195,7 @@ ul.notes { ...@@ -195,7 +195,7 @@ ul.notes {
* Line note button on the side of diffs * Line note button on the side of diffs
*/ */
.file tr.line_holder { .diff-file tr.line_holder {
.add-diff-note { .add-diff-note {
background: url("diff_note_add.png") no-repeat left 0; background: url("diff_note_add.png") no-repeat left 0;
height: 22px; height: 22px;
...@@ -235,22 +235,25 @@ ul.notes { ...@@ -235,22 +235,25 @@ ul.notes {
.reply-btn { .reply-btn {
@extend .btn-primary; @extend .btn-primary;
} }
.file .content tr.line_holder:hover { .diff-file .diff-content {
&> td.line_content { tr.line_holder:hover {
background: $hover !important; &> td.line_content {
border-color: darken($hover, 10%) !important; background: $hover !important;
border-color: darken($hover, 10%) !important;
}
&> td.new_line,
&> td.old_line {
background: darken($hover, 4%) !important;
border-color: darken($hover, 10%) !important;
}
} }
&> td.new_line,
&> td.old_line { tr.line_holder:hover > td .line_note_link {
background: darken($hover, 4%) !important; opacity: 1.0;
border-color: darken($hover, 10%) !important; filter: alpha(opacity=100);
} }
} }
.file .content tr.line_holder:hover > td .line_note_link { .diff-file,
opacity: 1.0;
filter: alpha(opacity=100);
}
.file,
.discussion { .discussion {
.new_note { .new_note {
margin: 0; margin: 0;
......
...@@ -44,8 +44,8 @@ ...@@ -44,8 +44,8 @@
- file = project.repository.blob_at(@commit.id, diff.new_path) - file = project.repository.blob_at(@commit.id, diff.new_path)
- file = project.repository.blob_at(@commit.parent_id, diff.old_path) unless file - file = project.repository.blob_at(@commit.parent_id, diff.old_path) unless file
- next unless file - next unless file
.file{id: "diff-#{i}"} .diff-file{id: "diff-#{i}"}
.header .diff-header
- if diff.deleted_file - if diff.deleted_file
%span= diff.old_path %span= diff.old_path
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
%span.commit-short-id= @commit.short_id(6) %span.commit-short-id= @commit.short_id(6)
.content .diff-content
-# Skipp all non non-supported blobs -# Skipp all non non-supported blobs
- next unless file.respond_to?('text?') - next unless file.respond_to?('text?')
- if file.text? - if file.text?
......
...@@ -36,21 +36,17 @@ ...@@ -36,21 +36,17 @@
.discussion-body .discussion-body
- if note.for_diff_line? - if note.for_diff_line?
- if note.active? - if note.active?
.content = render "projects/notes/discussion_diff", discussion_notes: discussion_notes, note: note
.file= render "projects/notes/discussion_diff", discussion_notes: discussion_notes, note: note
- else - else
= link_to 'show outdated discussion', '#', class: 'js-show-outdated-discussion' = link_to 'show outdated discussion', '#', class: 'js-show-outdated-discussion'
%div.hide.outdated-discussion %div.hide.outdated-discussion
.content .notes{ rel: discussion_notes.first.discussion_id }
.notes{ rel: discussion_notes.first.discussion_id } = render discussion_notes
= render discussion_notes
- else - else
.content .notes{ rel: discussion_notes.first.discussion_id }
.notes{ rel: discussion_notes.first.discussion_id } = render discussion_notes
= render discussion_notes = render "projects/notes/discussion_reply_button", note: discussion_notes.first
= render "projects/notes/discussion_reply_button", note: discussion_notes.first
-# will be shown when the other one is hidden -# will be shown when the other one is hidden
.discussion-hidden.content.hide .discussion-hidden.content.hide
...@@ -59,4 +55,3 @@ ...@@ -59,4 +55,3 @@
= link_to "javascript:;", class: "js-details-target js-toggler-target" do = link_to "javascript:;", class: "js-details-target js-toggler-target" do
%i.icon-eye-open %i.icon-eye-open
Show Show
- diff = note.diff - diff = note.diff
.header .diff-file
- if diff.deleted_file .diff-header
%span= diff.old_path - if diff.deleted_file
- else %span= diff.old_path
%span= diff.new_path - else
- if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode %span= diff.new_path
%span.file-mode= "#{diff.a_mode}#{diff.b_mode}" - if diff.a_mode && diff.b_mode && diff.a_mode != diff.b_mode
%br/ %span.file-mode= "#{diff.a_mode}#{diff.b_mode}"
.content %br/
%table .diff-content
- each_diff_line_near(diff, note.diff_file_index, note.line_code) do |line, type, line_code, line_new, line_old| %table
%tr.line_holder{ id: line_code } - each_diff_line_near(diff, note.diff_file_index, note.line_code) do |line, type, line_code, line_new, line_old|
- if type == "match" %tr.line_holder{ id: line_code }
%td.old_line= "..." - if type == "match"
%td.new_line= "..." %td.old_line= "..."
%td.line_content.matched= line %td.new_line= "..."
- else %td.line_content.matched= line
%td.old_line= raw(type == "new" ? " " : line_old) - else
%td.new_line= raw(type == "old" ? " " : line_new) %td.old_line= raw(type == "new" ? " " : line_old)
%td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line}  " %td.new_line= raw(type == "old" ? " " : line_new)
%td.line_content{class: "noteable_line #{type} #{line_code}", "line_code" => line_code}= raw "#{line}  "
- if line_code == note.line_code - if line_code == note.line_code
= render "projects/notes/diff_notes_with_reply", notes: discussion_notes = render "projects/notes/diff_notes_with_reply", notes: discussion_notes
...@@ -2,7 +2,7 @@ module SharedDiffNote ...@@ -2,7 +2,7 @@ module SharedDiffNote
include Spinach::DSL include Spinach::DSL
Given 'I cancel the diff comment' do Given 'I cancel the diff comment' do
within(".file") do within(".diff-file") do
find(".js-close-discussion-note-form").click find(".js-close-discussion-note-form").click
end end
end end
...@@ -13,14 +13,14 @@ module SharedDiffNote ...@@ -13,14 +13,14 @@ module SharedDiffNote
end end
Given 'I haven\'t written any diff comment text' do Given 'I haven\'t written any diff comment text' do
within(".file") do within(".diff-file") do
fill_in "note[note]", with: "" fill_in "note[note]", with: ""
end end
end end
Given 'I leave a diff comment like "Typo, please fix"' do Given 'I leave a diff comment like "Typo, please fix"' do
find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_29_14"]').click find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_29_14"]').click
within(".file form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_29_14']") do within(".diff-file form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_29_14']") do
fill_in "note[note]", with: "Typo, please fix" fill_in "note[note]", with: "Typo, please fix"
find(".js-comment-button").trigger("click") find(".js-comment-button").trigger("click")
sleep 0.05 sleep 0.05
...@@ -29,7 +29,7 @@ module SharedDiffNote ...@@ -29,7 +29,7 @@ module SharedDiffNote
Given 'I preview a diff comment text like "Should fix it :smile:"' do Given 'I preview a diff comment text like "Should fix it :smile:"' do
find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_29_14"]').click find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_29_14"]').click
within(".file form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_29_14']") do within(".diff-file form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_29_14']") do
fill_in "note[note]", with: "Should fix it :smile:" fill_in "note[note]", with: "Should fix it :smile:"
find(".js-note-preview-button").trigger("click") find(".js-note-preview-button").trigger("click")
end end
...@@ -38,7 +38,7 @@ module SharedDiffNote ...@@ -38,7 +38,7 @@ module SharedDiffNote
Given 'I preview another diff comment text like "DRY this up"' do Given 'I preview another diff comment text like "DRY this up"' do
find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_57_41"]').click find('a[data-line-code="586fb7c4e1add2d4d24e27566ed7064680098646_57_41"]').click
within(".file form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_57_41']") do within(".diff-file form[rel$='586fb7c4e1add2d4d24e27566ed7064680098646_57_41']") do
fill_in "note[note]", with: "DRY this up" fill_in "note[note]", with: "DRY this up"
find(".js-note-preview-button").trigger("click") find(".js-note-preview-button").trigger("click")
end end
...@@ -53,13 +53,13 @@ module SharedDiffNote ...@@ -53,13 +53,13 @@ module SharedDiffNote
end end
Given 'I write a diff comment like ":-1: I don\'t like this"' do Given 'I write a diff comment like ":-1: I don\'t like this"' do
within(".file") do within(".diff-file") do
fill_in "note[note]", with: ":-1: I don\'t like this" fill_in "note[note]", with: ":-1: I don\'t like this"
end end
end end
Given 'I submit the diff comment' do Given 'I submit the diff comment' do
within(".file") do within(".diff-file") do
click_button("Add Comment") click_button("Add Comment")
end end
end end
...@@ -67,49 +67,49 @@ module SharedDiffNote ...@@ -67,49 +67,49 @@ module SharedDiffNote
Then 'I should not see the diff comment form' do Then 'I should not see the diff comment form' do
within(".file") do within(".diff-file") do
page.should_not have_css("form.new_note") page.should_not have_css("form.new_note")
end end
end end
Then 'I should not see the diff comment preview button' do Then 'I should not see the diff comment preview button' do
within(".file") do within(".diff-file") do
page.should have_css(".js-note-preview-button", visible: false) page.should have_css(".js-note-preview-button", visible: false)
end end
end end
Then 'I should not see the diff comment text field' do Then 'I should not see the diff comment text field' do
within(".file") do within(".diff-file") do
page.should have_css(".js-note-text", visible: false) page.should have_css(".js-note-text", visible: false)
end end
end end
Then 'I should only see one diff form' do Then 'I should only see one diff form' do
within(".file") do within(".diff-file") do
page.should have_css("form.new_note", count: 1) page.should have_css("form.new_note", count: 1)
end end
end end
Then 'I should see a diff comment form with ":-1: I don\'t like this"' do Then 'I should see a diff comment form with ":-1: I don\'t like this"' do
within(".file") do within(".diff-file") do
page.should have_field("note[note]", with: ":-1: I don\'t like this") page.should have_field("note[note]", with: ":-1: I don\'t like this")
end end
end end
Then 'I should see a diff comment saying "Typo, please fix"' do Then 'I should see a diff comment saying "Typo, please fix"' do
within(".file .note") do within(".diff-file .note") do
page.should have_content("Typo, please fix") page.should have_content("Typo, please fix")
end end
end end
Then 'I should see a discussion reply button' do Then 'I should see a discussion reply button' do
within(".file") do within(".diff-file") do
page.should have_link("Reply") page.should have_link("Reply")
end end
end end
Then 'I should see a temporary diff comment form' do Then 'I should see a temporary diff comment form' do
within(".file") do within(".diff-file") do
page.should have_css(".js-temp-notes-holder form.new_note") page.should have_css(".js-temp-notes-holder form.new_note")
end end
end end
...@@ -119,37 +119,37 @@ module SharedDiffNote ...@@ -119,37 +119,37 @@ module SharedDiffNote
end end
Then 'I should see an empty diff comment form' do Then 'I should see an empty diff comment form' do
within(".file") do within(".diff-file") do
page.should have_field("note[note]", with: "") page.should have_field("note[note]", with: "")
end end
end end
Then 'I should see the cancel comment button' do Then 'I should see the cancel comment button' do
within(".file form") do within(".diff-file form") do
page.should have_css(".js-close-discussion-note-form", text: "Cancel") page.should have_css(".js-close-discussion-note-form", text: "Cancel")
end end
end end
Then 'I should see the diff comment preview' do Then 'I should see the diff comment preview' do
within(".file form") do within(".diff-file form") do
page.should have_css(".js-note-preview", visible: false) page.should have_css(".js-note-preview", visible: false)
end end
end end
Then 'I should see the diff comment edit button' do Then 'I should see the diff comment edit button' do
within(".file") do within(".diff-file") do
page.should have_css(".js-note-edit-button", visible: true) page.should have_css(".js-note-edit-button", visible: true)
end end
end end
Then 'I should see the diff comment preview button' do Then 'I should see the diff comment preview button' do
within(".file") do within(".diff-file") do
page.should have_css(".js-note-preview-button", visible: true) page.should have_css(".js-note-preview-button", visible: true)
end end
end end
Then 'I should see two separate previews' do Then 'I should see two separate previews' do
within(".file") do within(".diff-file") do
page.should have_css(".js-note-preview", visible: true, count: 2) page.should have_css(".js-note-preview", visible: true, count: 2)
page.should have_content("Should fix it") page.should have_content("Should fix it")
page.should have_content("DRY this up") page.should have_content("DRY this up")
......
...@@ -166,7 +166,7 @@ describe "On a merge request diff", js: true, focus: true do ...@@ -166,7 +166,7 @@ describe "On a merge request diff", js: true, focus: true do
end end
it "should be removed when canceled" do it "should be removed when canceled" do
within(".file form[rel$='4735dfc552ad7bf15ca468adc3cad9d05b624490_172_185']") do within(".diff-file form[rel$='4735dfc552ad7bf15ca468adc3cad9d05b624490_172_185']") do
find(".js-close-discussion-note-form").trigger("click") find(".js-close-discussion-note-form").trigger("click")
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment