Code smells fixes

This commit is contained in:
Liviu Burcusel 2025-09-23 18:00:07 +02:00
parent 3fcb150636
commit 910302f27a
Signed by: liviu
GPG key ID: 6CDB37A4AD2C610C
3 changed files with 15 additions and 15 deletions

View file

@ -5,7 +5,7 @@ import * as components from "vuetify/components";
import * as directives from "vuetify/directives"; import * as directives from "vuetify/directives";
import FooterComponent from "../../src/components/FooterComponent.vue"; import FooterComponent from "../../src/components/FooterComponent.vue";
global.ResizeObserver = require('resize-observer-polyfill'); globalThis.ResizeObserver = require('resize-observer-polyfill');
const vuetify = createVuetify({ const vuetify = createVuetify({
components, components,

View file

@ -6,7 +6,7 @@ import * as components from 'vuetify/components'
import * as directives from 'vuetify/directives' import * as directives from 'vuetify/directives'
import HeaderNavBar from "../../src/components/HeaderNavBar.vue" import HeaderNavBar from "../../src/components/HeaderNavBar.vue"
global.ResizeObserver = require('resize-observer-polyfill'); globalThis.ResizeObserver = require('resize-observer-polyfill');
// Mock routes for testing // Mock routes for testing
const routes = [ const routes = [
@ -100,17 +100,17 @@ describe("HeaderNavBar", () => {
it("has correct button styling classes", () => { it("has correct button styling classes", () => {
const routerLinks = wrapper.findAllComponents({ name: "RouterLink" }); const routerLinks = wrapper.findAllComponents({ name: "RouterLink" });
routerLinks.forEach((link: any) => { for (const link of routerLinks) {
expect(link.classes()).toContain("mx-2") expect(link.classes()).toContain("mx-2")
expect(link.classes()).toContain("text-decoration-none") expect(link.classes()).toContain("text-decoration-none")
}); }
const buttons = wrapper.findAllComponents({ name: "v-btn" }); const buttons = wrapper.findAllComponents({ name: "v-btn" });
buttons.forEach((button: any) => { for (const button of buttons) {
expect(button.attributes("class")).toContain("v-btn--size-large"); expect(button.attributes("class")).toContain("v-btn--size-large");
expect(button.attributes("class")).toContain("-primary"); expect(button.attributes("class")).toContain("-primary");
}); }
}); });
it("has proper app bar structure", () => { it("has proper app bar structure", () => {
@ -127,12 +127,12 @@ describe("HeaderNavBar", () => {
it("maintains accessibility attributes", () => { it("maintains accessibility attributes", () => {
const homeButton = wrapper.find("[data-role='homeNavigation']"); const homeButton = wrapper.find("[data-role='homeNavigation']");
expect(homeButton.attributes("data-role")).toBe('homeNavigation'); expect(homeButton.attributes("data-role")).toBe('homeNavigation');
// Check that buttons are actual button elements for screen readers // Check that buttons are actual button elements for screen readers
const buttons = wrapper.findAll("button") const buttons = wrapper.findAll("button");
expect(buttons).toHaveLength(2) expect(buttons).toHaveLength(2);
buttons.forEach((button: any) => { for (const button of buttons) {
expect(button.element.tagName).toBe("BUTTON"); expect(button.element.tagName).toBe("BUTTON");
}) }
}) });
}) });

View file

@ -63,7 +63,7 @@ describe("Vuetify Plugin Configuration", () => {
const expectedKeys = ["components", "directives", "theme"]; const expectedKeys = ["components", "directives", "theme"];
const actualKeys = Object.keys(callArgs); const actualKeys = Object.keys(callArgs);
expect(actualKeys.sort()).toEqual(expectedKeys.sort()); expect([...actualKeys].sort((a, b) => a.localeCompare(b))).toEqual([...expectedKeys].sort((a, b) => a.localeCompare(b)));
}); });
it("should export the vuetify instance", async () => { it("should export the vuetify instance", async () => {