| 1 |
import { expect, test } from "@odoo/hoot"; |
| 2 |
import { mountWithCleanup } from "@web/../tests/web_test_helpers"; |
| 3 |
import { Component, useState, xml } from "@odoo/owl"; |
| 4 |
import { OdooLogo } from "@point_of_sale/app/components/odoo_logo/odoo_logo"; |
| 5 |
import { CenteredIcon } from "@point_of_sale/app/components/centered_icon/centered_icon"; |
| 6 |
import { Input } from "@point_of_sale/app/components/inputs/input/input"; |
| 7 |
import { NumericInput } from "@point_of_sale/app/components/inputs/numeric_input/numeric_input"; |
| 8 |
import { registry } from "@web/core/registry"; |
| 9 |
import { waitFor } from "@odoo/hoot-dom"; |
| 10 |
|
| 11 |
test("test that generic components can be mounted; the goal is to ensure that they don't have any unmet dependencies", async () => { |
| 12 |
class TestComponent extends Component { |
| 13 |
static props = []; |
| 14 |
static components = { |
| 15 |
OdooLogo, |
| 16 |
CenteredIcon, |
| 17 |
Input, |
| 18 |
NumericInput, |
| 19 |
}; |
| 20 |
static template = xml` |
| 21 |
<div class="test-container"> |
| 22 |
<OdooLogo /> |
| 23 |
<CenteredIcon icon="'fa-smile'"/> |
| 24 |
<Input tModel="[state, 'number']"/> |
| 25 |
<NumericInput tModel="[state, 'number']" /> |
| 26 |
</div> |
| 27 |
`; |
| 28 |
setup() { |
| 29 |
this.state = useState({ number: 1 }); |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
registry.category("services").content = {}; |
| 34 |
|
| 35 |
await mountWithCleanup(TestComponent, { |
| 36 |
noMainContainer: true, |
| 37 |
}); |
| 38 |
await waitFor("div.test-container"); |
| 39 |
expect(true).toBe(true); |
| 40 |
}); |