diff --git a/src/components/UserProfileComponents/UserItems.vue b/src/components/UserProfileComponents/UserItems.vue index b20cc54235d7912027965299414328313fdd1162..88bd3ce45ce066f67be1739aba37e39c219ca129 100644 --- a/src/components/UserProfileComponents/UserItems.vue +++ b/src/components/UserProfileComponents/UserItems.vue @@ -33,7 +33,12 @@ class="grid grid-flow-row-dense grid-cols-2 md:grid-cols-4 lg:grid-cols-5 w-full" v-if="showItems" > - <div class="cardContainer" id="item" v-for="item in visibleItems" :key="item"> + <div + class="cardContainer" + id="item" + v-for="item in visibleItems" + :key="item" + > <ItemCard class="ItemCard w-fit h-fit" :item="item" /> <TripleDotButton class="DotButton" @click="openDotMenu(item)"> @@ -97,37 +102,38 @@ class="grid grid-flow-row-dense grid-cols-2 md:grid-cols-4 lg:grid-cols-5 w-full place-items-center" v-if="showSearchedItems" > - <div class="cardContainer" v-for="item in searchedItems" :key="item"> - <ItemCard class="ItemCard" :item="item" /> - <TripleDotButton class="DotButton" @click="openDotMenu(item)"> </TripleDotButton> + <div class="cardContainer" v-for="item in searchedItems" :key="item"> + <ItemCard class="ItemCard" :item="item" /> + <TripleDotButton class="DotButton" @click="openDotMenu(item)"> + </TripleDotButton> - <div - v-show="item.toggle" - class="options z-10 w-44 text-base list-none bg-white rounded divide-y divide-gray-100 shadow dark:bg-gray-700" - > - <ul - class="py-1 absolute bg-white ring-1 ring-gray-300 rounded-xl" - aria-labelledby="dropdownDefault" + <div + v-show="item.toggle" + class="options z-10 w-44 text-base list-none bg-white rounded divide-y divide-gray-100 shadow dark:bg-gray-700" > - <li> - <button - to="/user/userItems" - class="block py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white" - > - Rediger gjenstand - </button> - </li> - <li> - <button - @click="goToDeleteItem(item.listingID)" - class="block py-2 px-4 text-sm text-error-medium hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white" - > - Slett gjenstand - </button> - </li> - </ul> + <ul + class="py-1 absolute bg-white ring-1 ring-gray-300 rounded-xl" + aria-labelledby="dropdownDefault" + > + <li> + <button + to="/user/userItems" + class="block py-2 px-4 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white" + > + Rediger gjenstand + </button> + </li> + <li> + <button + @click="goToDeleteItem(item.listingID)" + class="block py-2 px-4 text-sm text-error-medium hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white" + > + Slett gjenstand + </button> + </li> + </ul> + </div> </div> - </div> <CustomFooterModal @close="this.readyToDelete = false" :visible="readyToDelete" @@ -222,14 +228,13 @@ export default { }, }, methods: { - openDotMenu(item){ - if(item.toggle == false){ - for(var i = 0; i<this.visibleItems.length; i++){ + openDotMenu(item) { + if (item.toggle == false) { + for (var i = 0; i < this.visibleItems.length; i++) { this.visibleItems[i].toggle = false; - } + } item.toggle = true; - } - else{ + } else { item.toggle = false; } }, @@ -263,7 +268,7 @@ export default { } }, goToDeleteItem(item) { - console.log("Halllllo: " + item) + console.log("Halllllo: " + item); this.chosenItem = item; this.readyToDelete = true; }, @@ -297,16 +302,15 @@ export default { margin-bottom: 10px; margin-left: 20px; } -.cardContainer{ +.cardContainer { position: relative; } -.DotButton{ +.DotButton { position: absolute; right: 40px; - bottom: 10px + bottom: 10px; } -.options{ +.options { position: absolute; } - </style> diff --git a/src/views/TestView.vue b/src/views/TestView.vue index 56ea3bde89d1b04f9818cd18a79e24c7e59b4576..f86430c64bb07d2f6e60fe0626ac1f50371d3682 100644 --- a/src/views/TestView.vue +++ b/src/views/TestView.vue @@ -1,18 +1,15 @@ <template> - <div> - </div> + <div></div> </template> <script> - export default { data() { return { show: false, }; }, - components: { - }, + components: {}, methods: { toggleModal() { this.show = !this.show; diff --git a/tests/unit/component-tests/community-component-tests/__snapshots__/community-header.spec.js.snap b/tests/unit/component-tests/community-component-tests/__snapshots__/community-header.spec.js.snap index cecad6a17a15604f5bcf46480b439199187ab9c9..e7df24bdd8074c7762732e44fcac5daf475f1c7d 100644 --- a/tests/unit/component-tests/community-component-tests/__snapshots__/community-header.spec.js.snap +++ b/tests/unit/component-tests/community-component-tests/__snapshots__/community-header.spec.js.snap @@ -2,16 +2,27 @@ exports[`CommunityHeader component renders correctly 1`] = ` <div - data-v-app="" + adminstatus="true" + class="flex place-content-center mx-4" + community="[object Object]" > - - <!-- TODO PUT A LOADER HERE --> <div - adminstatus="true" - community="[object Object]" + class="loadingio-spinner-bean-eater-o5tefvffeqm" > - LASTER... + <div + class="ldio-sweozsnwol" + > + <div> + <div /> + <div /> + <div /> + </div> + <div> + <div /> + <div /> + <div /> + </div> + </div> </div> - </div> `; diff --git a/tests/unit/component-tests/community-component-tests/__snapshots__/community-list-item.spec.js.snap b/tests/unit/component-tests/community-component-tests/__snapshots__/community-list-item.spec.js.snap index 5135f4b48c7b670b8c5b8173ad0d802a82b5ed0a..6ea43db8f525841f2ff49a8c9a1d45066552348b 100644 --- a/tests/unit/component-tests/community-component-tests/__snapshots__/community-list-item.spec.js.snap +++ b/tests/unit/component-tests/community-component-tests/__snapshots__/community-list-item.spec.js.snap @@ -1,10 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`CommunityListItem component renders correctly 1`] = ` -<div - data-v-app="" -> - +<div> <!-- Main modal --> <!--v-if--> @@ -50,6 +47,5 @@ exports[`CommunityListItem component renders correctly 1`] = ` </svg> </div> </div> - </div> `;