forked from openedx/frontend-app-communications
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
120 additions
and
20 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
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,8 @@ | ||
$medium-spinner: 15px; | ||
|
||
.loading-teams-spinner { | ||
&__medium { | ||
height: $medium-spinner; | ||
width: $medium-spinner; | ||
} | ||
} |
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,30 @@ | ||
import PropTypes from 'prop-types'; | ||
import { | ||
Form, | ||
Spinner, | ||
} from '@edx/paragon'; | ||
|
||
import './FeedbackMessage.scss'; | ||
|
||
const FeedbackMessage = ({ title }) => ( | ||
<Form.Control.Feedback | ||
className="mt-1" | ||
data-testid="feedback-message-container" | ||
icon={( | ||
<Spinner | ||
animation="border" | ||
className="mie-3 loading-teams-spinner__medium" | ||
screenReaderText="loading" | ||
data-testid="feedback-message-spinner" | ||
/> | ||
)} | ||
> | ||
{title} | ||
</Form.Control.Feedback> | ||
); | ||
|
||
FeedbackMessage.propTypes = { | ||
title: PropTypes.string.isRequired, | ||
}; | ||
|
||
export default FeedbackMessage; |
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,8 @@ | ||
$medium-spinner: 15px; | ||
|
||
.loading-teams-spinner { | ||
&__medium { | ||
height: $medium-spinner; | ||
width: $medium-spinner; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
plugins/communications-app/TeamEmails/FeedbackMessage.test.jsx
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,25 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import FeedbackMessage from './FeedbackMessage'; | ||
|
||
describe('FeedbackMessage Component', () => { | ||
test('renders with the provided title', () => { | ||
const title = 'Loading...'; | ||
render(<FeedbackMessage title={title} />); | ||
const feedbackMessageContainer = screen.getByTestId('feedback-message-container'); | ||
expect(feedbackMessageContainer).toBeInTheDocument(); | ||
expect(feedbackMessageContainer).toHaveTextContent(title); | ||
}); | ||
|
||
test('renders the spinner element', () => { | ||
render(<FeedbackMessage title="Loading..." />); | ||
const spinnerElement = screen.getByTestId('feedback-message-spinner'); | ||
expect(spinnerElement).toBeInTheDocument(); | ||
}); | ||
|
||
test('renders the spinner with the correct CSS classes', () => { | ||
render(<FeedbackMessage title="Loading..." />); | ||
const spinnerElement = screen.getByTestId('feedback-message-spinner'); | ||
expect(spinnerElement).toHaveClass('mie-3 loading-teams-spinner__medium'); | ||
}); | ||
}); |
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