[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:
@@ -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] = () => {}
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user