Commit 1beaad2f authored by Simon Knox's avatar Simon Knox Committed by Jose Ivan Vargas

fix settings test

parent f1f0722f
......@@ -3,7 +3,7 @@
(function() {
this.ProjectNew = (function() {
function ProjectNew() {
this.$selects = $('.project-feature select');
this.$selects = $('.features select');
this.$repoSelects = this.$selects.filter('.js-repo-select');
this.$enableApprovers = $('.js-require-approvals-toggle');
......@@ -17,16 +17,14 @@
this.initVisibilitySelect();
this.toggleSettings();
this.addEvents();
this.bindEvents();
this.toggleRepoVisibility();
}
ProjectNew.prototype.bindEvents = function() {
this.toggleSettings = this.toggleSettings.bind(this);
this.toggleApproverSettingsVisibility = this.toggleApproverSettingsVisibility.bind(this);
};
ProjectNew.prototype.addEvents = function() {
this.$selects.on('change', this.toggleSettings);
$('#require_approvals').on('change', this.toggleApproverSettingsVisibility);
};
......
......@@ -16,6 +16,20 @@ describe 'Project settings > [EE] Merge Requests', feature: true, js: true do
group.add_developer(user)
end
scenario 'adds approver' do
visit edit_project_path(project)
find('#s2id_approver_user_and_group_ids .select2-input').click
wait_for_ajax
expect(find('.select2-results')).to have_content(user.name)
find('.user-result', text: user.name).click
click_button 'Add'
expect(find('.js-current-approvers')).to have_content(user.name)
end
scenario 'adds approver group' do
visit edit_project_path(project)
......@@ -23,13 +37,21 @@ describe 'Project settings > [EE] Merge Requests', feature: true, js: true do
wait_for_ajax
expect(find('.select2-results')).to have_content(group.name)
within('.js-current-approvers') do
expect(find('.panel-heading .badge')).to have_content('0')
end
expect(find('.select2-results')).to have_content(group.name)
find('.select2-results .group-result').click
click_button 'Add'
click_button 'Save changes'
expect(find('.approver-list-loader')).to be_visible
expect(page).to have_css('.js-current-approvers li.approver-group', count: 1)
expect(page).to have_css('.js-current-approvers li.approver-group', count: 1)
within('.js-current-approvers') do
expect(find('.panel-heading .badge')).to have_content('2')
end
end
context 'with an approver group' do
......
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