fix: prevent duplicate titles on Taobao login page

Keep a single native title on the entry page even when the host ignores title clearing. Preserve centered headers elsewhere and normalize manifest line endings during shared-code checks.
This commit is contained in:
xsl
2026-11-05 10:43:01 +08:00
parent 873b45d3a5
commit 0e34eeb1df
6 changed files with 38 additions and 9 deletions
+19 -1
View File
@@ -39,6 +39,23 @@ test('native errors cannot block page loading and rejected promises are observed
assert.equal(loaded, 2);
});
test('native-only entry never draws its own title even when the host reports success without changing the native title', () => {
for (const mode of ['ignored-success', 'failure', 'missing-api']) {
const calls = [];
const platform = mode === 'missing-api' ? {} : { setNavigationBar(options) {
calls.push(options.title);
if (mode === 'ignored-success') options.success({}); else options.fail({});
} };
const p = header.page({ data: {} }, platform, { nativeTitleOnly: true });
p.setData = patch => Object.assign(p.data, patch);
assert.equal(p.data.brandHeader.showTitle, false, 'no duplicate on the first frame');
for (const lifecycle of ['onLoad', 'onShow', 'onReady', 'onResize', 'onHide', 'onShow']) {
p[lifecycle](); assert.equal(p.data.brandHeader.showTitle, false, lifecycle);
}
assert(calls.every(title => title === "1'me肌肤状态检测"), 'entry keeps the native title instead of trying to clear it');
}
});
test('actual header template centers on the full screen and keeps clear of status and native buttons', async () => {
const fs = require('node:fs'), path = require('node:path'), { chromium } = require('playwright');
const root = path.resolve(__dirname, '..');
@@ -63,7 +80,8 @@ test('actual header template centers on the full screen and keeps clear of statu
}
for (const route of JSON.parse(fs.readFileSync(path.join(root, 'app.json'), 'utf8')).pages) {
const config = JSON.parse(fs.readFileSync(path.join(root, route + '.json'), 'utf8'));
assert.equal(config.transparentTitle, 'always'); assert.equal(config.defaultTitle, '\u200b');
assert.equal(config.transparentTitle, 'always');
assert.equal(config.defaultTitle, route === 'pages/login/login' ? header.layout().title : '\u200b');
assert.match(fs.readFileSync(path.join(root, route + '.axml'), 'utf8'), /template is="brand-header"/);
}
} finally { await browser.close(); }