diff --git a/src/components/AddNewItem.vue b/src/components/AddNewItem.vue index e1cd2e80c7c8fde4cce0132a5c328a900a0ee258..cfe5ea645bcbfd2cff19a9a68d46499547f45e4c 100644 --- a/src/components/AddNewItem.vue +++ b/src/components/AddNewItem.vue @@ -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" diff --git a/src/router/index.js b/src/router/index.js index 6529bc29c9b04e5b87ec1a10fa05b5838410a221..acdbd4728e02cbc12be70df081e1355d9c5c8bb8 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -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({ diff --git a/tests/unit/add-new-item.spec.js b/tests/unit/add-new-item.spec.js index fd33aed11e982377e4bfe0d8f9370f89535a280f..930eceba9362b86b5cc0b664dad1b82af987a467 100644 --- a/tests/unit/add-new-item.spec.js +++ b/tests/unit/add-new-item.spec.js @@ -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" + ); + }); });