Bläddra i källkod

Feature: Add login-test for PinEdit UI

pull/169/head
winkidney 5 år sedan
committed by Isaac Bythewood
förälder
incheckning
68638deeb3
3 ändrade filer med 18 tillägg och 9 borttagningar
  1. +1
    -0
      pinry-spa/src/components/LoginForm.vue
  2. +4
    -1
      pinry-spa/src/components/Pins.vue
  3. +13
    -8
      pinry-spa/src/components/editors/PinEditorUI.vue

+ 1
- 0
pinry-spa/src/components/LoginForm.vue Visa fil

@@ -68,6 +68,7 @@ export default {
(user) => {
self.$emit('login.succeed', user);
self.$parent.close();
window.location.reload();
},
(resp) => {
self.helper.markFieldsAsDanger(resp.data);


+ 4
- 1
pinry-spa/src/components/Pins.vue Visa fil

@@ -24,7 +24,7 @@
v-show="shouldShowEdit(item.id)"
:pin="item"
:currentUsername="editorMeta.user.meta.username"
:currentBoardId="editorMeta.currentBoard.id"
:currentBoard="editorMeta.currentBoard"
v-on:pin-delete-succeed="reset"
v-on:pin-remove-from-board-succeed="reset"
></EditorUI>
@@ -150,6 +150,9 @@ export default {
},
methods: {
shouldShowEdit(id) {
if (!this.editorMeta.user.loggedIn) {
return false;
}
return this.editorMeta.currentEditId === id;
},
showEditButtons(id) {


+ 13
- 8
pinry-spa/src/components/editors/PinEditorUI.vue Visa fil

@@ -1,7 +1,7 @@
<template>
<div class="editor">
<div class="editor-buttons">
<span class="icon-container" v-if="inBoard" @click="removeFromBoard">
<span class="icon-container" v-if="inOwnedBoard" @click="removeFromBoard">
<b-icon
type="is-light"
icon="minus-box"
@@ -39,12 +39,14 @@ import API from '../api';
export default {
name: 'Editor',
props: {
currentBoardId: {
type: Number,
default: null,
currentBoard: {
type: Object,
default() {
return {};
},
},
currentUsername: {
default: '',
default: null,
type: String,
},
pin: {
@@ -58,8 +60,11 @@ export default {
isOwner() {
return this.pin.author === this.currentUsername;
},
inBoard() {
return this.currentBoardId !== null;
inOwnedBoard() {
return (
Object.values(this.currentBoard).length !== 0
&& this.currentBoard.submitter.username === this.currentUsername
);
},
},
methods: {
@@ -67,7 +72,7 @@ export default {
this.$buefy.dialog.confirm({
message: 'Remove Pin from Board?',
onConfirm: () => {
API.Board.removeFromBoard(this.currentBoardId, [this.pin.id]).then(
API.Board.removeFromBoard(this.currentBoard.id, [this.pin.id]).then(
() => {
this.$buefy.toast.open('Pin removed');
this.$emit('pin-remove-from-board-succeed', this.pin.id);


Laddar…
Avbryt
Spara