mrp_tests_widgets.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /** @odoo-module **/
  2. import { getFixture } from "@web/../tests/helpers/utils";
  3. import { makeView, setupViewRegistries } from "@web/../tests/views/helpers";
  4. let serverData;
  5. let target;
  6. QUnit.module("Mrp", (hooks) => {
  7. hooks.beforeEach(() => {
  8. target = getFixture();
  9. serverData = {
  10. models: {
  11. foo: {
  12. fields: {
  13. duration: { string: "Duration", type: "float" },
  14. },
  15. records: [{ id: 1, duration: 150.5 }],
  16. },
  17. },
  18. };
  19. setupViewRegistries();
  20. });
  21. QUnit.module("MrpTimer");
  22. QUnit.test("ensure the rendering is based on minutes and seconds", async function (assert) {
  23. await makeView({
  24. type: "form",
  25. serverData,
  26. resModel: "foo",
  27. resId: 1,
  28. arch: '<form><field name="duration" widget="mrp_timer" readonly="1"/></form>',
  29. });
  30. assert.strictEqual(
  31. target.querySelector(".o_field_mrp_timer").textContent,
  32. "150:30",
  33. "should not contain hours and be correctly set base on minutes seconds"
  34. );
  35. });
  36. });