mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] config: add enableTransitions flag to config
It is useful to be able to disable the t-transition directive for testing purposes. This commit introduces a global config flag to do just that. closes #768
This commit is contained in:
@@ -8,6 +8,7 @@ import { QWeb } from "./qweb/index";
|
||||
|
||||
interface Config {
|
||||
mode: string;
|
||||
enableTransitions: boolean;
|
||||
}
|
||||
|
||||
export const config = {} as Config;
|
||||
@@ -28,3 +29,12 @@ Object.defineProperty(config, "mode", {
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(config, "enableTransitions", {
|
||||
get() {
|
||||
return QWeb.enableTransitions;
|
||||
},
|
||||
set(value: boolean) {
|
||||
QWeb.enableTransitions = value;
|
||||
},
|
||||
});
|
||||
|
||||
@@ -205,6 +205,9 @@ QWeb.addDirective({
|
||||
name: "transition",
|
||||
priority: 96,
|
||||
atNodeCreation({ ctx, value, addNodeHook }) {
|
||||
if (!QWeb.enableTransitions) {
|
||||
return;
|
||||
}
|
||||
ctx.rootContext.shouldDefineUtils = true;
|
||||
let name = value;
|
||||
const hooks = {
|
||||
|
||||
@@ -212,6 +212,7 @@ export class QWeb extends EventBus {
|
||||
h = h;
|
||||
// dev mode enables better error messages or more costly validations
|
||||
static dev: boolean = false;
|
||||
static enableTransitions: boolean = true;
|
||||
|
||||
// slots contains sub templates defined with t-set inside t-component nodes, and
|
||||
// are meant to be used by the t-slot directive.
|
||||
|
||||
Reference in New Issue
Block a user