mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] compiler: translatableAttributes can be added/removed
This commit is contained in:
committed by
Aaron Bohy
parent
140818b5f9
commit
2c1226d737
@@ -59,18 +59,20 @@ describe("translation support", () => {
|
||||
);
|
||||
});
|
||||
|
||||
test("can set translatable attributes", async () => {
|
||||
test("can set and remove translatable attributes", async () => {
|
||||
class SomeComponent extends Component {
|
||||
static template = xml`
|
||||
<div tomato="word" potato="word" title="word">text</div>
|
||||
<div tomato="word" potato="word" title="word" label="word">text</div>
|
||||
`;
|
||||
}
|
||||
|
||||
await mount(SomeComponent, fixture, {
|
||||
translateFn: (expr: string) => (expr === "word" ? "mot" : expr),
|
||||
translatableAttributes: ["potato"],
|
||||
translatableAttributes: ["potato", "-label"],
|
||||
});
|
||||
expect(fixture.innerHTML).toBe('<div tomato="word" potato="mot" title="word">text</div>');
|
||||
expect(fixture.innerHTML).toBe(
|
||||
'<div tomato="word" potato="mot" title="mot" label="word">text</div>'
|
||||
);
|
||||
});
|
||||
|
||||
test("translation is done on the trimmed text, with extra spaces readded after", async () => {
|
||||
|
||||
Reference in New Issue
Block a user