forked from nebari-dev/jhub-apps
-
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.
Update App Cards with Server Running Information (nebari-dev#306)
* Add profiles to global state to support lookup. Added additional info and stop button to status chip. * Refactor to simplify app card props. * Add unit tests. * Update to display server info on pinned apps. * Updates to chip styling to better position stop button.
- Loading branch information
Showing
13 changed files
with
253 additions
and
83 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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 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,7 @@ | ||
.card-content-header .chip-container span.MuiChip-label { | ||
padding-right: 2px; | ||
} | ||
|
||
.card-content-header .chip-container .chip-base span.MuiChip-label { | ||
padding-right: 8px; | ||
} |
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,32 +1,92 @@ | ||
import { render } from '@testing-library/react'; | ||
import { apps } from '@src/data/api'; | ||
import '@testing-library/jest-dom'; | ||
import { render, waitFor } from '@testing-library/react'; | ||
import { RecoilRoot } from 'recoil'; | ||
import { StatusChip } from '..'; | ||
|
||
describe('StatusChip', () => { | ||
test('renders default successfully', () => { | ||
const { baseElement } = render(<StatusChip status="Ready" />); | ||
test('renders default chip successfully', () => { | ||
const { baseElement } = render( | ||
<RecoilRoot> | ||
<StatusChip status="Ready" /> | ||
</RecoilRoot>, | ||
); | ||
const chip = baseElement.querySelector('.MuiChip-root'); | ||
expect(chip).toBeTruthy(); | ||
expect(chip?.textContent).toBe('Ready'); | ||
}); | ||
|
||
test('renders default successfully', () => { | ||
const { baseElement } = render(<StatusChip status="Pending" />); | ||
test('renders pending chip successfully', () => { | ||
const { baseElement } = render( | ||
<RecoilRoot> | ||
<StatusChip status="Pending" /> | ||
</RecoilRoot>, | ||
); | ||
const chip = baseElement.querySelector('.MuiChip-root'); | ||
expect(chip).toBeTruthy(); | ||
expect(chip?.textContent).toBe('Pending'); | ||
}); | ||
|
||
test('renders default successfully', () => { | ||
const { baseElement } = render(<StatusChip status="Running" />); | ||
test('renders running chip successfully', () => { | ||
const { baseElement } = render( | ||
<RecoilRoot> | ||
<StatusChip status="Running" /> | ||
</RecoilRoot>, | ||
); | ||
const chip = baseElement.querySelector('.MuiChip-root'); | ||
expect(chip).toBeTruthy(); | ||
expect(chip?.textContent).toBe('Running'); | ||
}); | ||
|
||
test('renders default successfully', () => { | ||
const { baseElement } = render(<StatusChip status="Unknown" />); | ||
test('renders unknown chip successfully', () => { | ||
const { baseElement } = render( | ||
<RecoilRoot> | ||
<StatusChip status="Unknown" /> | ||
</RecoilRoot>, | ||
); | ||
const chip = baseElement.querySelector('.MuiChip-root'); | ||
expect(chip).toBeTruthy(); | ||
expect(chip?.textContent).toBe('Unknown'); | ||
}); | ||
|
||
test('renders running chip with additional info', () => { | ||
const { baseElement } = render( | ||
<RecoilRoot> | ||
<StatusChip status="Running" additionalInfo="small" app={apps[0]} /> | ||
</RecoilRoot>, | ||
); | ||
const chip = baseElement.querySelector('.MuiChip-root'); | ||
expect(chip).toBeTruthy(); | ||
expect(chip?.textContent).toBe('Running on small'); | ||
}); | ||
|
||
test('renders shared app chip running with no additional info', () => { | ||
const newApp = { ...apps[0], shared: true }; | ||
const { baseElement } = render( | ||
<RecoilRoot> | ||
<StatusChip status="Running" additionalInfo="small" app={newApp} /> | ||
</RecoilRoot>, | ||
); | ||
const chip = baseElement.querySelector('.MuiChip-root'); | ||
expect(chip).toBeTruthy(); | ||
expect(chip?.textContent).toBe('Running'); | ||
}); | ||
|
||
test('simulates stopping app from chip button', async () => { | ||
const { baseElement } = render( | ||
<RecoilRoot> | ||
<StatusChip status="Running" additionalInfo="small" app={apps[0]} /> | ||
</RecoilRoot>, | ||
); | ||
const stopButton = baseElement.querySelector( | ||
'.MuiIconButton-root', | ||
) as HTMLButtonElement; | ||
if (stopButton) { | ||
stopButton.click(); | ||
} | ||
waitFor(() => { | ||
const stopModal = baseElement.querySelector('.MuiDialog-root'); | ||
expect(stopModal).toBeTruthy(); | ||
}); | ||
}); | ||
}); |
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
Oops, something went wrong.