Skip to content

Commit

Permalink
test: describe compute variable util
Browse files Browse the repository at this point in the history
  • Loading branch information
vladjerca committed Jan 12, 2025
1 parent 363388d commit b1b3af9
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions projects/client/src/lib/stores/css/computeVariable.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { computeVariable } from './computeVariable';

describe('computeVariable', () => {
beforeEach(() => {
// Mock document.documentElement and getComputedStyle
const documentElement = {
style: {
getPropertyValue: vi.fn(),
},
};

global.document = {
documentElement,
} as unknown as Document;

global.getComputedStyle = vi.fn().mockReturnValue({
getPropertyValue: vi.fn().mockReturnValue('test-value'),
});
});

it('should return computed CSS variable value', () => {
expect(computeVariable('--test-var')).toBe('test-value');
});
});

0 comments on commit b1b3af9

Please sign in to comment.