-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Hide animation panel for print intent (#129)
- Loading branch information
1 parent
3eabdba
commit bed63b0
Showing
7 changed files
with
215 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {}; |
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 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,62 @@ | ||
import { LayoutIntent } from '@chili-publish/studio-sdk'; | ||
import { render, screen, waitFor } from '@testing-library/react'; | ||
import App from '../App'; | ||
import { getDataTestIdForSUI } from '../utils/dataIds'; | ||
import { ProjectConfig } from '../types/types'; | ||
|
||
const projectConfig = { | ||
projectId: 'projectId', | ||
projectName: 'projectName', | ||
onProjectInfoRequested: () => Promise.resolve(''), | ||
onProjectDocumentRequested: () => Promise.resolve({ deocId: '1' }), | ||
onProjectLoaded: () => null, | ||
onProjectSave: () => null, | ||
onAuthenticationRequested: () => 'authToken', | ||
onAuthenticationExpired: () => null, | ||
onUserInterfaceBack: () => null, | ||
onLogInfoRequested: () => null, | ||
onProjectGetDownloadLink: () => null, | ||
outputSettings: {}, | ||
uiOptions: {}, | ||
}; | ||
jest.mock('@chili-publish/studio-sdk', () => { | ||
const originalModule = jest.requireActual('@chili-publish/studio-sdk'); | ||
|
||
return { | ||
__esModule: true, | ||
...originalModule, | ||
/* eslint-disable */ | ||
default: function () { | ||
/* eslint-enable */ | ||
return { | ||
loadEditor: () => '', | ||
configuration: { setValue: jest.fn() }, | ||
connector: { | ||
getAllByType: jest | ||
.fn() | ||
.mockImplementation(() => Promise.resolve({ success: true, parsedData: [] })), | ||
}, | ||
layout: { | ||
getSelected: jest | ||
.fn() | ||
.mockImplementation(() => | ||
Promise.resolve({ parsedData: { intent: { value: LayoutIntent.digitalAnimated } } }), | ||
), | ||
}, | ||
document: { load: jest.fn().mockImplementation(() => Promise.resolve({ sucess: true })) }, | ||
tool: { setHand: jest.fn() }, | ||
canvas: { zoomToPage: jest.fn() }, | ||
}; | ||
}, | ||
}; | ||
}); | ||
|
||
describe('AppDigitalIntent', () => { | ||
it('Timeline should not be shown if layout intent is not Digital animated', async () => { | ||
render(<App projectConfig={projectConfig as unknown as ProjectConfig} />); | ||
|
||
await waitFor(() => { | ||
expect(screen.getByTestId(getDataTestIdForSUI('timeline-wrapper'))).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
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,62 @@ | ||
import { render, screen, waitFor } from '@testing-library/react'; | ||
import { LayoutIntent } from '@chili-publish/studio-sdk'; | ||
import App from '../App'; | ||
import { getDataTestIdForSUI } from '../utils/dataIds'; | ||
import { ProjectConfig } from '../types/types'; | ||
|
||
const projectConfig = { | ||
projectId: 'projectId', | ||
projectName: 'projectName', | ||
onProjectInfoRequested: () => Promise.resolve(''), | ||
onProjectDocumentRequested: () => Promise.resolve({ deocId: '1' }), | ||
onProjectLoaded: () => null, | ||
onProjectSave: () => null, | ||
onAuthenticationRequested: () => 'authToken', | ||
onAuthenticationExpired: () => null, | ||
onUserInterfaceBack: () => null, | ||
onLogInfoRequested: () => null, | ||
onProjectGetDownloadLink: () => null, | ||
outputSettings: {}, | ||
uiOptions: {}, | ||
}; | ||
jest.mock('@chili-publish/studio-sdk', () => { | ||
const originalModule = jest.requireActual('@chili-publish/studio-sdk'); | ||
|
||
return { | ||
__esModule: true, | ||
...originalModule, | ||
/* eslint-disable */ | ||
default: function () { | ||
/* eslint-enable */ | ||
return { | ||
loadEditor: () => '', | ||
configuration: { setValue: jest.fn() }, | ||
connector: { | ||
getAllByType: jest | ||
.fn() | ||
.mockImplementation(() => Promise.resolve({ success: true, parsedData: [] })), | ||
}, | ||
layout: { | ||
getSelected: jest | ||
.fn() | ||
.mockImplementation(() => | ||
Promise.resolve({ success: true, intent: { value: LayoutIntent.print } }), | ||
), | ||
}, | ||
document: { load: jest.fn().mockImplementation(() => Promise.resolve({ sucess: true })) }, | ||
tool: { setHand: jest.fn() }, | ||
canvas: { zoomToPage: jest.fn() }, | ||
}; | ||
}, | ||
}; | ||
}); | ||
|
||
describe('AppPrintIntent', () => { | ||
it('Timeline should not be shown if layout intent is not Digital animated', async () => { | ||
render(<App projectConfig={projectConfig as unknown as ProjectConfig} />); | ||
|
||
await waitFor(() => { | ||
expect(screen.queryByTestId(getDataTestIdForSUI('timeline-wrapper'))).not.toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.