Skip to content

Commit

Permalink
#30726 hide workflow actions component when editing a variant
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinogiardino committed Dec 20, 2024
1 parent 18c7ea7 commit e99414e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@
#personaSelector
data-testId="persona-selector" />

<dot-uve-workflow-actions />
@if ($toolbarProps().isDefaultVariant) {
<dot-uve-workflow-actions />
}

@if ($toolbarProps().unlockButton; as unlockButton) {
<p-button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ describe('EditEmaToolbarComponent', () => {
runningExperiment: null,
workflowActionsInode: pageAPIResponse?.page.inode,
unlockButton: null,
isDefaultVariant: true,
showInfoDisplay: shouldShowInfoDisplay,
deviceSelector: {
apiLink: `${params?.clientHost ?? 'http://localhost'}${pageAPI}`,
Expand Down Expand Up @@ -405,12 +406,10 @@ describe('EditEmaToolbarComponent', () => {
});
});
});

it('should have a dot-uve-workflow-actions component', () => {
const workflowActions = spectator.query(DotUveWorkflowActionsComponent);
expect(workflowActions).toBeTruthy();
});

describe('dot-ema-info-display', () => {
it('should be hidden', () => {
const infoDisplay = spectator.query(byTestId('info-display'));
Expand All @@ -426,7 +425,7 @@ describe('EditEmaToolbarComponent', () => {
});
});

xdescribe('constrains', () => {
describe('constrains', () => {
describe('dot-ema-info-display', () => {
beforeEach(() => {
spectator = createComponent({
Expand Down Expand Up @@ -466,6 +465,46 @@ describe('EditEmaToolbarComponent', () => {
expect(infoDisplay).toBeDefined();
});
});
describe('dot-uve-workflow-actions', () => {
beforeEach(() => {
spectator = createComponent({
providers: [
mockProvider(UVEStore, {
$toolbarProps: signal({
bookmarksUrl,
copyUrl: '',
apiUrl: '',
currentLanguage: pageAPIResponse?.viewAs.language,
urlContentMap: null,
runningExperiment: null,
workflowActionsInode: '',
unlockButton: null,
isDefaultVariant: false,
showInfoDisplay: true,
deviceSelector: {
apiLink: '',
hideSocialMedia: true
},
personaSelector: {
pageId: '',
value: DEFAULT_PERSONA
}
}),
setDevice: jest.fn(),
setSocialMedia: jest.fn(),
pageParams: signal(params)
})
]
});
store = spectator.inject(UVEStore);
messageService = spectator.inject(MessageService);
confirmationService = spectator.inject(ConfirmationService);
});
it('should not show when isDefaultVariant is false in the store', () => {
const workflowActions = spectator.query(DotUveWorkflowActionsComponent);
expect(workflowActions).toBeNull();
});
});
describe('experiments', () => {
const experiment = getRunningExperimentMock();

Expand Down Expand Up @@ -499,7 +538,6 @@ describe('EditEmaToolbarComponent', () => {
]
});
});

describe('dot-ema-running-experiment', () => {
it('should have attr', () => {
const experiments = spectator.query(DotEmaRunningExperimentComponent);
Expand Down

0 comments on commit e99414e

Please sign in to comment.