diff options
author | Jacob Schatz <jschatz@gitlab.com> | 2016-04-21 17:32:24 +0000 |
---|---|---|
committer | Jacob Schatz <jschatz@gitlab.com> | 2016-04-21 17:32:24 +0000 |
commit | 6a27a80867ee3ef44e8db91e3d2ffe96f8946815 (patch) | |
tree | 4793b6a4c56fa1e0370e3d8b6e53b9eca048a3f6 /spec/features | |
parent | 1c7c114e76510349bebb2494c951713813526489 (diff) | |
parent | 7e0ef892f4d2a775474a1779de4ce3f54c0dbc10 (diff) | |
download | gitlab-ce-6a27a80867ee3ef44e8db91e3d2ffe96f8946815.tar.gz |
Merge branch 'label-dropdown-fix' into 'master'
Fixes "create label" functionality on label dropdown
**Issue sidebar**
![label_dropdown](/uploads/2a056136fc88626530fc275ded0c2aa3/label_dropdown.gif)
**Issues page**
![label_dropdown_issues](/uploads/965fd20f5b206499e9b11a64556c5240/label_dropdown_issues.gif)
See merge request !3670
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/issues/issue_sidebar_spec.rb | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/spec/features/issues/issue_sidebar_spec.rb b/spec/features/issues/issue_sidebar_spec.rb new file mode 100644 index 00000000000..5739bc64dfb --- /dev/null +++ b/spec/features/issues/issue_sidebar_spec.rb @@ -0,0 +1,79 @@ +require 'rails_helper' + +feature 'Issue Sidebar', feature: true do + let(:project) { create(:project) } + let(:issue) { create(:issue, project: project) } + let!(:user) { create(:user)} + + before do + create(:label, project: project, title: 'bug') + login_as(user) + end + + context 'as a allowed user' do + before do + project.team << [user, :developer] + visit_issue(project, issue) + end + + describe 'when clicking on edit labels', js: true do + it 'dropdown has an option to create a new label' do + find('.block.labels .edit-link').click + + page.within('.block.labels') do + expect(page).to have_content 'Create new' + end + end + end + + context 'creating a new label', js: true do + it 'option to crate a new label is present' do + page.within('.block.labels') do + find('.edit-link').click + + expect(page).to have_content 'Create new' + end + end + + it 'dropdown switches to "create label" section' do + page.within('.block.labels') do + find('.edit-link').click + click_link 'Create new' + + expect(page).to have_content 'Create new label' + end + end + + it 'new label is added' do + page.within('.block.labels') do + find('.edit-link').click + sleep 1 + click_link 'Create new' + + fill_in 'new_label_name', with: 'wontfix' + page.find(".suggest-colors a", match: :first).click + click_button 'Create' + + page.within('.dropdown-page-one') do + expect(page).to have_content 'wontfix' + end + end + end + end + end + + context 'as a guest' do + before do + project.team << [user, :guest] + visit_issue(project, issue) + end + + it 'does not have a option to edit labels' do + expect(page).not_to have_selector('.block.labels .edit-link') + end + end + + def visit_issue(project, issue) + visit namespace_project_issue_path(project.namespace, project, issue) + end +end |