From 7b7e5da619bfbaeb6de2773dd346501e57268671 Mon Sep 17 00:00:00 2001 From: sahara2006 Date: Fri, 14 Aug 2026 22:28:03 +0900 Subject: [PATCH 1/9] =?UTF-8?q?=E3=81=9D=E3=82=8C=E3=81=A3=E3=81=BD?= =?UTF-8?q?=E3=81=84=E3=82=AB=E3=83=BC=E3=83=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/RoomCard.story.vue | 27 +++++ client/src/RoomCard.vue | 157 ++++++++++++++++++++++++++ client/src/__tests__/RoomCard.spec.ts | 40 +++++++ client/src/assets/main.css | 1 + 4 files changed, 225 insertions(+) create mode 100644 client/src/RoomCard.story.vue create mode 100644 client/src/RoomCard.vue create mode 100644 client/src/__tests__/RoomCard.spec.ts diff --git a/client/src/RoomCard.story.vue b/client/src/RoomCard.story.vue new file mode 100644 index 0000000..407a42d --- /dev/null +++ b/client/src/RoomCard.story.vue @@ -0,0 +1,27 @@ + + + diff --git a/client/src/RoomCard.vue b/client/src/RoomCard.vue new file mode 100644 index 0000000..77cc52a --- /dev/null +++ b/client/src/RoomCard.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/client/src/__tests__/RoomCard.spec.ts b/client/src/__tests__/RoomCard.spec.ts new file mode 100644 index 0000000..78cdcf7 --- /dev/null +++ b/client/src/__tests__/RoomCard.spec.ts @@ -0,0 +1,40 @@ +import { describe, expect, it } from 'vitest' +import { mount } from '@vue/test-utils' + +import RoomCard from '../RoomCard.vue' + +const room = { + id: 'room-01', + number: 1, + title: 'Room 01', + genre: 'General', + description: 'A cozy room for general discussions.', +} + +describe('RoomCard', () => { + it('renders the collapsed card shell', () => { + const wrapper = mount(RoomCard, { props: { room } }) + + expect(wrapper.get('article').classes()).toContain('room-card') + expect(wrapper.get('button').text()).toContain('Room 01') + expect(wrapper.find('.room-card__body').exists()).toBe(false) + }) + + it('opens and closes its content from the header button', async () => { + const wrapper = mount(RoomCard, { props: { room } }) + + await wrapper.get('button').trigger('click') + expect(wrapper.get('.room-card__description').text()).toBe(room.description) + + await wrapper.get('button').trigger('click') + expect(wrapper.find('.room-card__body').exists()).toBe(false) + }) + + it('emits the room from the start button', async () => { + const wrapper = mount(RoomCard, { props: { room, defaultOpen: true } }) + + await wrapper.get('.room-card__start').trigger('click') + + expect(wrapper.emitted('start')).toEqual([[room]]) + }) +}) diff --git a/client/src/assets/main.css b/client/src/assets/main.css index d02ba61..944abe7 100644 --- a/client/src/assets/main.css +++ b/client/src/assets/main.css @@ -1,3 +1,4 @@ +@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&icon_names=keyboard_arrow_down'); @import 'tailwindcss'; :root { From 5d920f1a183598a1e29ff752ad37da960a503eb0 Mon Sep 17 00:00:00 2001 From: sahara2006 Date: Fri, 14 Aug 2026 22:54:46 +0900 Subject: [PATCH 2/9] format --- client/src/RoomCard.vue | 194 ++++++++++++++++++++++------------------ 1 file changed, 105 insertions(+), 89 deletions(-) diff --git a/client/src/RoomCard.vue b/client/src/RoomCard.vue index 77cc52a..203c6b5 100644 --- a/client/src/RoomCard.vue +++ b/client/src/RoomCard.vue @@ -2,156 +2,172 @@ import { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue' export interface Room { - id: string - number: number - title: string - genre: string - description: string + id: string + number: number + title: string + genre: string + description: string } -withDefaults(defineProps<{ +withDefaults( + defineProps<{ room: Room defaultOpen?: boolean starting?: boolean -}>(), { + }>(), + { defaultOpen: false, starting: false, -}) + }, +) const emit = defineEmits<{ - start: [room: Room] + start: [room: Room] }>() From 97d5c152f5d5d0384472f716f7f53aa6b4b2d249 Mon Sep 17 00:00:00 2001 From: sahara2006 Date: Fri, 14 Aug 2026 23:10:30 +0900 Subject: [PATCH 3/9] =?UTF-8?q?icon=E3=82=92=E3=83=80=E3=82=A6=E3=83=B3?= =?UTF-8?q?=E3=83=AD=E3=83=BC=E3=83=89=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...eyboard_arrow_down_24dp_1F1F1F_FILL0_wght400_GRAD0_opsz24.svg | 1 + 1 file changed, 1 insertion(+) create mode 100644 client/src/assets/icon/keyboard_arrow_down_24dp_1F1F1F_FILL0_wght400_GRAD0_opsz24.svg diff --git a/client/src/assets/icon/keyboard_arrow_down_24dp_1F1F1F_FILL0_wght400_GRAD0_opsz24.svg b/client/src/assets/icon/keyboard_arrow_down_24dp_1F1F1F_FILL0_wght400_GRAD0_opsz24.svg new file mode 100644 index 0000000..24729e0 --- /dev/null +++ b/client/src/assets/icon/keyboard_arrow_down_24dp_1F1F1F_FILL0_wght400_GRAD0_opsz24.svg @@ -0,0 +1 @@ + \ No newline at end of file From 0b3bea62973ea7b3e48b4816479c21eb8b5f6bb1 Mon Sep 17 00:00:00 2001 From: sahara2006 Date: Fri, 14 Aug 2026 23:11:15 +0900 Subject: [PATCH 4/9] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=81=AA?= =?UTF-8?q?=E3=81=8A=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/RoomCard.vue | 7 +++++-- client/src/__tests__/RoomCard.spec.ts | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/client/src/RoomCard.vue b/client/src/RoomCard.vue index 203c6b5..e517fd1 100644 --- a/client/src/RoomCard.vue +++ b/client/src/RoomCard.vue @@ -28,7 +28,7 @@ const emit = defineEmits<{