Feat(settings): add renderer for settings configuration #142

Merged
jakob.scheid merged 88 commits from feature/settings-renderer into main 2026-07-28 20:14:50 +02:00
Showing only changes of commit 26a5783d19 - Show all commits
@@ -20,20 +20,27 @@ import { useSettingsStore } from '../../stores/settingsStore.js';
import { expect, describe, test } from 'vitest'; import { expect, describe, test } from 'vitest';
import { nextTick } from 'vue'; import { nextTick } from 'vue';
const getWrapper = function getWrapper (options = {}) { const getWrapper = function getWrapper ({
jakob.scheid marked this conversation as resolved Outdated
Outdated
Review

I think object destructuring would make more sense here.

I think object destructuring would make more sense here.
i18n = 'selection',
options = [],
allowMultiple = false,
defaultValue = undefined,
translations = {},
piniaOptions = {}
} = {}) {
return mountComponent(Selection, { return mountComponent(Selection, {
attrs: { attrs: {
setting: { setting: {
name: 'selection', name: 'selection',
type: 'selection', type: 'selection',
i18n: options.i18n ?? 'selection', i18n,
options: options.options ?? [], options,
allowMultiple: options.allowMultiple ?? false, allowMultiple,
default: options.default ?? null default: defaultValue
}, },
path: 'selection' path: 'selection'
} }
}, options.translations ?? {}, [], options.piniaOptions ?? {}); }, translations, [], piniaOptions);
}; };
const getChecked = function getChecked (inputs) { const getChecked = function getChecked (inputs) {
1
@@ -108,7 +115,7 @@ describe('Selection', () => {
test('shows default value', () => { test('shows default value', () => {
const wrapper = getWrapper({ const wrapper = getWrapper({
options: exampleOptions, options: exampleOptions,
default: 'o2' defaultValue: 'o2'
}); });
const inputs = wrapper.findAll('input'); const inputs = wrapper.findAll('input');
@@ -119,7 +126,7 @@ describe('Selection', () => {
test('shows multiple default values', () => { test('shows multiple default values', () => {
const wrapper = getWrapper({ const wrapper = getWrapper({
options: exampleOptions, options: exampleOptions,
default: ['o0', 'o1'], defaultValue: ['o0', 'o1'],
allowMultiple: true allowMultiple: true
}); });