feat: Adds id to the notifications so we can check for them in the integration tests.
This commit is contained in:
parent
4bfc80ecb9
commit
23507da59a
|
@ -148,6 +148,18 @@ export default class AbstractNotification<P: Props> extends Component<P> {
|
|||
return descriptionArray;
|
||||
}
|
||||
|
||||
_getDescriptionKey: () => string
|
||||
|
||||
/**
|
||||
* Returns the description key that was used if any.
|
||||
*
|
||||
* @protected
|
||||
* @returns {string}
|
||||
*/
|
||||
_getDescriptionKey() {
|
||||
return this.props.descriptionKey;
|
||||
}
|
||||
|
||||
_onDismissed: () => void;
|
||||
|
||||
/**
|
||||
|
|
|
@ -68,6 +68,8 @@ class Notification extends AbstractNotification<Props> {
|
|||
|
||||
_getDescription: () => Array<string>
|
||||
|
||||
_getDescriptionKey: () => string
|
||||
|
||||
_onDismissed: () => void;
|
||||
|
||||
/**
|
||||
|
@ -78,11 +80,12 @@ class Notification extends AbstractNotification<Props> {
|
|||
* @returns {ReactElement}
|
||||
*/
|
||||
_renderDescription() {
|
||||
const description = this._getDescription();
|
||||
|
||||
// the id is used for testing the UI
|
||||
return (
|
||||
<div>
|
||||
{
|
||||
this._getDescription()
|
||||
}
|
||||
<div id = { this._getDescriptionKey() || description || this.props.titleKey || this.props.title } >
|
||||
{ description }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue