From 5848c31fa20bd2b8f6a9e62e4fdf31d99fb481c1 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Tue, 10 Nov 2020 11:34:12 +0100 Subject: Do not print deprecation warnings during testing Signed-off-by: Christoph Wurst --- core/src/OC/util.js | 8 ++++++-- core/src/Polyfill/tooltip.js | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'core/src') diff --git a/core/src/OC/util.js b/core/src/OC/util.js index 5908d9f6e1f..611c42d317f 100644 --- a/core/src/OC/util.js +++ b/core/src/OC/util.js @@ -117,7 +117,9 @@ export default { * @returns {string} timestamp formatted as requested */ formatDate(timestamp, format) { - console.warn('OC.Util.formatDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment') + if (window.TESTING === undefined) { + console.warn('OC.Util.formatDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment') + } format = format || 'LLL' return moment(timestamp).format(format) }, @@ -127,7 +129,9 @@ export default { * @returns {string} human readable difference from now */ relativeModifiedDate(timestamp) { - console.warn('OC.Util.relativeModifiedDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment') + if (window.TESTING === undefined) { + console.warn('OC.Util.relativeModifiedDate is deprecated and will be removed in Nextcloud 21. See @nextcloud/moment') + } const diff = moment().diff(moment(timestamp)) if (diff >= 0 && diff < 45000) { return t('core', 'seconds ago') diff --git a/core/src/Polyfill/tooltip.js b/core/src/Polyfill/tooltip.js index 08cc58c338c..2dd7592edb4 100644 --- a/core/src/Polyfill/tooltip.js +++ b/core/src/Polyfill/tooltip.js @@ -25,11 +25,15 @@ $.prototype.tooltip = (function(tooltip) { return tooltip.call(this, config) } catch (ex) { if (ex instanceof TypeError && config === 'destroy') { - console.error('Deprecated call $.tooltip(\'destroy\') has been deprecated and should be removed') + if (window.TESTING === undefined) { + console.error('Deprecated call $.tooltip(\'destroy\') has been deprecated and should be removed') + } return tooltip.call(this, 'dispose') } if (ex instanceof TypeError && config === 'fixTitle') { - console.error('Deprecated call $.tooltip(\'fixTitle\') has been deprecated and should be removed') + if (window.TESTING === undefined) { + console.error('Deprecated call $.tooltip(\'fixTitle\') has been deprecated and should be removed') + } return tooltip.call(this, '_fixTitle') } } -- cgit v1.2.3