import { expect, test } from "@odoo/hoot"; import { animationFrame } from "@odoo/hoot-mock"; import { Component, onWillStart, reactive, useChildSubEnv, useState, useSubEnv, xml, } from "@odoo/owl"; import { defineModels, fields, makeMockEnv, models, mountWithCleanup, mountWithSearch, } from "@web/../tests/web_test_helpers"; import { useService } from "@web/core/utils/hooks"; import { Layout } from "@web/search/layout"; import { SearchModel } from "@web/search/search_model"; import { getDefaultConfig } from "@web/views/view"; class Foo extends models.Model { aaa = fields.Selection({ selection: [ ["a", "A"], ["b", "B"], ], }); _views = { search: ` `, }; } defineModels([Foo]); test(`Simple rendering`, async () => { class ToyComponent extends Component { static props = ["*"]; static template = xml`
`; static components = { Layout }; } await mountWithCleanup(ToyComponent, { env: await makeMockEnv({ config: {} }), }); expect(`.o_view_sample_data`).toHaveCount(1); expect(`.o_control_panel`).toHaveCount(0); expect(`.o_component_with_search_panel`).toHaveCount(0); expect(`.o_search_panel`).toHaveCount(0); expect(`.o_content > .toy_content`).toHaveCount(1); }); test(`Simple rendering: with search`, async () => { class ToyComponent extends Component { static props = ["*"]; static template = xml`