mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
* Tests: convert all common tests from mocha to karma * Tests: refactor Vuetify setup in tests * Tests: update package-lock.json * Tests: convert all model test to vitest 1/2 * Tests: convert all model test to vitest 2/2 * Tests: fix broken test * Tests: time zone UTC * Tests: Add playwright screenshots folder to gitignore * Tests: Add timezone to vitest scripts * Tests: Add Vitest scripts to Makefile * Tests: delete unused timezone configs * Tests: Update some tests * Tests: Update vitest config * Tests: Delete usesless try-catch
64 lines
1.5 KiB
JavaScript
64 lines
1.5 KiB
JavaScript
import { config } from "@vue/test-utils";
|
|
import { vi } from "vitest";
|
|
import { createVuetify } from "vuetify";
|
|
import * as components from "vuetify/components";
|
|
import * as directives from "vuetify/directives";
|
|
import "vuetify/styles";
|
|
import { Settings } from "luxon";
|
|
|
|
// Setup timezone to match test expectations (UTC+2/CEST)
|
|
Settings.defaultZoneName = "Europe/Berlin";
|
|
|
|
// Create a proper Vuetify instance with all components and styles
|
|
const vuetify = createVuetify({
|
|
components,
|
|
directives,
|
|
theme: {
|
|
defaultTheme: "light",
|
|
},
|
|
});
|
|
|
|
// Configure Vue Test Utils global configuration
|
|
config.global.mocks = {
|
|
$gettext: (text) => text,
|
|
$isRtl: false,
|
|
$config: {
|
|
feature: (_name) => true,
|
|
},
|
|
};
|
|
|
|
config.global.plugins = [vuetify];
|
|
|
|
config.global.stubs = {
|
|
transition: false,
|
|
};
|
|
|
|
config.global.directives = {
|
|
tooltip: {
|
|
mounted(el, binding) {
|
|
el.setAttribute("data-tooltip", binding.value);
|
|
},
|
|
},
|
|
};
|
|
|
|
const originalMount = config.global.mount;
|
|
config.global.mount = function (component, options = {}) {
|
|
options.global = options.global || {};
|
|
options.global.config = options.global.config || {};
|
|
options.global.config.globalProperties = options.global.config.globalProperties || {};
|
|
options.global.config.globalProperties.$emit = vi.fn();
|
|
|
|
// Add vuetify to all mount calls
|
|
if (!options.global.plugins) {
|
|
options.global.plugins = [vuetify];
|
|
} else if (Array.isArray(options.global.plugins)) {
|
|
options.global.plugins.push(vuetify);
|
|
}
|
|
|
|
return originalMount(component, options);
|
|
};
|
|
|
|
export default {
|
|
vuetify,
|
|
};
|