Files
mealie/frontend/app/components/Domain/Recipe/RecipeStepCooking.test.ts
T
jfmcarreira 05cfb98ceb
Release Drafter / auto_label (push) Skipped
Backend Lint and Test / tests (sqlite) (push) Canceled after 0s
Backend Lint and Test / tests (postgres) (push) Canceled after 0s
Docker Nightly Production / Backend Server Tests (push) Canceled after 0s
Frontend Lint and Test / lint (push) Canceled after 0s
Docker Nightly Production / Frontend Tests (push) Canceled after 0s
Build Package / Build frontend and wheel (push) Canceled after 0s
Docker Nightly Production / Build Package (push) Canceled after 0s
Docker Nightly Production / Build E2E Image Cache (push) Canceled after 0s
Docker Nightly Production / Build Tagged Release (push) Canceled after 0s
Docker Nightly Production / Notify Discord (push) Canceled after 0s
CodeQL / Analyze (javascript-typescript) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
Release Drafter / draft_release (push) Canceled after 0s
feat(recipe): add step quantities and appliance settings
2026-11-30 14:44:17 +00:00

36 lines
1.5 KiB
TypeScript

import { mount } from "@vue/test-utils";
import { describe, expect, test } from "vitest";
import { createVuetify } from "vuetify";
import * as components from "vuetify/components";
import * as directives from "vuetify/directives";
import RecipeStepCooking from "./RecipeStepCooking.vue";
describe("RecipeStepCooking", () => {
test("displays numeric and named settings", () => {
const wrapper = mount(RecipeStepCooking, {
props: { modelValue: { appliance: "thermomix", temperatureCelsius: 120, speed: "spoon", mode: "steaming" } },
});
expect(wrapper.text()).toContain("120 °C");
expect(wrapper.text()).toContain("Speed: spoon");
expect(wrapper.text()).toContain("steaming");
});
test("edits whole degrees without replacing an imported fraction on focus and blur", async () => {
const wrapper = mount(RecipeStepCooking, {
props: { modelValue: { temperatureCelsius: 37.5 }, edit: true },
global: { plugins: [createVuetify({ components, directives })] },
});
const field = wrapper.findComponent(components.VNumberInput);
const input = field.find("input");
expect(field.props("precision")).toBe(0);
expect(field.props("step")).toBe(1);
expect(input.element.value).toBe("38");
expect(wrapper.text()).toContain("37.5 °C");
await input.trigger("focus");
await input.trigger("blur");
expect(wrapper.emitted("update:modelValue")).toBeUndefined();
await input.setValue("39");
expect(wrapper.emitted("update:modelValue")?.at(-1)).toEqual([{ temperatureCelsius: 39 }]);
});
});