mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[CLEANUP] update prettier to v2.0.4
This commit is contained in:
@@ -27,7 +27,7 @@ afterEach(() => {
|
||||
|
||||
function children(w: Component): Component[] {
|
||||
const childrenMap = w.__owl__.children;
|
||||
return Object.keys(childrenMap).map(id => childrenMap[id]);
|
||||
return Object.keys(childrenMap).map((id) => childrenMap[id]);
|
||||
}
|
||||
|
||||
describe("async rendering", () => {
|
||||
@@ -404,7 +404,7 @@ describe("async rendering", () => {
|
||||
}
|
||||
class ChildB extends Component {
|
||||
willStart(): any {
|
||||
return new Promise(function() {});
|
||||
return new Promise(function () {});
|
||||
}
|
||||
}
|
||||
class Parent extends Component {
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
nextMicroTick,
|
||||
nextTick,
|
||||
normalize,
|
||||
editInput
|
||||
editInput,
|
||||
} from "../helpers";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -39,7 +39,7 @@ afterEach(() => {
|
||||
|
||||
function children(w: Component): Component[] {
|
||||
const childrenMap = w.__owl__.children;
|
||||
return Object.keys(childrenMap).map(id => childrenMap[id]);
|
||||
return Object.keys(childrenMap).map((id) => childrenMap[id]);
|
||||
}
|
||||
|
||||
// Test components
|
||||
@@ -133,7 +133,7 @@ describe("basic widget properties", () => {
|
||||
static template = xml`
|
||||
<div><t t-esc="state.counter"/><button t-on-click="state.counter++">Inc</button></div>`;
|
||||
state = useState({
|
||||
counter: 0
|
||||
counter: 0,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ describe("basic widget properties", () => {
|
||||
static template = xml`
|
||||
<div><t t-esc="state.counter"/><button t-on-click="state.counter++">Inc</button></div>`;
|
||||
state = useState({
|
||||
counter: 0
|
||||
counter: 0,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -537,7 +537,7 @@ describe("lifecycle hooks", () => {
|
||||
"child:mounted",
|
||||
"parent:willUnmount",
|
||||
"child:willUnmount",
|
||||
"childchild:willUnmount"
|
||||
"childchild:willUnmount",
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -589,7 +589,7 @@ describe("lifecycle hooks", () => {
|
||||
"childchild:willPatch",
|
||||
"childchild:patched",
|
||||
"child:patched",
|
||||
"parent:patched"
|
||||
"parent:patched",
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -782,7 +782,7 @@ describe("lifecycle hooks", () => {
|
||||
"c mounted",
|
||||
"p mounted",
|
||||
"p willunmount",
|
||||
"c willunmount"
|
||||
"c willunmount",
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -960,7 +960,7 @@ describe("lifecycle hooks", () => {
|
||||
"parent:willPatch",
|
||||
"child:willPatch",
|
||||
"child:patched",
|
||||
"parent:patched"
|
||||
"parent:patched",
|
||||
]);
|
||||
});
|
||||
});
|
||||
@@ -1134,7 +1134,7 @@ describe("composition", () => {
|
||||
class App extends Component {
|
||||
static template = xml`<t t-component="myComponent" t-key="state.child"/>`;
|
||||
state = useState({
|
||||
child: "a"
|
||||
child: "a",
|
||||
});
|
||||
get myComponent() {
|
||||
return this.state.child === "a" ? A : B;
|
||||
@@ -1158,7 +1158,7 @@ describe("composition", () => {
|
||||
class App extends Component {
|
||||
static template = xml`<t t-component="myComponent" t-key="state.child"/>`;
|
||||
state = useState({
|
||||
child: "a"
|
||||
child: "a",
|
||||
});
|
||||
get myComponent() {
|
||||
return this.state.child === "a" ? A : B;
|
||||
@@ -1228,7 +1228,7 @@ describe("composition", () => {
|
||||
static template = xml`
|
||||
<div><t t-esc="state.counter"/><button t-on-click="state.counter++">Inc</button></div>`;
|
||||
state = useState({
|
||||
counter: 0
|
||||
counter: 0,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1327,7 +1327,7 @@ describe("composition", () => {
|
||||
static template = xml`
|
||||
<div><t t-esc="state.counter"/><button t-on-click="state.counter++">Inc</button></div>`;
|
||||
state = useState({
|
||||
counter: 0
|
||||
counter: 0,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1350,7 +1350,7 @@ describe("composition", () => {
|
||||
static template = xml`
|
||||
<div><t t-esc="state.counter"/><button t-on-click="state.counter++">Inc</button></div>`;
|
||||
state = useState({
|
||||
counter: 0
|
||||
counter: 0,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1389,7 +1389,7 @@ describe("composition", () => {
|
||||
);
|
||||
class Parent extends Component {
|
||||
state = useState({
|
||||
numbers: [1, 2, 3]
|
||||
numbers: [1, 2, 3],
|
||||
});
|
||||
static components = { ChildWidget };
|
||||
}
|
||||
@@ -1429,7 +1429,7 @@ describe("composition", () => {
|
||||
class Parent extends Component {
|
||||
static template = "parent";
|
||||
state = useState({
|
||||
numbers: [1, 2, 3]
|
||||
numbers: [1, 2, 3],
|
||||
});
|
||||
static components = { ChildWidget };
|
||||
}
|
||||
@@ -1513,8 +1513,8 @@ describe("composition", () => {
|
||||
blips: [
|
||||
{ a: "a", id: 1 },
|
||||
{ b: "b", id: 2 },
|
||||
{ c: "c", id: 4 }
|
||||
]
|
||||
{ c: "c", id: 4 },
|
||||
],
|
||||
});
|
||||
}
|
||||
const parent = new Parent();
|
||||
@@ -1621,8 +1621,8 @@ describe("composition", () => {
|
||||
records: [
|
||||
{ id: 1, val: 1 },
|
||||
{ id: 2, val: 2 },
|
||||
{ id: 3, val: 3 }
|
||||
]
|
||||
{ id: 3, val: 3 },
|
||||
],
|
||||
});
|
||||
static components = { ChildWidget };
|
||||
}
|
||||
@@ -2003,7 +2003,7 @@ describe("other directives with t-component", () => {
|
||||
}
|
||||
const widget = new ParentWidget();
|
||||
await widget.mount(fixture);
|
||||
(<HTMLElement>fixture).addEventListener("ev", function(e) {
|
||||
(<HTMLElement>fixture).addEventListener("ev", function (e) {
|
||||
steps.push(e.defaultPrevented);
|
||||
});
|
||||
|
||||
@@ -2038,7 +2038,7 @@ describe("other directives with t-component", () => {
|
||||
}
|
||||
const widget = new ParentWidget();
|
||||
await widget.mount(fixture);
|
||||
(<HTMLElement>fixture).addEventListener("ev", function(e) {
|
||||
(<HTMLElement>fixture).addEventListener("ev", function (e) {
|
||||
steps.push(e.defaultPrevented);
|
||||
});
|
||||
|
||||
@@ -2976,7 +2976,7 @@ describe("random stuff/miscellaneous", () => {
|
||||
"D:mounted",
|
||||
"C:mounted",
|
||||
"B:mounted",
|
||||
"A:mounted"
|
||||
"A:mounted",
|
||||
]);
|
||||
|
||||
// update
|
||||
@@ -2999,7 +2999,7 @@ describe("random stuff/miscellaneous", () => {
|
||||
"E:destroy",
|
||||
"F:mounted",
|
||||
"D:patched",
|
||||
"C:patched"
|
||||
"C:patched",
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -3410,7 +3410,7 @@ describe("t-model directive", () => {
|
||||
state = useState([
|
||||
{ f: false, id: 1 },
|
||||
{ f: false, id: 2 },
|
||||
{ f: false, id: 3 }
|
||||
{ f: false, id: 3 },
|
||||
]);
|
||||
}
|
||||
const comp = new SomeComponent();
|
||||
@@ -3455,7 +3455,7 @@ describe("environment and plugins", () => {
|
||||
let bus = new EventBus();
|
||||
|
||||
// definition of a plugin
|
||||
const somePlugin = env => {
|
||||
const somePlugin = (env) => {
|
||||
env.someFlag = true;
|
||||
bus.on("some-event", null, () => {
|
||||
env.someFlag = !env.someFlag;
|
||||
|
||||
@@ -92,7 +92,7 @@ describe("props validation", () => {
|
||||
{ type: String, ok: "1", ko: 1 },
|
||||
{ type: Object, ok: {}, ko: "1" },
|
||||
{ type: Date, ok: new Date(), ko: "1" },
|
||||
{ type: Function, ok: () => {}, ko: "1" }
|
||||
{ type: Function, ok: () => {}, ko: "1" },
|
||||
];
|
||||
|
||||
let props;
|
||||
@@ -149,7 +149,7 @@ describe("props validation", () => {
|
||||
{ type: String, ok: "1", ko: 1 },
|
||||
{ type: Object, ok: {}, ko: "1" },
|
||||
{ type: Date, ok: new Date(), ko: "1" },
|
||||
{ type: Function, ok: () => {}, ko: "1" }
|
||||
{ type: Function, ok: () => {}, ko: "1" },
|
||||
];
|
||||
|
||||
let props;
|
||||
@@ -396,7 +396,7 @@ describe("props validation", () => {
|
||||
class TestWidget extends Component {
|
||||
static template = xml`<div>hey</div>`;
|
||||
static props = {
|
||||
p: { type: Object, shape: { id: Number, url: String } }
|
||||
p: { type: Object, shape: { id: Number, url: String } },
|
||||
};
|
||||
}
|
||||
class Parent extends Component {
|
||||
@@ -458,9 +458,9 @@ describe("props validation", () => {
|
||||
type: Object,
|
||||
shape: {
|
||||
id: Number,
|
||||
url: [Boolean, { type: Array, element: Number }]
|
||||
}
|
||||
}
|
||||
url: [Boolean, { type: Array, element: Number }],
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
class Parent extends Component {
|
||||
@@ -510,10 +510,10 @@ describe("props validation", () => {
|
||||
element: {
|
||||
type: Object,
|
||||
shape: {
|
||||
num: { type: Number, optional: true }
|
||||
}
|
||||
}
|
||||
}
|
||||
num: { type: Number, optional: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
let error;
|
||||
@@ -539,8 +539,8 @@ describe("props validation", () => {
|
||||
class TestComponent extends Component {
|
||||
static props = {
|
||||
size: {
|
||||
validate: e => ["small", "medium", "large"].includes(e)
|
||||
}
|
||||
validate: (e) => ["small", "medium", "large"].includes(e),
|
||||
},
|
||||
};
|
||||
}
|
||||
let error;
|
||||
@@ -561,13 +561,13 @@ describe("props validation", () => {
|
||||
});
|
||||
|
||||
test("can validate with a custom validator, and a type", () => {
|
||||
const validator = jest.fn(n => 0 <= n && n <= 10);
|
||||
const validator = jest.fn((n) => 0 <= n && n <= 10);
|
||||
class TestComponent extends Component {
|
||||
static props = {
|
||||
n: {
|
||||
type: Number,
|
||||
validate: validator
|
||||
}
|
||||
validate: validator,
|
||||
},
|
||||
};
|
||||
}
|
||||
let error;
|
||||
|
||||
@@ -28,7 +28,7 @@ afterEach(() => {
|
||||
|
||||
function children(w: Component): Component[] {
|
||||
const childrenMap = w.__owl__.children;
|
||||
return Object.keys(childrenMap).map(id => childrenMap[id]);
|
||||
return Object.keys(childrenMap).map((id) => childrenMap[id]);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -224,8 +224,8 @@ describe("t-slot directive", () => {
|
||||
state = useState({
|
||||
users: [
|
||||
{ id: 1, name: "Aaron" },
|
||||
{ id: 2, name: "David" }
|
||||
]
|
||||
{ id: 2, name: "David" },
|
||||
],
|
||||
});
|
||||
static components = { Link };
|
||||
}
|
||||
@@ -268,8 +268,8 @@ describe("t-slot directive", () => {
|
||||
state = useState({
|
||||
users: [
|
||||
{ id: 1, name: "Aaron" },
|
||||
{ id: 2, name: "David" }
|
||||
]
|
||||
{ id: 2, name: "David" },
|
||||
],
|
||||
});
|
||||
static components = { Link };
|
||||
}
|
||||
|
||||
@@ -335,7 +335,7 @@ describe("unmounting and remounting", () => {
|
||||
class Child extends Component {
|
||||
static template = xml`<span t-esc="state.val"/>`;
|
||||
state = useState({
|
||||
val: "C1"
|
||||
val: "C1",
|
||||
});
|
||||
constructor(parent, props) {
|
||||
super(parent, props);
|
||||
|
||||
Reference in New Issue
Block a user