Skip to content
Snippets Groups Projects
Commit 36b5d289 authored by Zara Mudassar's avatar Zara Mudassar
Browse files

item card related files deleted, now this branch only includes adding new item related files

parent f5467460
No related branches found
No related tags found
2 merge requests!19Item card,!17Item card
Pipeline #176186 passed with stages
in 1 minute and 20 seconds
......@@ -10,7 +10,8 @@
<label
class="block mb-2 text-sm font-medium text-gray-900 dark:text-gray-300"
id="titleLabel"
>Tittel</label>
>Tittel</label
>
<input
type="text"
id="title"
......
......@@ -27,11 +27,6 @@ const routes = [
name: "addNewItem",
component: () => import("../views/AddNewItemView.vue"),
},
{
path: "/itemCard",
name: "itemCard",
component: () => import("../views/ItemCardView.vue"),
},
];
const router = createRouter({
......
......@@ -2,37 +2,35 @@ import { shallowMount } from "@vue/test-utils";
import AddNewItem from "@/components/AddNewItem.vue";
describe("addNewItem elements rendering", () => {
it("renders all labels", () => {
const wrapper = shallowMount(AddNewItem);
expect(wrapper.find('#titleLabel').text()).toMatch("Tittel");
expect(wrapper.find('#selectCategoryLabel').text()).toMatch("Kategori");
expect(wrapper.find('#priceLabel').text()).toMatch("Pris");
expect(wrapper.find('#descriptionLabel').text()).toMatch("Beskrivelse");
expect(wrapper.find('#imageLabel').text()).toMatch("Bilde");
});
it("Tests setting values of input field", async() => {
const wrapper = shallowMount(AddNewItem);
const titleInput = wrapper.find('#title');
await titleInput.setValue("Dyson");
expect(titleInput.element.value).toBe("Dyson");
const selectedCategory = wrapper.find('#categories');
await selectedCategory.setValue("Hage");
expect(selectedCategory.element.value).toBe("Hage");
const priceInput = wrapper.find('#price');
await priceInput.setValue(500);
expect(priceInput.element.value).toBe("500");
const descriptionInput = wrapper.find('#description');
await descriptionInput.setValue("Dette er en støvsuer fra Dyson");
expect(descriptionInput.element.value).toBe("Dette er en støvsuer fra Dyson");
});
it("renders all labels", () => {
const wrapper = shallowMount(AddNewItem);
expect(wrapper.find("#titleLabel").text()).toMatch("Tittel");
expect(wrapper.find("#selectCategoryLabel").text()).toMatch("Kategori");
expect(wrapper.find("#priceLabel").text()).toMatch("Pris");
expect(wrapper.find("#descriptionLabel").text()).toMatch("Beskrivelse");
expect(wrapper.find("#imageLabel").text()).toMatch("Bilde");
});
it("Tests setting values of input field", async () => {
const wrapper = shallowMount(AddNewItem);
const titleInput = wrapper.find("#title");
await titleInput.setValue("Dyson");
expect(titleInput.element.value).toBe("Dyson");
const selectedCategory = wrapper.find("#categories");
await selectedCategory.setValue("Hage");
expect(selectedCategory.element.value).toBe("Hage");
const priceInput = wrapper.find("#price");
await priceInput.setValue(500);
expect(priceInput.element.value).toBe("500");
const descriptionInput = wrapper.find("#description");
await descriptionInput.setValue("Dette er en støvsuer fra Dyson");
expect(descriptionInput.element.value).toBe(
"Dette er en støvsuer fra Dyson"
);
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment