Commit 0a42967a authored by Rubén Dávila's avatar Rubén Dávila

Add a spec plus small refactors

parent b5d36452
import EETrialBanner from './ee_trial_banner'; import EETrialBanner from './ee_trial_banner';
$(() => { $(() => {
const $trialBanner = $('.js-gitlab-ee-trial-banner'); const $trialBanner = $('.js-gitlab-ee-license-banner');
if ($trialBanner.length) { if ($trialBanner.length) {
const eeTrialBanner = new EETrialBanner($trialBanner); const eeTrialBanner = new EETrialBanner($trialBanner);
eeTrialBanner.init(); eeTrialBanner.init();
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
} }
/* Trial Banner */ /* Trial Banner */
.gitlab-ee-trial-banner.alert { .gitlab-ee-license-banner.alert {
display: flex; display: flex;
align-content: center; align-content: center;
justify-content: center; justify-content: center;
......
- admin_without_ee_license = !current_license && current_user.admin? - admin_without_ee_license = !current_license && current_user.admin?
.row.blank-state-parent-container{ class: ('has-start-trial-container' if admin_without_ee_license) } .row.blank-state-parent-container{ class: ('has-start-trial-container' if admin_without_ee_license) }
.section-container.section-welcome{ class: "#{ 'col-md-6' if admin_without_ee_license }" } .section-container.section-welcome{ class: ('col-md-6' if admin_without_ee_license) }
.container.section-body .container.section-body
.blank-state.blank-state-welcome .blank-state.blank-state-welcome
%h2.blank-state-welcome-title %h2.blank-state-welcome-title
......
= render "layouts/header/ee_trial_banner" = render "layouts/header/ee_license_banner"
%header.navbar.navbar-gitlab.js-navbar-gitlab{ class: nav_header_class } %header.navbar.navbar-gitlab.js-navbar-gitlab{ class: nav_header_class }
.navbar-border .navbar-border
%a.sr-only.gl-accessibility{ href: "#content-body", tabindex: "1" } Skip to content %a.sr-only.gl-accessibility{ href: "#content-body", tabindex: "1" } Skip to content
......
- if license_message.present? - if license_message.present?
.alert.alert-dismissible.gitlab-ee-trial-banner.hidden.js-gitlab-ee-trial-banner{ role: 'alert', data: { license_expiry: current_license.expires_at } } .alert.alert-dismissible.gitlab-ee-license-banner.hidden.js-gitlab-ee-license-banner{ role: 'alert', data: { license_expiry: current_license.expires_at } }
-# Show dismiss button only when license expiry is about trial license -# Show dismiss button only when license expiry is about trial license
- if current_license.trial? - if current_license.trial?
%button.close{ type: 'button', 'data-dismiss' => 'alert', 'aria-label' => 'Dismiss banner' } %button.close{ type: 'button', 'data-dismiss' => 'alert', 'aria-label' => 'Dismiss banner' }
......
= render "layouts/header/ee_trial_banner" = render "layouts/header/ee_license_banner"
%header.navbar.navbar-gitlab.navbar-gitlab-new.js-navbar-gitlab{ class: nav_header_class } %header.navbar.navbar-gitlab.navbar-gitlab-new.js-navbar-gitlab{ class: nav_header_class }
%a.sr-only.gl-accessibility{ href: "#content-body", tabindex: "1" } Skip to content %a.sr-only.gl-accessibility{ href: "#content-body", tabindex: "1" } Skip to content
......
...@@ -33,11 +33,35 @@ feature "License Admin" do ...@@ -33,11 +33,35 @@ feature "License Admin" do
it 'does not mention blocking of changes' do it 'does not mention blocking of changes' do
visit admin_license_path visit admin_license_path
page.within '.gitlab-ee-trial-banner' do page.within '.gitlab-ee-license-banner' do
expect(page).to have_content('Your Enterprise Edition trial license expired on') expect(page).to have_content('Your Enterprise Edition trial license expired on')
expect(page).not_to have_content('Pushing code and creation of issues and merge requests has been disabled') expect(page).not_to have_content('Pushing code and creation of issues and merge requests has been disabled')
end end
end end
end end
context 'when license key is provided in the query string' do
let(:license) { build(:license, data: build(:gitlab_license, restrictions: { active_user_count: 2000 }).export) }
before do
License.destroy_all
end
it 'shows the modal to install the license' do
visit admin_license_path(trial_key: license.data)
page.within '#modal-upload-trial-license' do
expect(page).to have_content('Your trial license was issued')
expect(page).to have_button('Install license')
end
end
it 'can install the license' do
visit admin_license_path(trial_key: license.data)
click_button 'Install license'
expect(page).to have_content('The license was successfully uploaded and is now active')
end
end
end end
end 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