Skip to content
Snippets Groups Projects
Commit 424acf07 authored by Coung Ngo's avatar Coung Ngo
Browse files

Update tests and code for Blocking Issues MVC feature

- Updated tests and code based on MR reviewer comments
- For #2035
parent 719f5d8a
No related branches found
No related tags found
No related merge requests found
......@@ -29,11 +29,13 @@
}
.border-width-1px { border-width: 1px; }
.border-bottom-width-1px { border-bottom-width: 1px; }
.border-style-dashed { border-style: dashed; }
.border-style-solid { border-style: solid; }
.border-bottom-style-solid { border-bottom-style: solid; }
.border-color-blue-300 { border-color: $blue-300; }
.border-color-default { border-color: $border-color; }
.border-bottom-1px { border-bottom: 1px solid $border-color; }
.border-bottom-color-default { border-bottom-color: $border-color; }
.box-shadow-default { box-shadow: 0 2px 4px 0 $black-transparent; }
.mh-50vh { max-height: 50vh; }
......
......@@ -129,7 +129,10 @@ export default {
formCssClass() {
return this.glFeatures.issueLinkTypes
? ['bordered-box', 'bg-white']
: { 'border-bottom-1px': this.hasRelatedIssues };
: {
'border-bottom-width-1px border-bottom-style-solid border-bottom-color-default': this
.hasRelatedIssues,
};
},
},
created() {
......
......@@ -421,7 +421,7 @@
end
end
context 'with issue_link_type feature flag enabled' do
context 'with issue_link_types feature flag enabled' do
def add_linked_issue(issue, radio_input_value)
find('.js-issue-count-badge-add-button').click
find('.js-add-issuable-form-input').set "#{issue.to_reference(project)} "
......@@ -432,76 +432,122 @@ def add_linked_issue(issue, radio_input_value)
end
before do
stub_feature_flags(issue_link_type: true)
stub_feature_flags(issue_link_types: true)
visit project_issue_path(project, issue_a)
wait_for_requests
end
it 'can add "Relates to" issue' do
add_linked_issue(issue_b, "relates_to")
context 'when adding a "relates_to" issue' do
before do
add_linked_issue(issue_b, "relates_to")
end
headings = all('.linked-issues-card-body h4')
it 'shows "Relates to" heading' do
headings = all('.linked-issues-card-body h4')
# See only "Relates to" heading
expect(headings.count).to eq(1)
expect(headings[0].text).to eq("Relates to")
expect(headings.count).to eq(1)
expect(headings[0].text).to eq("Relates to")
end
items = all('.item-title a')
it 'shows the added issue' do
items = all('.item-title a')
# Check added issue is present
expect(items[0].text).to eq(issue_b.title)
expect(find('.js-related-issues-header-issue-count')).to have_content('1')
expect(items[0].text).to eq(issue_b.title)
expect(find('.js-related-issues-header-issue-count')).to have_content('1')
end
end
it 'can add "Blocks" issue' do
add_linked_issue(issue_b, "blocks")
context 'when adding a "relates_to" issue' do
before do
add_linked_issue(issue_b, "blocks")
end
headings = all('.linked-issues-card-body h4')
it 'shows "Blocks" heading' do
headings = all('.linked-issues-card-body h4')
# See only "Blocks" heading
expect(headings.count).to eq(1)
expect(headings[0].text).to eq("Blocks")
expect(headings.count).to eq(1)
expect(headings[0].text).to eq("Blocks")
end
items = all('.item-title a')
it 'shows the added issue' do
items = all('.item-title a')
# Check added issue is present
expect(items[0].text).to eq(issue_b.title)
expect(find('.js-related-issues-header-issue-count')).to have_content('1')
expect(items[0].text).to eq(issue_b.title)
expect(find('.js-related-issues-header-issue-count')).to have_content('1')
end
end
it 'can add "Is blocked by" issue' do
add_linked_issue(issue_b, "is_blocked_by")
context 'when adding an "is_blocked_by" issue' do
before do
add_linked_issue(issue_b, "is_blocked_by")
end
headings = all('.linked-issues-card-body h4')
it 'shows "Is blocked by" heading' do
headings = all('.linked-issues-card-body h4')
# See only "Is blocked by" heading
expect(headings.count).to eq(1)
expect(headings[0].text).to eq("Is blocked by")
expect(headings.count).to eq(1)
expect(headings[0].text).to eq("Is blocked by")
end
items = all('.item-title a')
it 'shows the added issue' do
items = all('.item-title a')
# Check added issue is present
expect(items[0].text).to eq(issue_b.title)
expect(find('.js-related-issues-header-issue-count')).to have_content('1')
expect(items[0].text).to eq(issue_b.title)
expect(find('.js-related-issues-header-issue-count')).to have_content('1')
end
end
it 'can add all categories' do
add_linked_issue(issue_b, "relates_to")
add_linked_issue(issue_c, "blocks")
add_linked_issue(issue_d, "is_blocked_by")
context 'when adding "relates_to", "blocks", and "is_blocked_by" issues' do
before do
add_linked_issue(issue_b, "relates_to")
add_linked_issue(issue_c, "blocks")
add_linked_issue(issue_d, "is_blocked_by")
end
headings = all('.linked-issues-card-body h4')
it 'shows "Blocks", "Is blocked by", and "Relates to" headings' do
headings = all('.linked-issues-card-body h4')
# Can see all headings
expect(headings.count).to eq(3)
expect(headings[0].text).to eq("Blocks")
expect(headings[1].text).to eq("Is blocked by")
expect(headings[2].text).to eq("Relates to")
expect(headings.count).to eq(3)
expect(headings[0].text).to eq("Blocks")
expect(headings[1].text).to eq("Is blocked by")
expect(headings[2].text).to eq("Relates to")
end
items = all('.item-title a')
it 'shows all added issues' do
items = all('.item-title a')
expect(items.count).to eq(3)
expect(find('.js-related-issues-header-issue-count')).to have_content('3')
expect(items.count).to eq(3)
expect(find('.js-related-issues-header-issue-count')).to have_content('3')
end
end
end
context 'with issue_link_types feature flag disabled' do
before do
stub_feature_flags(issue_link_types: false)
visit project_issue_path(project, issue_b)
wait_for_requests
end
context 'when adding an issue' do
before do
find('.js-issue-count-badge-add-button').click
find('.js-add-issuable-form-input').set "#{issue_c.to_reference(project)} "
find('.js-add-issuable-form-add-button').click
wait_for_requests
end
it 'does not group it into "Blocks", "Is blocked by", or "Relates to" headings' do
headings = all('.linked-issues-card-body h4')
expect(headings.count).to eq(0)
end
it 'shows the added issue' do
items = all('.item-title a')
expect(items.count).to eq(1)
end
end
end
end
......
......@@ -30,9 +30,7 @@ describe('AddIssuableForm', () => {
let wrapper;
afterEach(() => {
if (wrapper) {
wrapper.destroy();
}
wrapper.destroy();
});
describe('with data', () => {
......@@ -130,7 +128,7 @@ describe('AddIssuableForm', () => {
});
});
describe('with :issue_link_type feature flag on', () => {
describe('with :issue_link_types feature flag on', () => {
beforeEach(() => {
wrapper = mount(AddIssuableForm, {
propsData: {
......
......@@ -133,7 +133,7 @@ describe('RelatedIssuesBlock', () => {
});
});
describe('with :issue_link_type feature flag on', () => {
describe('with :issue_link_types feature flag on', () => {
beforeEach(() => {
wrapper = mount(RelatedIssuesBlock, {
propsData: {
......
......@@ -168,7 +168,7 @@ describe('RelatedIssuesList', () => {
});
});
describe('with :issue_link_type feature flag on', () => {
describe('with :issue_link_types feature flag on', () => {
it('shows a heading', () => {
const heading = 'Related';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment