fix: use generated tdesign wxss import path
This commit is contained in:
2
app.wxss
2
app.wxss
@@ -1,4 +1,4 @@
|
||||
@import 'tdesign-miniprogram/common/style/index.wxss';
|
||||
@import './miniprogram_npm/tdesign-miniprogram/common/style/index.wxss';
|
||||
|
||||
page {
|
||||
min-height: 100%;
|
||||
|
||||
17
tests/miniprogram-compatibility.test.js
Normal file
17
tests/miniprogram-compatibility.test.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
function resolveImportTarget(wxssPath, importPath) {
|
||||
return path.resolve(path.dirname(wxssPath), importPath)
|
||||
}
|
||||
|
||||
describe('miniprogram compatibility', () => {
|
||||
test('app.wxss imports a TDesign style entry that exists in the project output', () => {
|
||||
const appWxssPath = path.join(process.cwd(), 'app.wxss')
|
||||
const source = fs.readFileSync(appWxssPath, 'utf8')
|
||||
const match = source.match(/@import ['"]([^'"]+)['"];/)
|
||||
|
||||
expect(match).not.toBeNull()
|
||||
expect(fs.existsSync(resolveImportTarget(appWxssPath, match[1]))).toBe(true)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user