Skip to content

Commit a96f1f9

Browse files
committed
feat(tutorial): add serial tab gate to hello_verify step
The hello_verify step now requires the user to switch to the Serial terminal tab before proceeding. This guides users to the correct panel where they can observe the injection output. - Add gate function checking tabBtnRaw has 'active' class - Add gate_hello_verify / gate_hello_verify_ok i18n keys (en, zh-CN, zh-TW) - Update tests: replace 'no gate' assertion with gate enabled/passed tests
1 parent 2324bd2 commit a96f1f9

5 files changed

Lines changed: 33 additions & 1 deletion

File tree

Tools/WebServer/static/js/features/tutorial.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ const TUTORIAL_STEPS = [
7777
id: 'hello_verify',
7878
sidebar: null,
7979
highlight: '#panelContainer',
80+
gate: () => {
81+
const rawBtn = document.getElementById('tabBtnRaw');
82+
return rawBtn && rawBtn.classList.contains('active');
83+
},
84+
gateHint: 'tutorial.gate_hello_verify',
85+
gateOk: 'tutorial.gate_hello_verify_ok',
8086
},
8187
{
8288
id: 'hello_unpatch',

Tools/WebServer/static/js/locales/en.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,10 @@ window.i18nResources['en'] = {
519519
gate_hello_inject: '⏳ Please select a slot and click the inject button.',
520520
gate_hello_inject_ok: '✅ Injection successful!',
521521

522+
gate_hello_verify:
523+
'⏳ Please switch to the Serial terminal tab to continue.',
524+
gate_hello_verify_ok: '✅ Serial terminal active!',
525+
522526
hello_verify_title: 'Verify Injection',
523527
hello_verify_desc:
524528
'Send the hello command in the serial terminal to verify the injection effect.',

Tools/WebServer/static/js/locales/zh-CN.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,9 @@ window.i18nResources['zh-CN'] = {
475475
gate_hello_inject: '⏳ 请选择槽位后点击「注入」按钮。',
476476
gate_hello_inject_ok: '✅ 注入成功!',
477477

478+
gate_hello_verify: '⏳ 请切换到「串口」终端标签页。',
479+
gate_hello_verify_ok: '✅ 已切换到串口终端!',
480+
478481
hello_verify_title: '验证注入效果',
479482
hello_verify_desc: '在串口终端发送 hello 命令,验证注入是否生效。',
480483
hello_verify_send_cmd: '发送命令',

Tools/WebServer/static/js/locales/zh-TW.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,9 @@ window.i18nResources['zh-TW'] = {
477477
gate_hello_inject: '⏳ 請選擇槽位後點擊「注入」按鈕。',
478478
gate_hello_inject_ok: '✅ 注入成功!',
479479

480+
gate_hello_verify: '⏳ 請切換到「串口」終端標籤頁。',
481+
gate_hello_verify_ok: '✅ 已切換到串口終端!',
482+
480483
hello_verify_title: '驗證注入效果',
481484
hello_verify_desc: '在串口終端傳送 hello 命令,驗證注入是否生效。',
482485
hello_verify_send_cmd: '傳送命令',

Tools/WebServer/tests/js/test_tutorial.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,10 +666,26 @@ module.exports = function (w) {
666666
assertEqual(count, 2);
667667
});
668668

669-
it('hello_verify step has no gate (next button enabled)', () => {
669+
it('hello_verify step has gate requiring serial tab', () => {
670670
resetMocks();
671671
clearTutorialStorage();
672672
setupTutorialDOM();
673+
// tabBtnRaw exists but is NOT active
674+
const rawBtn = createMockElement('tabBtnRaw');
675+
mockElements['tabBtnRaw'] = rawBtn;
676+
w.startTutorial();
677+
w.tutorialGoTo(10); // hello_verify
678+
const nextBtn = getElement('tutorialNextBtn');
679+
assertTrue(nextBtn.disabled);
680+
});
681+
682+
it('hello_verify gate passes when serial tab is active', () => {
683+
resetMocks();
684+
clearTutorialStorage();
685+
setupTutorialDOM();
686+
const rawBtn = createMockElement('tabBtnRaw');
687+
rawBtn.classList.add('active');
688+
mockElements['tabBtnRaw'] = rawBtn;
673689
w.startTutorial();
674690
w.tutorialGoTo(10); // hello_verify
675691
const nextBtn = getElement('tutorialNextBtn');

0 commit comments

Comments
 (0)