Skip to content
Snippets Groups Projects
Commit 4b458657 authored by henrikburmann's avatar henrikburmann
Browse files

Made some tests

parent 040dddc2
No related branches found
No related tags found
1 merge request!127Delete user
......@@ -43,10 +43,10 @@
</div>
<notification-modal
@click="routeToHome"
:visible="sendRequestClicked"
:title="'Vellykket'"
:message="'Forespørsel sendt!'"
@click="routeToHome"
:visible="sendRequestClicked"
:title="'Vellykket'"
:message="'Forespørsel sendt!'"
>
</notification-modal>
</div>
......
......@@ -39,7 +39,7 @@
v-for="item in visibleItems"
:key="item"
>
<ItemCard class="ItemCard w-fit h-fit" :item="item" />
<ItemCard id="ItemCardPage" class="ItemCard w-fit h-fit" :item="item" />
<TripleDotButton class="DotButton" @click="openDotMenu(item)">
</TripleDotButton>
......@@ -103,7 +103,7 @@
v-if="showSearchedItems"
>
<div class="cardContainer" v-for="item in searchedItems" :key="item">
<ItemCard class="ItemCard" :item="item" />
<ItemCard id="ItemCardSearch" class="ItemCard" :item="item" />
<TripleDotButton class="DotButton" @click="openDotMenu(item)">
</TripleDotButton>
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`UserItems component renders correctly 1`] = `
<div
data-v-app=""
>
<div
class="text-xl md:text-2xl text-primary-light font-medium"
id="headline"
>
Mine gjenstander
</div>
<!-- Search field -->
<div
class="relative"
id="searchComponent"
>
<span
class="absolute inset-y-0 left-0 flex items-center pl-3"
>
<svg
class="w-5 h-5 text-gray-400"
fill="none"
viewBox="0 0 24 24"
>
<path
d="M21 21L15 15M17 10C17 13.866 13.866 17 10 17C6.13401 17 3 13.866 3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10Z"
stroke="currentColor"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
/>
</svg>
</span>
<input
class="w-full py-3 pl-10 pr-4 text-gray-700 bg-white border rounded-md dark:bg-gray-800 dark:text-gray-300 dark:border-gray-600 focus:border-primary-medium dark:focus:border-primary-medium focus:outline-none focus:ring"
id="searchInput"
placeholder="Search"
type="text"
/>
</div>
<div
class="absolute inset-x-0 px-5 py-3"
>
<!-- ItemCards -->
<div
class="flex items-center justify-center w-screen"
>
<!-- Shows items based on pagination -->
<div
class="grid grid-flow-row-dense grid-cols-2 md:grid-cols-4 lg:grid-cols-5 w-full"
>
<!-- Main modal -->
<!--v-if-->
</div>
<!-- Shows items based on search field input -->
<!--v-if-->
</div>
<!-- pagination -->
<div
class="flex justify-center"
>
<!--v-if-->
</div>
</div>
</div>
`;
import { mount } from "@vue/test-utils";
import UserItems from "@/components/UserProfileComponents/UserItems.vue";
describe("UserItems component", () => {
let wrapper;
beforeEach(() => {
wrapper = mount(UserItems, {
props: {
ItemCard: {
item: {
listingID: 1,
img: "",
address: "Veien",
title: "Matboks",
pricePerDay: 50,
toggle: false,
}
}
}
});
});
it("renders correctly", () => {
expect(wrapper.element).toMatchSnapshot();
});
it("is instantiated", () => {
expect(wrapper.exists()).toBeTruthy();
});
it("Check information", () => {
const byID = wrapper.find("#ItemCardPage");
expect(byID.item.title.)
})
});
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