|
|
@@ -0,0 +1,42 @@
|
|
|
+const assert = require('assert');
|
|
|
+const fs = require('fs');
|
|
|
+const path = require('path');
|
|
|
+
|
|
|
+const root = path.resolve(__dirname, '..');
|
|
|
+const wxss = fs.readFileSync(
|
|
|
+ path.join(root, 'pages/tabBar/index/index.wxss'),
|
|
|
+ 'utf8'
|
|
|
+);
|
|
|
+
|
|
|
+function readRule(selector) {
|
|
|
+ const escaped = selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
|
+ const match = wxss.match(new RegExp(`${escaped}\\s*\\{([^}]+)\\}`));
|
|
|
+ assert(match, `missing WXSS rule: ${selector}`);
|
|
|
+ return match[1];
|
|
|
+}
|
|
|
+
|
|
|
+const gridRule = readRule(
|
|
|
+ '.home-prototype-faithful .home-convenience__grid'
|
|
|
+);
|
|
|
+const cellRule = readRule(
|
|
|
+ '.home-prototype-faithful .home-convenience__cell'
|
|
|
+);
|
|
|
+
|
|
|
+assert(
|
|
|
+ gridRule.includes('grid-template-columns: repeat(4, minmax(0, 1fr));'),
|
|
|
+ 'common services must retain four equal grid tracks'
|
|
|
+);
|
|
|
+assert(
|
|
|
+ cellRule.includes('width: 100%;'),
|
|
|
+ 'each common-service cell must override the legacy 25% flex width'
|
|
|
+);
|
|
|
+assert(
|
|
|
+ cellRule.includes('justify-self: stretch;'),
|
|
|
+ 'each common-service cell must stretch across its complete grid track'
|
|
|
+);
|
|
|
+assert(
|
|
|
+ cellRule.includes('align-items: center;'),
|
|
|
+ 'icon and label must remain centered inside the full grid track'
|
|
|
+);
|
|
|
+
|
|
|
+process.stdout.write('home-convenience-layout.offline.test.js: passed\n');
|