瀏覽代碼

feat: Adds id to the notifications so we can check for them in the integration tests.

j8
damencho 5 年之前
父節點
當前提交
23507da59a

+ 12
- 0
react/features/notifications/components/AbstractNotification.js 查看文件

@@ -148,6 +148,18 @@ export default class AbstractNotification<P: Props> extends Component<P> {
148 148
         return descriptionArray;
149 149
     }
150 150
 
151
+    _getDescriptionKey: () => string
152
+
153
+    /**
154
+     * Returns the description key that was used if any.
155
+     *
156
+     * @protected
157
+     * @returns {string}
158
+     */
159
+    _getDescriptionKey() {
160
+        return this.props.descriptionKey;
161
+    }
162
+
151 163
     _onDismissed: () => void;
152 164
 
153 165
     /**

+ 7
- 4
react/features/notifications/components/web/Notification.js 查看文件

@@ -68,6 +68,8 @@ class Notification extends AbstractNotification<Props> {
68 68
 
69 69
     _getDescription: () => Array<string>
70 70
 
71
+    _getDescriptionKey: () => string
72
+
71 73
     _onDismissed: () => void;
72 74
 
73 75
     /**
@@ -78,11 +80,12 @@ class Notification extends AbstractNotification<Props> {
78 80
      * @returns {ReactElement}
79 81
      */
80 82
     _renderDescription() {
83
+        const description = this._getDescription();
84
+
85
+        // the id is used for testing the UI
81 86
         return (
82
-            <div>
83
-                {
84
-                    this._getDescription()
85
-                }
87
+            <div id = { this._getDescriptionKey() || description || this.props.titleKey || this.props.title } >
88
+                { description }
86 89
             </div>
87 90
         );
88 91
     }

Loading…
取消
儲存