Commit 481b5446 authored by Tim Zallmann's avatar Tim Zallmann

Fixed the possibility to have multiple callouts on 1 page

Fixing Test Failures on the new promotions
parent 3fa8a6d0
......@@ -371,7 +371,8 @@ import initGroupAnalytics from './init_group_analytics';
break;
case 'projects:edit':
new UsersSelect();
new UserCallout();
new UserCallout('js-service-desk-callout');
new UserCallout('js-mr-approval-callout');
break;
case 'projects:imports:show':
new ProjectImport();
......
......@@ -10,7 +10,7 @@ export default class UserCallout {
init() {
if (!this.isCalloutDismissed || this.isCalloutDismissed === 'false') {
$('.js-close-callout').on('click', e => this.dismissCallout(e));
this.userCalloutBody.find('.js-close-callout').on('click', e => this.dismissCallout(e));
}
}
......
.user-callout.promotion-callout{ id: 'promote_mr_approval', data: { uid: 'promote_mr_approval_dismissed' } }
.user-callout.promotion-callout.js-mr-approval-callout{ id: 'promote_mr_approval', data: { uid: 'promote_mr_approval_dismissed' } }
.bordered-box.content-block
%button.btn.btn-default.close.js-close-callout{ type: 'button', 'aria-label' => 'Dismiss merge request promotion' }
= icon('times', class: 'dismiss-icon', 'aria-hidden' => 'true')
......
.user-callout.promotion-callout{ id: 'promote_service_desk', data: { uid: 'promote_service_desk_dismissed' } }
.user-callout.promotion-callout.js-service-desk-callout{ id: 'promote_service_desk', data: { uid: 'promote_service_desk_dismissed' } }
.bordered-box.content-block
%button.btn.btn-default.close.js-close-callout{ type: 'button', 'aria-label' => 'Dismiss service desk promotion' }
= icon('times', class: 'dismiss-icon', 'aria-hidden' => 'true')
......
......@@ -2,6 +2,7 @@ require 'spec_helper'
describe 'Promotions', js: true do
let(:project) { create(:project, :repository) }
let(:otherproject) { create(:project, :repository) }
let(:admin) { create(:admin) }
let(:user) { create(:user) }
let(:standarddeveloper) { create(:user) }
......@@ -47,7 +48,8 @@ describe 'Promotions', js: true do
project.add_developer(standarddeveloper)
project.team << [user, :master]
stub_application_setting(check_namespace_plan: true)
stub_application_setting(check_namespace_plan: true)
allow(Gitlab).to receive(:com?) { true }
end
it 'should have the Upgrade your plan button' do
......@@ -57,8 +59,8 @@ describe 'Promotions', js: true do
end
it 'should have the contact owner line' do
sign_in(standarddeveloper)
visit edit_project_path(project)
sign_in(user)
visit edit_project_path(otherproject)
expect(find('#promote_service_desk')).to have_content 'Contact owner'
end
end
......@@ -127,20 +129,20 @@ describe 'Promotions', js: true do
end
it 'should appear in repository settings page' do
visit repository_settings(project)
visit project_settings_repository_path(project)
expect(find('#promote_repository_features')).to have_content 'Improve repositories with GitLab Enterprise Edition'
expect(find('#promote_repository_features')).to have_content 'Push Rules are defined per project so you can have different rules applied to different projects depends on your needs.'
end
it 'does not show when cookie is set' do
visit repository_settings(project)
visit project_settings_repository_path(project)
within('#promote_repository_features') do
find('.close').trigger('click')
end
visit repository_settings(project)
visit project_settings_repository_path(project)
expect(page).not_to have_selector('#promote_repository_features')
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