Skip to content

Commit

Permalink
Merge pull request #33 from LucasWerey/fix/10
Browse files Browse the repository at this point in the history
Fix/10
  • Loading branch information
LucasWerey authored Jan 16, 2024
2 parents 2eaa603 + 260248b commit c4c4ce6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
22 changes: 22 additions & 0 deletions src/components/CTA/SelectField/SelectField.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,26 @@ describe('SelectField.vue', () => {
expect(wrapper.emitted()).toHaveProperty('update:modelValue')
expect(wrapper.emitted()['update:modelValue'][0]).toEqual(['option1'])
})

it('renders options correctly', async () => {
const wrapper = mount(SelectField, {
props: {
title: 'Test Title',
options: [
{ label: 'Option 1', value: 'option1' },
{ label: 'Option 2', value: 'option2' },
{ label: 'Option 3', value: 'option3' }
],
default: 'option1'
}
})

await nextTick()

const options = wrapper.findAll('.items div')
expect(options.length).toBe(3)
expect(options[0].text()).toBe('Option 1')
expect(options[1].text()).toBe('Option 2')
expect(options[2].text()).toBe('Option 3')
})
})
2 changes: 1 addition & 1 deletion src/components/CTA/SelectField/SelectField.story.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</template>

<script setup lang="ts">
import { SelectFieldOption } from './SelectField.model'
import type { SelectFieldOption } from './SelectField.model'
import { logEvent } from 'histoire/client'
interface Controls {
Expand Down
2 changes: 1 addition & 1 deletion src/components/CTA/SelectField/SelectField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</template>

<script setup lang="ts">
import { SelectFieldOption } from './SelectField.model'
import type { SelectFieldOption } from './SelectField.model'
const props = defineProps({
options: {
Expand Down

0 comments on commit c4c4ce6

Please sign in to comment.