| 1 |
import { expect, test } from "@odoo/hoot"; |
| 2 |
import { defineModels, fields, models, mountView } from "@web/../tests/web_test_helpers"; |
| 3 |
|
| 4 |
class Product extends models.Model { |
| 5 |
json_field = fields.Json(); |
| 6 |
|
| 7 |
_records = [{ id: 1, json_field: "['coupon', 'promotion']" }]; |
| 8 |
} |
| 9 |
|
| 10 |
defineModels([Product]); |
| 11 |
|
| 12 |
test("basic rendering", async () => { |
| 13 |
await mountView({ |
| 14 |
type: "form", |
| 15 |
resModel: "product", |
| 16 |
resId: 1, |
| 17 |
arch: '<form><field name="json_field"/></form>', |
| 18 |
}); |
| 19 |
expect(".o_field_json").toHaveCount(1); |
| 20 |
expect(".o_field_json span").toHaveText(`"['coupon', 'promotion']"`); |
| 21 |
}); |