[IMP] qweb: turn handlers into function expressions only

For the sake of consistency with vanilla JS, and to allow some things
that were previously not possible.
This commit is contained in:
Samuel Degueldre
2021-11-12 12:56:07 +01:00
committed by Géry Debongnie
parent d60a5a414e
commit e611c20ab4
33 changed files with 280 additions and 227 deletions
+2 -2
View File
@@ -370,7 +370,7 @@ describe("basics", () => {
test("can be clicked on and updated", async () => {
class Counter extends Component {
static template = xml`
<div><t t-esc="state.counter"/><button t-on-click="state.counter++">Inc</button></div>`;
<div><t t-esc="state.counter"/><button t-on-click="() => state.counter++">Inc</button></div>`;
state = useState({
counter: 0,
});
@@ -387,7 +387,7 @@ describe("basics", () => {
test("rerendering a widget with a sub widget", async () => {
class Counter extends Component {
static template = xml`
<div><t t-esc="state.counter"/><button t-on-click="state.counter++">Inc</button></div>`;
<div><t t-esc="state.counter"/><button t-on-click="() => state.counter++">Inc</button></div>`;
state = useState({
counter: 0,
});