mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] component: add static css support for sub components
part of issue #80
This commit is contained in:
@@ -1224,6 +1224,37 @@ describe("props evaluation (with t-props directive)", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("class and style attributes with t-widget", () => {
|
||||
test("class is properly added on widget root el", async () => {
|
||||
class ParentWidget extends Widget {
|
||||
inlineTemplate = `
|
||||
<div>
|
||||
<t t-widget="child" class="a b"/>
|
||||
</div>`;
|
||||
widgets = { child: Child };
|
||||
}
|
||||
class Child extends Widget {
|
||||
inlineTemplate = `<div class="c"/>`
|
||||
}
|
||||
const widget = new ParentWidget(env);
|
||||
await widget.mount(fixture);
|
||||
expect(fixture.innerHTML).toBe(`<div><div class="c a b"></div></div>`);
|
||||
});
|
||||
|
||||
test("style is properly added on widget root el", async () => {
|
||||
class ParentWidget extends Widget {
|
||||
inlineTemplate = `
|
||||
<div>
|
||||
<t t-widget="child" style="font-weight: bold;"/>
|
||||
</div>`;
|
||||
widgets = { child: Widget };
|
||||
}
|
||||
const widget = new ParentWidget(env);
|
||||
await widget.mount(fixture);
|
||||
expect(fixture.innerHTML).toBe(`<div><div style="font-weight: bold;"></div></div>`);
|
||||
});
|
||||
});
|
||||
|
||||
describe("other directives with t-widget", () => {
|
||||
test("t-on works as expected", async () => {
|
||||
let n = 0;
|
||||
|
||||
Reference in New Issue
Block a user