| 1 |
import { expect, test } from "@odoo/hoot"; |
| 2 |
|
| 3 |
import { KanbanCompiler } from "@web/views/kanban/kanban_compiler"; |
| 4 |
|
| 5 |
function compileTemplate(arch) { |
| 6 |
const parser = new DOMParser(); |
| 7 |
const xml = parser.parseFromString(arch, "text/xml"); |
| 8 |
const compiler = new KanbanCompiler({ kanban: xml.documentElement }); |
| 9 |
return compiler.compile("kanban"); |
| 10 |
} |
| 11 |
|
| 12 |
test("bootstrap dropdowns with kanban_ignore_dropdown class should be left as is", async () => { |
| 13 |
const arch = ` |
| 14 |
<kanban> |
| 15 |
<templates> |
| 16 |
<t t-name="card"> |
| 17 |
<button name="dropdown" class="kanban_ignore_dropdown" type="button" data-bs-toggle="dropdown">Boostrap dropdown</button> |
| 18 |
<div class="dropdown-menu kanban_ignore_dropdown" role="menu"> |
| 19 |
<span>Dropdown content</span> |
| 20 |
</div> |
| 21 |
</t> |
| 22 |
</templates> |
| 23 |
</kanban>`; |
| 24 |
const expected = ` |
| 25 |
<t t-translation="off"> |
| 26 |
<kanban> |
| 27 |
<templates> |
| 28 |
<t t-name="card"> |
| 29 |
<button name="dropdown" class="kanban_ignore_dropdown" type="button" data-bs-toggle="dropdown">Boostrap dropdown</button> |
| 30 |
<div class="dropdown-menu kanban_ignore_dropdown" role="menu"> |
| 31 |
<span>Dropdown content</span> |
| 32 |
</div> |
| 33 |
</t> |
| 34 |
</templates> |
| 35 |
</kanban> |
| 36 |
</t>`; |
| 37 |
expect(compileTemplate(arch)).toHaveOuterHTML(expected); |
| 38 |
}); |