77 lines
3.4 KiB
TypeScript
77 lines
3.4 KiB
TypeScript
import { readFileSync } from 'fs';
|
|
import { join } from 'path';
|
|
|
|
describe('UI Features Tests', () => {
|
|
it('should have color hex input in admin form', () => {
|
|
const adminDashboardPath = join(process.cwd(), 'app', 'upadaj', 'dashboard', 'page.tsx');
|
|
const adminContent = readFileSync(adminDashboardPath, 'utf-8');
|
|
|
|
// Check for color input
|
|
expect(adminContent).toContain('type="color"');
|
|
expect(adminContent).toContain('bojaHex');
|
|
expect(adminContent).toContain('Hex kod boje');
|
|
});
|
|
|
|
it('should display color hex in frontend table', () => {
|
|
const filamentTablePath = join(process.cwd(), 'src', 'components', 'FilamentTable.tsx');
|
|
const tableContent = readFileSync(filamentTablePath, 'utf-8');
|
|
|
|
// Check for color hex display
|
|
expect(tableContent).toContain('filament.bojaHex');
|
|
expect(tableContent).toContain('backgroundColor: filament.bojaHex');
|
|
});
|
|
|
|
it('should have checkboxes for boolean fields', () => {
|
|
const adminDashboardPath = join(process.cwd(), 'app', 'upadaj', 'dashboard', 'page.tsx');
|
|
const adminContent = readFileSync(adminDashboardPath, 'utf-8');
|
|
|
|
// Check for checkbox inputs
|
|
expect(adminContent).toMatch(/type="checkbox"[\s\S]*?name="refill"/);
|
|
expect(adminContent).toMatch(/type="checkbox"[\s\S]*?name="vakum"/);
|
|
expect(adminContent).toMatch(/type="checkbox"[\s\S]*?name="otvoreno"/);
|
|
});
|
|
|
|
it('should have number input for quantity', () => {
|
|
const adminDashboardPath = join(process.cwd(), 'app', 'upadaj', 'dashboard', 'page.tsx');
|
|
const adminContent = readFileSync(adminDashboardPath, 'utf-8');
|
|
|
|
// Check for number input
|
|
expect(adminContent).toMatch(/type="number"[\s\S]*?name="kolicina"/);
|
|
expect(adminContent).toContain('min="0"');
|
|
expect(adminContent).toContain('step="1"');
|
|
});
|
|
|
|
it('should have predefined brand options', () => {
|
|
const adminDashboardPath = join(process.cwd(), 'app', 'upadaj', 'dashboard', 'page.tsx');
|
|
const adminContent = readFileSync(adminDashboardPath, 'utf-8');
|
|
|
|
// Check for brand select dropdown
|
|
expect(adminContent).toContain('<option value="Bambu Lab">Bambu Lab</option>');
|
|
expect(adminContent).toContain('<option value="PolyMaker">PolyMaker</option>');
|
|
expect(adminContent).toContain('<option value="Prusament">Prusament</option>');
|
|
});
|
|
|
|
it('should have sidebar navigation in admin', () => {
|
|
const adminDashboardPath = join(process.cwd(), 'app', 'upadaj', 'dashboard', 'page.tsx');
|
|
const colorsPagePath = join(process.cwd(), 'app', 'upadaj', 'colors', 'page.tsx');
|
|
|
|
const dashboardContent = readFileSync(adminDashboardPath, 'utf-8');
|
|
const colorsContent = readFileSync(colorsPagePath, 'utf-8');
|
|
|
|
// Check for sidebar
|
|
expect(dashboardContent).toContain('href="/upadaj/dashboard"');
|
|
expect(dashboardContent).toContain('href="/upadaj/colors"');
|
|
expect(colorsContent).toContain('href="/upadaj/dashboard"');
|
|
expect(colorsContent).toContain('href="/upadaj/colors"');
|
|
});
|
|
|
|
it('should have Safari-specific select styling', () => {
|
|
const selectCssPath = join(process.cwd(), 'src', 'styles', 'select.css');
|
|
const selectContent = readFileSync(selectCssPath, 'utf-8');
|
|
|
|
// Check for Safari fixes
|
|
expect(selectContent).toContain('-webkit-appearance: none !important');
|
|
expect(selectContent).toContain('@supports (-webkit-appearance: none)');
|
|
expect(selectContent).toContain('-webkit-min-device-pixel-ratio');
|
|
});
|
|
}); |