[FIX] web: avoid warning during qweb tests

One of the qweb tests checks that in a t-set @t-value takes priority
over body contents. However this construct also triggers a warning
when invoked.

Mock out `window.console` during qweb tests, this suppresses that
warning.
This commit is contained in:
Xavier Morel
2021-06-29 05:34:17 +00:00
parent de5aceb88e
commit b39c5072f7
2 changed files with 13 additions and 1 deletions
+5
View File
@@ -208,3 +208,8 @@ export async function legacyExtraNextTick() {
export function mockDownload(cb) {
patchWithCleanup(download, { _download: cb });
}
export const hushConsole = Object.create(null);
for(const propName of Object.keys(window.console)) {
hushConsole[propName] = () => {}
}
+8 -1
View File
@@ -2,6 +2,7 @@ odoo.define('web.qweb_tests', function (require) {
"use strict";
var qwebPath = '/web/static/lib/qweb/';
const {hushConsole} = require('@web/../tests/helpers/utils');
function trim(s) {
return s.replace(/(^\s+|\s+$)/g, '');
@@ -63,7 +64,13 @@ function loadTest(assert, template, context) {
return prom;
}
QUnit.module('QWeb', {}, function () {
QUnit.module('QWeb', {
before() {
this.oldConsole = window.console;
window.console = hushConsole;
},
after() {window.console = this.oldConsole;}
}, function () {
QUnit.test('Output', function (assert) {
loadTest(assert, 'qweb-test-output.xml');
});