更新
This commit is contained in:
@@ -35,6 +35,16 @@ run("AppBar back icon uses a fixed mini-program sized constraint", () => {
|
||||
assert.match(appBarStyles, /\.app-bar__back-icon\s*\{[\s\S]*height:\s*32rpx;/);
|
||||
});
|
||||
|
||||
run("AppBar props stay focused on title and back navigation only", () => {
|
||||
run("AppBar exposes fixed layout modes instead of scattered slot props", () => {
|
||||
assert.match(appBarSource, /type AppBarMode = "spacer" \| "back-title" \| "back-title-actions-below" \| "title-actions-below"/);
|
||||
assert.match(appBarSource, /mode\?: AppBarMode/);
|
||||
assert.match(appBarSource, /actions\?: ReactNode/);
|
||||
assert.doesNotMatch(appBarSource, /subtitle\?:|eyebrow\?:|align\?:|rightText\?:|onRightAction\?:|leftSlot\?:|rightSlot\?:|bottomSlot\?:/);
|
||||
});
|
||||
|
||||
run("AppBar includes dedicated rows for title and below-line actions", () => {
|
||||
assert.match(appBarSource, /app-bar__title-row/);
|
||||
assert.match(appBarSource, /app-bar__actions-row/);
|
||||
assert.match(appBarStyles, /\.app-bar__actions-row\s*\{/);
|
||||
assert.match(appBarStyles, /\.app-bar__title-row\s*\{/);
|
||||
});
|
||||
|
||||
@@ -4,6 +4,8 @@ const {
|
||||
getStatusTone,
|
||||
pickReportRecord
|
||||
} = require("../../tmp/report-tests/report-utils.js");
|
||||
const { resolveReportBackAction } = require("../../tmp/report-tests/navigation.js");
|
||||
const { computeAppBarMetrics, resolveBackNavigation } = require("../../tmp/report-tests/utils/app-bar-metrics.js");
|
||||
|
||||
function run(name, fn) {
|
||||
try {
|
||||
@@ -43,3 +45,35 @@ run("pickReportRecord falls back to first device record", () => {
|
||||
|
||||
assert.equal(record.score, 65);
|
||||
});
|
||||
|
||||
run("resolveReportBackAction returns navigateBack when there is history", () => {
|
||||
assert.equal(resolveReportBackAction(2), "navigateBack");
|
||||
});
|
||||
|
||||
run("resolveReportBackAction falls back to home when report page has no history", () => {
|
||||
assert.equal(resolveReportBackAction(1), "redirectHome");
|
||||
});
|
||||
|
||||
run("computeAppBarMetrics uses menu button metrics when available", () => {
|
||||
assert.deepEqual(
|
||||
computeAppBarMetrics({
|
||||
statusBarHeight: 24,
|
||||
windowWidth: 390,
|
||||
menuButtonRect: {
|
||||
top: 30,
|
||||
left: 300,
|
||||
height: 32
|
||||
}
|
||||
}),
|
||||
{
|
||||
topInset: 24,
|
||||
menuTop: 30,
|
||||
menuHeight: 32,
|
||||
capsuleSafeWidth: 96
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
run("resolveBackNavigation falls back when stack has no previous page", () => {
|
||||
assert.equal(resolveBackNavigation(1), "redirectHome");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user