Skip to content

Commit

Permalink
test: add globalVars test case
Browse files Browse the repository at this point in the history
  • Loading branch information
gin-lsl committed Jul 31, 2024
1 parent 6e38760 commit bd29614
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions e2e/fixtures.umi/config.less.globalVars/.umirc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default {
mfsu: false,
mako: {},
lessLoader: {
globalVars: {
hack: 'true; @import "./var.less";',
},
},
};
8 changes: 8 additions & 0 deletions e2e/fixtures.umi/config.less.globalVars/expect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const assert = require("assert");
const { parseBuildResult, moduleReg } = require("../../../scripts/test-utils");
const { files } = parseBuildResult(__dirname);

let content = files["pages_index_tsx-async.css"];
content = content.replace(/\s/g, "");

assert(content.includes(`color:red;`), "should prefer less.modifyVars than config.theme");
3 changes: 3 additions & 0 deletions e2e/fixtures.umi/config.less.globalVars/pages/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a {
color: @primaryColor;
}
3 changes: 3 additions & 0 deletions e2e/fixtures.umi/config.less.globalVars/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import React from 'react';
import './index.less';
export default () => <div>1</div>;
1 change: 1 addition & 0 deletions e2e/fixtures.umi/config.less.globalVars/var.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@primaryColor: red;

0 comments on commit bd29614

Please sign in to comment.