summaryrefslogtreecommitdiffstats
path: root/core/js/tests
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2019-07-12 08:43:12 +0200
committerMorris Jobke <hey@morrisjobke.de>2019-07-12 16:15:05 +0200
commit916c95758f5fa40ba465f4a15ffde6b15ea29c65 (patch)
tree491572533a8cff84edd6078abb73276972afe595 /core/js/tests
parentc193c0d46670fdda79f74523eb0f616175dd513b (diff)
downloadnextcloud-server-916c95758f5fa40ba465f4a15ffde6b15ea29c65.tar.gz
nextcloud-server-916c95758f5fa40ba465f4a15ffde6b15ea29c65.zip
Rename parameter in OCP.Toast for consistency with OC.Notification
This fixes HTML messages in "OC.Notification.showTemporary" (as "showHtml" was not set based on "isHTML"), and also makes OCP.Toast to keep the old OC.Notification API when used directly. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'core/js/tests')
-rw-r--r--core/js/tests/specs/coreSpec.js17
1 files changed, 11 insertions, 6 deletions
diff --git a/core/js/tests/specs/coreSpec.js b/core/js/tests/specs/coreSpec.js
index f4edbc7cab8..52099bdb26c 100644
--- a/core/js/tests/specs/coreSpec.js
+++ b/core/js/tests/specs/coreSpec.js
@@ -900,10 +900,15 @@ describe('Core base tests', function() {
var hideSpy;
var clock;
- var getInnerText = function($node) {
- return $node.contents().filter(function(){
- return this.nodeType === 3;
- })[0].nodeValue;
+ /**
+ * Returns the HTML or plain text of the given notification row.
+ *
+ * This is needed to ignore the close button that is added to the
+ * notification row after the text.
+ */
+ var getNotificationText = function($node) {
+ return $node.contents()[0].outerHTML ||
+ $node.contents()[0].nodeValue;
}
beforeEach(function() {
@@ -931,7 +936,7 @@ describe('Core base tests', function() {
var $row = $('#testArea .toastify');
expect($row).toBeDefined();
- expect(getInnerText($row)).toEqual('My notification test');
+ expect(getNotificationText($row)).toEqual('My notification test');
});
it('shows a HTML notification with default timeout', function() {
OC.Notification.showTemporary('<a>My notification test</a>', { isHTML: true });
@@ -942,7 +947,7 @@ describe('Core base tests', function() {
var $row = $('#testArea .toastify');
expect($row).toBeDefined();
- expect(getInnerText($row)).toEqual('<a>My notification test</a>');
+ expect(getNotificationText($row)).toEqual('<a>My notification test</a>');
});
it('hides itself after 7 seconds', function() {
OC.Notification.showTemporary('');