[IMP] qweb, blockdom, components: t-on with modifiers

supported modifiers: capture, prevent, stop, self.
This commit is contained in:
Lucas Perais (lpe)
2021-10-27 14:45:29 +02:00
committed by Aaron Bohy
parent 2ae0149adb
commit 4cceb239dd
11 changed files with 427 additions and 39 deletions
@@ -98,7 +98,7 @@ exports[`basics can be clicked on and updated 1`] = `
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['state'].counter;
const v1 = ctx['state'];
let d2 = (e) => {const res = (() => { return v1.counter++ })(); if (typeof res === 'function') { res(e) }};
let d2 = [(e) => {const res = (() => { return v1.counter++ })(); if (typeof res === 'function') { res(e) }}];
return block1([d1, d2]);
}
}"
@@ -598,7 +598,7 @@ exports[`basics rerendering a widget with a sub widget 1`] = `
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['state'].counter;
const v1 = ctx['state'];
let d2 = (e) => {const res = (() => { return v1.counter++ })(); if (typeof res === 'function') { res(e) }};
let d2 = [(e) => {const res = (() => { return v1.counter++ })(); if (typeof res === 'function') { res(e) }}];
return block1([d1, d2]);
}
}"
@@ -42,7 +42,7 @@ exports[`event handling support for callable expression in event handler 1`] = `
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['state'].value;
const v1 = ctx['obj'];
let d2 = (e) => {const res = (() => { return v1.onInput })(); if (typeof res === 'function') { res(e) }};
let d2 = [(e) => {const res = (() => { return v1.onInput })(); if (typeof res === 'function') { res(e) }}];
return block1([d1, d2]);
}
}"
@@ -137,7 +137,7 @@ exports[`t-component modifying a sub widget 1`] = `
return function template(ctx, node, key = \\"\\") {
let d1 = ctx['state'].counter;
const v1 = ctx['state'];
let d2 = (e) => {const res = (() => { return v1.counter++ })(); if (typeof res === 'function') { res(e) }};
let d2 = [(e) => {const res = (() => { return v1.counter++ })(); if (typeof res === 'function') { res(e) }}];
return block1([d1, d2]);
}
}"
@@ -20,7 +20,7 @@ exports[`t-on t-on expression captured in t-foreach 1`] = `
let key1 = ctx['val'];
const v1 = ctx['otherState'];
const v2 = ctx['iter'];
let d1 = (e) => {const res = (() => { return v1.vals.push(v2+'_'+v2) })(); if (typeof res === 'function') { res(e) }};
let d1 = [(e) => {const res = (() => { return v1.vals.push(v2+'_'+v2) })(); if (typeof res === 'function') { res(e) }}];
setContextValue(ctx, \\"iter\\", ctx['iter']+1);
c_block2[i1] = withKey(block3([d1]), key1);
}
@@ -50,7 +50,7 @@ exports[`t-on t-on expression in t-foreach 1`] = `
let d2 = ctx['val']+'';
const v1 = ctx['otherState'];
const v2 = ctx['val'];
let d3 = (e) => {const res = (() => { return v1.vals.push(v2) })(); if (typeof res === 'function') { res(e) }};
let d3 = [(e) => {const res = (() => { return v1.vals.push(v2) })(); if (typeof res === 'function') { res(e) }}];
c_block2[i1] = withKey(block3([d1, d2, d3]), key1);
}
let b2 = list(c_block2);
@@ -84,7 +84,7 @@ exports[`t-on t-on expression in t-foreach with t-set 1`] = `
const v1 = ctx['otherState'];
const v2 = ctx['val'];
const v3 = ctx['bossa'];
let d3 = (e) => {const res = (() => { return v1.vals.push(v2+'_'+v3) })(); if (typeof res === 'function') { res(e) }};
let d3 = [(e) => {const res = (() => { return v1.vals.push(v2+'_'+v3) })(); if (typeof res === 'function') { res(e) }}];
c_block2[i1] = withKey(block3([d1, d2, d3]), key1);
}
let b2 = list(c_block2);