mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-24 00:36:14 -04:00
fix
This commit is contained in:
parent
54b14e0f7a
commit
217a1af7cb
1 changed files with 39 additions and 6 deletions
|
@ -1,6 +1,39 @@
|
||||||
// import { expect, describe, it } from 'vitest';
|
import { expect, describe, it } from 'vitest';
|
||||||
// import { } from './border-generator.service';
|
import { generateCSSOutput } from './border-generator.service';
|
||||||
//
|
import type { Borders } from './border-generator.service';
|
||||||
// describe('border-generator', () => {
|
|
||||||
//
|
describe('border-generator service', () => {
|
||||||
// })
|
describe('generateCSSOutput', () => {
|
||||||
|
it('generates correct CSS with default values', () => {
|
||||||
|
const borders: Borders = {
|
||||||
|
topLeft: { label: 'Top Left', value: 10, max: 100 },
|
||||||
|
topRight: { label: 'Top Right', value: 10, max: 100 },
|
||||||
|
bottomRight: { label: 'Bottom Right', value: 10, max: 100 },
|
||||||
|
bottomLeft: { label: 'Bottom Left', value: 10, max: 100 },
|
||||||
|
};
|
||||||
|
|
||||||
|
const cssOutput = generateCSSOutput(borders, 1, 'solid', 'px');
|
||||||
|
|
||||||
|
expect(cssOutput).toEqual('border: 1px solid #000000; border-radius: 10px 10px 10px 10px;');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('generates correct CSS with custom values', () => {
|
||||||
|
const borders: Borders = {
|
||||||
|
topLeft: { label: 'Top Left', value: 20, max: 100 },
|
||||||
|
topRight: { label: 'Top Right', value: 15, max: 100 },
|
||||||
|
bottomRight: { label: 'Bottom Right', value: 5, max: 100 },
|
||||||
|
bottomLeft: { label: 'Bottom Left', value: 25, max: 100 },
|
||||||
|
};
|
||||||
|
|
||||||
|
const cssOutput = generateCSSOutput(borders, 2, 'dashed', '%');
|
||||||
|
|
||||||
|
expect(cssOutput).toEqual('border: 2px dashed #000000; border-radius: 20% 15% 5% 25%;');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('throws an error when borders are missing', () => {
|
||||||
|
const borders = {} as Borders;
|
||||||
|
|
||||||
|
expect(() => generateCSSOutput(borders, 1, 'solid', 'px')).toThrowError();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue