You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dianshang-qianduan/tests/consumer-behavior-training-...

28 lines
1.3 KiB
JavaScript

const fs = require("node:fs");
const path = require("node:path");
const test = require("node:test");
const assert = require("node:assert/strict");
const source = fs.readFileSync(
path.resolve(__dirname, "../src/views/demand/consumer-behavior.vue"),
"utf8"
);
test("查看实训8通过应用路由在当前会话内打开目标用户画像", () => {
assert.match(source, /import \{[^}]*useRouter[^}]*\} from "vue-router";/);
assert.match(source, /const router = useRouter\(\);/);
assert.match(source, /function viewTargetUserProfile\(\) \{\s*router\.push\(\{ path: "\/demand\/people" \}\);\s*\}/);
assert.doesNotMatch(source, /window\.open\("\/demand\/people"/);
});
test("查看实训8按钮在说明区右侧采用紧凑尺寸", () => {
assert.match(source, /\.training-eight-action \{\s*grid-column: 2;\s*grid-row: 1;\s*justify-self: end;\s*min-width: 124px;\s*height: 38px;/);
});
test("KANO需求列表在紧凑可视区内滚动并固定表头", () => {
assert.match(source, /\.kano-table-wrap \{\s*max-height: 420px;\s*overflow: auto;/);
assert.match(source, /th \{\s*position: sticky;\s*top: 0;\s*z-index: 1;/);
assert.match(source, /\.kano-textarea \{\s*min-height: 44px;/);
assert.match(source, /\.kano-select :deep\(\.el-select__wrapper\) \{\s*min-height: 38px;/);
});