Commit cedff10d authored by David O'Regan's avatar David O'Regan

Merge branch 'jswain_new_repo_bugfix' into 'master'

Render experiment variant in active panel

See merge request gitlab-org/gitlab!58964
parents 9312f6af ea5f1ab1
...@@ -91,7 +91,7 @@ export default { ...@@ -91,7 +91,7 @@ export default {
}, },
computed: { computed: {
availablePanels() { decoratedPanels() {
const PANEL_TITLES = experiment(NEW_REPO_EXPERIMENT, { const PANEL_TITLES = experiment(NEW_REPO_EXPERIMENT, {
use: () => ({ use: () => ({
blank: s__('ProjectsNew|Create blank project'), blank: s__('ProjectsNew|Create blank project'),
...@@ -103,20 +103,22 @@ export default { ...@@ -103,20 +103,22 @@ export default {
}), }),
}); });
const updatedPanels = PANELS.map(({ key, title, ...el }) => ({ return PANELS.map(({ key, title, ...el }) => ({
...el, ...el,
title: PANEL_TITLES[key] !== undefined ? PANEL_TITLES[key] : title, title: PANEL_TITLES[key] !== undefined ? PANEL_TITLES[key] : title,
})); }));
},
availablePanels() {
if (this.isCiCdAvailable) { if (this.isCiCdAvailable) {
return updatedPanels; return this.decoratedPanels;
} }
return updatedPanels.filter((p) => p.name !== CI_CD_PANEL); return this.decoratedPanels.filter((p) => p.name !== CI_CD_PANEL);
}, },
activePanel() { activePanel() {
return PANELS.find((p) => p.name === this.activeTab); return this.decoratedPanels.find((p) => p.name === this.activeTab);
}, },
breadcrumbs() { breadcrumbs() {
......
...@@ -23,6 +23,7 @@ describe('Experimental new project creation app', () => { ...@@ -23,6 +23,7 @@ describe('Experimental new project creation app', () => {
findWelcomePage() findWelcomePage()
.props() .props()
.panels.find((p) => p.name === panelName); .panels.find((p) => p.name === panelName);
const findPanelHeader = () => wrapper.find('h4');
describe('new_repo experiment', () => { describe('new_repo experiment', () => {
describe('when in the candidate variant', () => { describe('when in the candidate variant', () => {
...@@ -33,6 +34,17 @@ describe('Experimental new project creation app', () => { ...@@ -33,6 +34,17 @@ describe('Experimental new project creation app', () => {
expect(findPanel('blank_project').title).toBe('Create blank project/repository'); expect(findPanel('blank_project').title).toBe('Create blank project/repository');
}); });
describe('when hash is not empty on load', () => {
beforeEach(() => {
window.location.hash = '#blank_project';
createComponent();
});
it('renders "project/repository"', () => {
expect(findPanelHeader().text()).toBe('Create blank project/repository');
});
});
}); });
describe('when in the control variant', () => { describe('when in the control variant', () => {
...@@ -43,6 +55,17 @@ describe('Experimental new project creation app', () => { ...@@ -43,6 +55,17 @@ describe('Experimental new project creation app', () => {
expect(findPanel('blank_project').title).toBe('Create blank project'); expect(findPanel('blank_project').title).toBe('Create blank project');
}); });
describe('when hash is not empty on load', () => {
beforeEach(() => {
window.location.hash = '#blank_project';
createComponent();
});
it('renders "project"', () => {
expect(findPanelHeader().text()).toBe('Create blank project');
});
});
}); });
}); });
......
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