-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into CooperatorsModerated
- Loading branch information
Showing
6 changed files
with
97 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Configuration for automated dependency updates using Dependabot | ||
version: 2 | ||
updates: | ||
# Define the target package ecosystem | ||
- package-ecosystem: "npm" | ||
# Specify the root directory | ||
directory: "/" | ||
# Schedule automated updates to run weekly | ||
schedule: | ||
# interval: "weekly" | ||
interval: "daily" # To test this functionality scheduled daily | ||
# Labels to apply to Dependabot PRs | ||
labels: | ||
- "dependencies" | ||
# Specify the target branch for PRs | ||
target-branch: "develop" | ||
# Customize commit message prefix | ||
commit-message: | ||
prefix: "chore(deps):" |
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
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,63 @@ | ||
import '@testing-library/jest-dom' | ||
import { render, screen } from '../test-utils' | ||
import AddOptionBtn from '@/components/atoms/AddOptionBtn.vue' | ||
import { fireEvent, waitFor } from '@testing-library/vue' | ||
|
||
describe('AddOption', () => { | ||
it('renders initial title and opens dialog on button click', async () => { | ||
const { getByText, getByLabelText, emitted } = render(AddOptionBtn, { | ||
props: { | ||
dialog: false, | ||
hasValue: false, | ||
option: { text: '', value: null, description: '' }, | ||
}, | ||
}) | ||
await fireEvent.click(getByText(/Add a new Option/i)) | ||
expect(emitted().dialog[0]).toEqual([true]) | ||
}) | ||
|
||
it('closes dialog on cancel button click', async () => { | ||
const { getByText, emitted } = render(AddOptionBtn, { | ||
props: { | ||
dialog: true, | ||
hasValue: false, | ||
option: { text: '', value: null, description: '' }, | ||
}, | ||
}) | ||
await fireEvent.click(getByText(/Cancel/i)) | ||
expect(emitted().dialog[0]).toEqual([false]) | ||
}) | ||
|
||
it('emits addOption event on save button click', async () => { | ||
const { getByText, getByLabelText, emitted } = render(AddOptionBtn, { | ||
props: { | ||
dialog: true, | ||
hasValue: false, | ||
option: { text: '', value: null, description: '' }, | ||
}, | ||
}) | ||
await fireEvent.update(getByLabelText(/Text/i), 'Test Option') | ||
await fireEvent.update(getByLabelText('Value'), '1') | ||
await fireEvent.update(getByLabelText(/Description/i), 'Test Description') | ||
await fireEvent.click(getByText(/Save/i)) | ||
|
||
expect(emitted().addOption).toBeTruthy() | ||
}) | ||
|
||
it('emits required event on save button click', async () => { | ||
const { getByText, getByLabelText, emitted } = render(AddOptionBtn, { | ||
props: { | ||
dialog: true, | ||
hasValue: false, | ||
option: { text: '', value: null, description: '' }, | ||
}, | ||
}) | ||
await fireEvent.click(getByText(/Save/i)) | ||
|
||
await waitFor(() => { | ||
expect(screen.getByText(/Required/i)).toBeInTheDocument() | ||
}) | ||
|
||
expect(emitted().addOption).toBeFalsy() | ||
}) | ||
}) |