# @old_line_number = first '.diff-line-num.old_line:not(.empty-cell)'
# @new_line_number = first '.diff-line-num.new_line:not(.empty-cell)'
# @old_line = first '.line_content[data-line-type="old"]'
# @new_line = first '.line_content[data-line-type="new"]'
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){first:xpath,'//*[contains(concat(" ", @class, " "), " line_holder ") and child::*[contains(concat(" ", @class, " "), " line_content ") and contains(concat(" ", @class, " "), " old ")] and 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]))]]'}
it'should allow commenting on the left side'do
it'should allow commenting on the left side'do
putsfirst('//*[contains(concat(" ", @class, " "), " line_holder ") and child::*[contains(concat(" ", @class, " "), " line_content ") and contains(concat(" ", @class, " "), " old ")] and child::*[contains(concat(" ", @class, " ")," line_content ") and contains(concat(" ", @class, " ")," new ")]]')
should_allow_commentingline_holder,'left'
expect(page).tohave_content'NOPE'
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_commentingline_holder,'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
it'should allow commenting on the right side'do
let(:line_holder){first:xpath,'//*[contains(concat(" ", @class, " "), " line_holder ") and 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]))] and child::*[contains(concat(" ", @class, " ")," line_content ") and contains(concat(" ", @class, " ")," new ")]]'}
end
it'should not allow commenting on the left side'do
it'should not allow commenting on the left side'do
should_not_allow_commentingline_holder,'left'
end
it'should allow commenting on the right side'do
should_allow_commentingline_holder,'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
it'should allow commenting on the left side'do
let(:line_holder){first:xpath,'//*[contains(concat(" ", @class, " "), " line_holder ") and child::*[contains(concat(" ", @class, " "), " line_content ") and contains(concat(" ", @class, " "), " old ")] and child::*[contains(concat(" ", @class, " ")," line_content ") and contains(concat(" ", @class, " ")," new ")]]'}
it'should allow commenting on the left side'do
should_allow_commentingline_holder,'left'
end
end
it'should allow commenting on the right side'do
it'should allow commenting on the right side'do
should_allow_commentingline_holder,'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
it'should allow commenting on the left side'do
let(:line_holder){first:xpath,'//*[contains(concat(" ", @class, " "), " line_holder ") and 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])] and 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])]]'}
it'should allow commenting on the left side'do
should_allow_commentingline_holder,'left'
end
end
it'should allow commenting on the right side'do
it'should allow commenting on the right side'do
should_allow_commentingline_holder,'right'
end
end
end
end
context'with a match line'do
context'with a match line'do
it'should not allow commenting on the left side'do
let(:line_holder){first:xpath,'//*[contains(concat(" ", @class, " "), " line_holder ") and child::*[contains(concat(" ", @class, " "), " line_content ") and contains(concat(" ", @class, " "), " match ")] and child::*[contains(concat(" ", @class, " ")," line_content ") and contains(concat(" ", @class, " ")," match ")]]'}
it'should not allow commenting on the left side'do
should_not_allow_commentingline_holder,'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_commentingline_holder,'right'
end
end
end
end
# it 'shows a comment button on the old side when hovering over an old line number' do
# @old_line_number = first '.diff-line-num.old_line:not(.unfold)'
# @new_line_number = first '.diff-line-num.new_line:not(.unfold)'
# @new_line = first '.line_content:not(.match)'
end
end
context'with a new line'do
context'with a new line'do
it'should allow commenting'do
let(:line_holder){first:xpath,'//*[contains(concat(" ", @class, " "), " line_holder ") and child::*[contains(concat(" ", @class, " "), " line_content ") and contains(concat(" ", @class, " "), " new ")]]'}
it'should allow commenting'do
should_allow_commentingline_holder
end
end
end
end
context'with an old line'do
context'with an old line'do
it'should allow commenting'do
let(:line_holder){first:xpath,'//*[contains(concat(" ", @class, " "), " line_holder ") and child::*[contains(concat(" ", @class, " "), " line_content ") and contains(concat(" ", @class, " "), " old ")]]'}
it'should allow commenting'do
should_allow_commentingline_holder
end
end
end
end
context'with an unchanged line'do
context'with an unchanged line'do
it'should allow commenting'do
let(:line_holder){first:xpath,'//*[contains(concat(" ", @class, " "), " line_holder ") and 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])] and 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])]]'}
it'should allow commenting'do
should_allow_commentingline_holder
end
end
end
end
context'with a match line'do
context'with a match line'do
let(:line_holder){first:xpath,'//*[contains(concat(" ", @class, " "), " line_holder ") and child::*[contains(concat(" ", @class, " "), " line_content ") and contains(concat(" ", @class, " "), " match ")]]'}