-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace beta info popover in preview button with alert info panel in …
…preview page (#11307) * Remove beta info popover from preview button and add test for info alert being shown in preview * Add alert info to preview in ux-editor * Change text by request from UX * Add popover and session saving for preview limitations info * fix review-comments and failing tests * Use grid to avoid dynamically setting the height * use grid on preview for 'lage' * Add test to check if popover opens on close-click in alert in preview * Delete previewContext
- Loading branch information
Showing
16 changed files
with
255 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
backend/tests/Designer.Tests/Controllers/PreviewController/PreviewStatusTests.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import React from 'react'; | ||
import { act, screen, queryByAttribute, within } from '@testing-library/react'; | ||
import userEvent from '@testing-library/user-event'; | ||
import { LandingPage } from './LandingPage'; | ||
import { renderWithMockStore } from '../../../../frontend/packages/ux-editor/src/testing/mocks'; | ||
import { textMock } from '../../../testing/mocks/i18nMock'; | ||
|
||
describe('LandingPage', () => { | ||
|
||
it('should render an iframe', () => { | ||
const { renderResult } = renderWithMockStore()(<LandingPage variant={'preview'} />); | ||
|
||
const getById = queryByAttribute.bind(null, 'id'); | ||
|
||
const iframe = getById(renderResult.container, 'app-frontend-react-iframe'); | ||
expect(iframe).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render the information alert with preview being limited', () => { | ||
renderWithMockStore()(<LandingPage variant={'preview'} />); | ||
|
||
const previewLimitationsAlert = screen.getByText(textMock('preview.limitations_info')); | ||
expect(previewLimitationsAlert).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render a popover with options for remembering closing-choice in session or not when clicking cross-button in alert', async () => { | ||
renderWithMockStore()(<LandingPage variant={'preview'} />); | ||
|
||
const user = userEvent.setup(); | ||
|
||
const previewLimitationsAlert = screen.getByText(textMock('preview.limitations_info')); | ||
const alert = within(previewLimitationsAlert); | ||
const hidePreviewLimitationsAlertButton = alert.getByRole('button'); | ||
await act(() => user.click(hidePreviewLimitationsAlertButton)); | ||
const hidePreviewLimitationsPopover = screen.getByText(textMock('session.reminder')); | ||
expect(hidePreviewLimitationsPopover).toBeInTheDocument(); | ||
const hidePreviewLimitationsTemporaryButton = screen.getByRole('button', { name: textMock('session.do_show_again') }); | ||
const hidePreviewLimitationsForSessionButton = screen.getByRole('button', { name: textMock('session.dont_show_again') }); | ||
expect(hidePreviewLimitationsTemporaryButton).toBeInTheDocument(); | ||
expect(hidePreviewLimitationsForSessionButton).toBeInTheDocument(); | ||
}); | ||
|
||
it('should close popover and not set value in session storage when hidePreviewLimitationsTemporaryButton is clicked', async () => { | ||
renderWithMockStore()(<LandingPage variant={'preview'} />); | ||
|
||
const user = userEvent.setup(); | ||
|
||
// Open popover | ||
const previewLimitationsAlert = screen.getByText(textMock('preview.limitations_info')); | ||
const alert = within(previewLimitationsAlert); | ||
const hidePreviewLimitationsAlertButton = alert.getByRole('button'); | ||
await act(() => user.click(hidePreviewLimitationsAlertButton)); | ||
const hidePreviewLimitationsPopover = screen.getByText(textMock('session.reminder')); | ||
expect(hidePreviewLimitationsPopover).toBeInTheDocument(); | ||
const hidePreviewLimitationsTemporaryButton = screen.getByRole('button', { name: textMock('session.do_show_again') }); | ||
|
||
// Click hide temporary button | ||
await act(() => user.click(hidePreviewLimitationsTemporaryButton)); | ||
|
||
expect(hidePreviewLimitationsPopover).not.toBeInTheDocument(); | ||
expect(window.sessionStorage.getItem('showPreviewLimitationsInfo')).toBeNull(); | ||
}); | ||
|
||
it('should close popover and set value in session storage when hidePreviewLimitationsForSessionButton is clicked', async () => { | ||
renderWithMockStore()(<LandingPage variant={'preview'} />); | ||
|
||
const user = userEvent.setup(); | ||
|
||
// Open popover | ||
const previewLimitationsAlert = screen.getByText(textMock('preview.limitations_info')); | ||
const alert = within(previewLimitationsAlert); | ||
const hidePreviewLimitationsAlertButton = alert.getByRole('button'); | ||
await act(() => user.click(hidePreviewLimitationsAlertButton)); | ||
const hidePreviewLimitationsPopover = screen.getByText(textMock('session.reminder')); | ||
expect(hidePreviewLimitationsPopover).toBeInTheDocument(); | ||
const hidePreviewLimitationsForSessionButton = screen.getByRole('button', { name: textMock('session.dont_show_again') }); | ||
|
||
// Click hide forever button | ||
await act(() => user.click(hidePreviewLimitationsForSessionButton)); | ||
|
||
expect(hidePreviewLimitationsPopover).not.toBeInTheDocument(); | ||
expect(window.sessionStorage.getItem('showPreviewLimitationsInfo')).toBe('false'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.