diff --git a/app/src/layouts/calendar/options.test.ts b/app/src/layouts/calendar/options.test.ts new file mode 100644 index 0000000000..15c8b27d13 --- /dev/null +++ b/app/src/layouts/calendar/options.test.ts @@ -0,0 +1,38 @@ +import { mount } from '@vue/test-utils'; +import { GlobalMountOptions } from '@vue/test-utils/dist/types'; +import { beforeAll, expect, test, vi } from 'vitest'; +import { createI18n, I18n } from 'vue-i18n'; + +import Options from './options.vue'; + +let i18n: I18n; +let global: GlobalMountOptions; + +beforeAll(() => { + i18n = createI18n({ + legacy: false, + }); + + // silences locale message not found warnings + vi.spyOn(i18n.global, 't').mockImplementation((key: string) => key); + + global = { + stubs: ['v-field-template', 'v-select'], + plugins: [i18n], + }; +}); + +test('should have days array in firstDayOptions variable', async () => { + const wrapper = mount(Options, { + props: { + collection: 'test', + dateFields: ['test'], + }, + shallow: true, + global, + }); + + const expected = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; + + expect(wrapper.vm.firstDayOptions.map((option: { text: string; value: number }) => option.text)).toEqual(expected); +}); diff --git a/app/src/layouts/calendar/options.vue b/app/src/layouts/calendar/options.vue index e2119ab69b..ece5d6fb8a 100644 --- a/app/src/layouts/calendar/options.vue +++ b/app/src/layouts/calendar/options.vue @@ -29,7 +29,7 @@