Skip to content

Commit

Permalink
Merge branch 'develop' into CooperatorsModerated
Browse files Browse the repository at this point in the history
  • Loading branch information
jvJUCA committed Apr 11, 2024
2 parents 8735d79 + be474ea commit 764b789
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 15 deletions.
19 changes: 19 additions & 0 deletions .github/depenadabot.yml
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):"
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: test🧪

on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]
on: [push, pull_request]

jobs:
test:
Expand Down
9 changes: 6 additions & 3 deletions src/components/molecules/HeuristicsTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,18 @@
>
<v-list-item-content
style="
margin: 0px !important;
padding: 0px !important;
margin-bottom: 8px !important;
margin-top: 8px !important;
padding-top: 6px !important;
padding-bottom: 6px !important;
justify-content: space-between;
"
>
<v-list-item-title
style="
margin: 0px !important;
padding: 0px !important;
padding-top: 4px !important;
padding-bottom: 4px !important;
"
>
{{ item.id }} - {{ item.title }}
Expand Down
11 changes: 6 additions & 5 deletions src/components/molecules/WeightTable.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<template>
<v-col style="background-color:#F5F7FF" class="rounded pa-0 ">
<v-col style="background-color:#F5F7FF" class="rounded pa-0 pb-2">
<v-card-title class="subtitleView">
Weights
</v-card-title>
<v-divider class="mb-4" />
<v-card
v-if="heuristics.length < 2"
class="mx-auto my-2 mb-5 py-6 if-card"
class="mx-auto mb-5 py-4 transparent rounded-0 subtitleView"
elevation="0"
align="center"
>
Need at least 2 heuristics to be able to place the weights.
Expand Down Expand Up @@ -75,7 +76,7 @@
mdi-help-circle
</v-icon>
</template>
<span>{{ heuristics[f].title }}</span>
<span>{{ heuristics[f + tabs].title }}</span>
</v-tooltip>
</td>
<!-- radio-group -->
Expand Down Expand Up @@ -222,8 +223,8 @@ export default {
}
.if-card {
border-radius: 15px;
border: 0.2px solid #fca326;
/*border-radius: 15px;
border: 0.2px solid #fca326;*/
width: 950px;
font-size: 18px;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ const i18n = new VueI18n({
},
})

export function render (component, { customStore } = {}) {
return renderWithVuetify(component, {}, (vue) => {
export function render (component, options, { customStore } = {}) {
return renderWithVuetify(component, options, (vue) => {
vue.use(VueRouter)
vue.use(VueI18n)
vue.use(Vuex)
Expand Down
63 changes: 63 additions & 0 deletions tests/unit/AddOption.spec.js
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()
})
})

0 comments on commit 764b789

Please sign in to comment.