Files
roda-student-web-if-develop…/scripts/verify-mobile-layout.mjs
T
2026-06-04 18:19:11 +07:00

32 lines
1.1 KiB
JavaScript

import { readFileSync } from 'node:fs';
const rodaPage = readFileSync('groups/RODA/index.html', 'utf8');
const gridMatch = rodaPage.match(/<div id="dosen-grid" class="([^"]+)"/);
if (!gridMatch) {
throw new Error('Missing dosen-grid container.');
}
const gridClasses = gridMatch[1].split(/\s+/);
if (gridClasses.includes('sm:grid-cols-2')) {
throw new Error('Dosen cards must stay single-column at the 390px mobile breakpoint.');
}
if (!gridClasses.includes('grid-cols-1') || !gridClasses.includes('md:grid-cols-2')) {
throw new Error('Dosen cards must use one mobile column and switch to two columns at md.');
}
const viewMembersMatch = rodaPage.match(/<span class="([^"]+)"[^>]*>\s*\$\{translations\[currentLang\]\.viewMembers\}/);
if (!viewMembersMatch) {
throw new Error('Missing view members link in dosen card template.');
}
if (viewMembersMatch[1].split(/\s+/).includes('whitespace-nowrap')) {
throw new Error('View members link must be allowed to wrap instead of clipping on narrow cards.');
}
console.log('Mobile layout classes keep dosen cards readable on phone viewports.');