Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deploy merge
- Loading branch information
Showing
17 changed files
with
546 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<template> | ||
<BaseButton text="open" class="d-none" role="button" @click="open = true" /> | ||
<v-dialog v-model="open" v-if="open" :class="modalSize"> | ||
<v-card> | ||
<v-card-title> | ||
<span class="text-h5">{{ title }}</span> | ||
</v-card-title> | ||
<v-card-text> | ||
<v-container> | ||
<v-text-field | ||
label="카드 뭉치 이름" | ||
required | ||
v-model="learnsetTitle" | ||
></v-text-field> | ||
</v-container> | ||
</v-card-text> | ||
<v-card-actions> | ||
<BaseButton | ||
text="진행 상태 초기화" | ||
color="error" | ||
variant="text" | ||
data-testid="close" | ||
@click="resetLearnset" | ||
/> | ||
<v-spacer></v-spacer> | ||
<BaseButton | ||
text="취소" | ||
color="primary-darken-2" | ||
variant="text" | ||
data-testid="close" | ||
@click="open = false" | ||
/> | ||
<BaseButton | ||
text="수정" | ||
color="primary" | ||
variant="text" | ||
data-testid="save" | ||
@click="editLearnset" | ||
/> | ||
</v-card-actions> | ||
</v-card> | ||
</v-dialog> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import BaseButton from './BaseButton.vue'; | ||
import { ref, computed, watchEffect } from 'vue'; | ||
import { useDisplay } from 'vuetify'; | ||
import useModal from '@/hooks/useModal'; | ||
const { open, toggleModal } = useModal(); | ||
const emit = defineEmits(['editLearnset', 'resetLearnset']); | ||
const props = defineProps({ | ||
title: { | ||
type: String, | ||
}, | ||
learnsetTitle: { | ||
type: String, | ||
required: true, | ||
}, | ||
}); | ||
const learnsetTitle = ref(''); | ||
watchEffect(() => (learnsetTitle.value = props.learnsetTitle)); | ||
const resetLearnset = () => { | ||
const reset = confirm('이 카드 뭉치의 학습 진행 상태를 초기화하시겠습니까?'); | ||
if (reset) { | ||
open.value = false; | ||
emit('resetLearnset'); | ||
} | ||
return; | ||
}; | ||
const editLearnset = () => { | ||
open.value = false; | ||
emit('editLearnset', learnsetTitle.value); | ||
}; | ||
const { name } = useDisplay(); | ||
const modalSize = computed(() => { | ||
switch (name.value) { | ||
case 'xs': | ||
case 'sm': | ||
return 'w-100'; | ||
case 'md': | ||
return 'w-75'; | ||
default: | ||
return 'w-25'; | ||
} | ||
}); | ||
defineExpose({ | ||
toggleModal, | ||
}); | ||
</script> | ||
|
||
<style scoped></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import EditLearnsetModal from '@/components/EditLearnsetModal.vue'; | ||
import { render, fireEvent } from '@testing-library/vue'; | ||
import vuetify from '@/utils/setupVuetify'; | ||
|
||
describe('EditLearnsetModal Component', () => { | ||
const title = '카드 뭉치 추가하기'; | ||
const learnsetTitle = 'learnset title'; | ||
|
||
it(`Modal이 전달한 text와 함께 렌더링된다.`, async () => { | ||
const { getByRole } = render(EditLearnsetModal, { | ||
global: { | ||
plugins: [vuetify], | ||
}, | ||
props: { | ||
title, | ||
learnsetTitle, | ||
}, | ||
}); | ||
|
||
// open | ||
await fireEvent.click(getByRole('button')); | ||
const input = getByRole('textbox', { name: '카드 뭉치 이름' }); | ||
expect(input).toHaveValue(learnsetTitle); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ref } from 'vue'; | ||
export default function useModal() { | ||
const open = ref(false); | ||
const toggleModal = () => { | ||
open.value = !open.value; | ||
}; | ||
|
||
return { | ||
open, | ||
toggleModal, | ||
}; | ||
} |
Oops, something went wrong.
15ed894
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
flashmd – ./
flashmd-git-main-padosum.vercel.app
flashmd-padosum.vercel.app
flash.padosum.dev
flashmd.vercel.app