-
Notifications
You must be signed in to change notification settings - Fork 613
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TerminalLoadingBox and related Tests
- Loading branch information
root
committed
May 21, 2020
1 parent
5bb04a1
commit b38f1a0
Showing
3 changed files
with
35 additions
and
4 deletions.
There are no files selected for viewing
7 changes: 5 additions & 2 deletions
7
frontend/packages/console-app/src/components/cloud-shell/TerminalLoadingBox.tsx
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 |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import * as React from 'react'; | ||
import { LoadingBox } from '@console/internal/components/utils/status-box'; | ||
|
||
const TerminalLoadingBox: React.FC = () => ( | ||
<LoadingBox message="Connecting to your OpenShift command line terminal ..." /> | ||
type TerminalLoadingBoxProps = { | ||
message?: string; | ||
}; | ||
const TerminalLoadingBox: React.FC<TerminalLoadingBoxProps> = ({ message }) => ( | ||
<LoadingBox message={message || 'Connecting to your OpenShift command line terminal ...'} /> | ||
); | ||
|
||
export default TerminalLoadingBox; |
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
21 changes: 21 additions & 0 deletions
21
...end/packages/console-app/src/components/cloud-shell/__tests__/TerminalLoadingBox.spec.tsx
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,21 @@ | ||
import * as React from 'react'; | ||
import { shallow, ShallowWrapper } from 'enzyme'; | ||
import { LoadingBox } from '@console/internal/components/utils/status-box'; | ||
import TerminalLoadingBox from '../TerminalLoadingBox'; | ||
|
||
describe('TerminalLoadingBox', () => { | ||
it('should render cloudshellterminal', () => { | ||
const terminalLoadingWrapper: ShallowWrapper = shallow(<TerminalLoadingBox />); | ||
const loadingBox = terminalLoadingWrapper.find(LoadingBox); | ||
expect(loadingBox.exists()).toBe(true); | ||
expect(loadingBox.prop('message')).toEqual( | ||
'Connecting to your OpenShift command line terminal ...', | ||
); | ||
}); | ||
it('should render cloudshellterminal', () => { | ||
const terminalLoadingWrapper: ShallowWrapper = shallow(<TerminalLoadingBox message="test" />); | ||
const loadingBox = terminalLoadingWrapper.find(LoadingBox); | ||
expect(loadingBox.exists()).toBe(true); | ||
expect(loadingBox.prop('message')).toEqual('test'); | ||
}); | ||
}); |