v9.2.1: re-enable ms-word on all platforms + real filenames in URLs
User clarified: with the new open-link URLs (https + no query string + ending .docx), pressing the button DID open the file in Word 16.101+ on their Mac — only the OLD URL forms (http, query strings) were ignored. The previous disable-on-Mac was based on terminal tests that hit the old forms / cold-start races, so it removed working behavior. - useVersionOpen: fireWordScheme = openInWord !== 'off' (default '' and 'on' fire on ALL platforms; only explicit 'off' is download-only) - Notice updated: "กำลังเปิดไฟล์ใน Word ให้อัตโนมัติ — หากไม่เปิด ไฟล์อยู่ที่โฟลเดอร์ Downloads แล้ว" (covers cold-start drop) - Docs corrected with v9.2.1 header (old forms were the broken ones; new form confirmed working via real usage) + correction markers on the v9.2 test record + CLAUDE.md rule 13 rewritten - web 60/60 + build; QA reviewer FAIL round 1 (5 doc/comment minors, all fixed) → PASS round 2 Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
parent
f4b2ff9d28
commit
4f54af4e24
7 changed files with 30 additions and 29 deletions
|
|
@ -20,7 +20,7 @@ function mount() {
|
|||
|
||||
beforeEach(() => {
|
||||
vi.stubGlobal('useApi', () => ({ apiJson }))
|
||||
// default: auto — happy-dom ไม่ใช่ Mac UA จึงยิง ms-word ควบคู่ (แต่ละ test ที่ต้องการก็ stub ทับได้)
|
||||
// default: ยิง ms-word คู่กัน (toggle ไม่มี platform logic แล้ว — แต่ละ test stub ทับได้)
|
||||
vi.stubGlobal('useRuntimeConfig', () => ({ public: { openInWord: '' } }))
|
||||
tab = { opener: {}, closed: false, location: { replace }, close }
|
||||
vi.spyOn(window, 'open').mockReturnValue(tab as unknown as Window)
|
||||
|
|
@ -116,7 +116,7 @@ describe('version open lifecycle', () => {
|
|||
expect(saved).toHaveLength(1)
|
||||
expect(saved[0].href).toBe('https://files.example/draft.docx?sig=a%2Fb')
|
||||
expect(state.openNotice.value).toContain('Downloads')
|
||||
// ยังยิง ms-word ควบคู่แบบ best-effort เผื่อเครื่องที่ scheme ยังใช้ได้ (Windows / Word รุ่นก่อน)
|
||||
// ยิง ms-word คู่กัน — Word เปิดไฟล์ให้อัตโนมัติ (ถ้า cold-start หลุด ไฟล์สำรองก็อยู่ Downloads แล้ว)
|
||||
expect(assign).toHaveBeenCalledWith('ms-word:ofe|u|https://files.example/draft.docx?sig=a%2Fb')
|
||||
})
|
||||
it('re-click downloads again with the latest URL', () => {
|
||||
|
|
@ -132,28 +132,22 @@ describe('version open lifecycle', () => {
|
|||
expect(saved[1].href).toBe('https://files.example/second.docx')
|
||||
expect(state.fallbackUrl.value).toBe('https://files.example/second.docx')
|
||||
})
|
||||
it('OPEN_IN_WORD=off: ไม่ยิง ms-word เลย — ดาวน์โหลดอย่างเดียว (Word 16.101+ บน Mac เด้งหน้าเลือกไฟล์ทุกครั้ง)', () => {
|
||||
it('OPEN_IN_WORD=off: ไม่ยิง ms-word เลย — ดาวน์โหลดอย่างเดียว', () => {
|
||||
vi.stubGlobal('useRuntimeConfig', () => ({ public: { openInWord: 'off' } }))
|
||||
const assign = vi.spyOn(window.location, 'assign').mockImplementation(() => {})
|
||||
vi.spyOn(HTMLAnchorElement.prototype, 'click').mockImplementation(() => {})
|
||||
const state = mount()
|
||||
state.openDocxUrl('https://files.example/draft.docx')
|
||||
expect(assign).not.toHaveBeenCalled()
|
||||
expect(state.openNotice.value).not.toContain('อัตโนมัติ') // ข้อความไม่เกี้ยวเรื่องเปิดอัตโนมัติ
|
||||
expect(state.openNotice.value).toContain('Downloads') // ข้อความชี้ไปที่ Downloads อย่างเดียว
|
||||
})
|
||||
it('auto บน Mac: ไม่ยิง ms-word (default), override on แล้วยิงแม้บน Mac', () => {
|
||||
it('default (auto) ยิง ms-word ทุกแพลตฟอร์ม รวมถึง Mac — open-link แบบใหม่ (https + ไม่มี query + จบ .docx) เปิดได้จริงบน Word 16.101+', () => {
|
||||
vi.spyOn(window.navigator, 'platform', 'get').mockReturnValue('MacIntel')
|
||||
let state = mount() // default '' → auto → Mac = ไม่ยิง
|
||||
const assign = vi.spyOn(window.location, 'assign').mockImplementation(() => {})
|
||||
vi.spyOn(HTMLAnchorElement.prototype, 'click').mockImplementation(() => {})
|
||||
state.openDocxUrl('https://files.example/draft.docx')
|
||||
expect(assign).not.toHaveBeenCalled()
|
||||
|
||||
app.unmount()
|
||||
host.remove()
|
||||
vi.stubGlobal('useRuntimeConfig', () => ({ public: { openInWord: 'on' } }))
|
||||
state = mount()
|
||||
const state = mount()
|
||||
state.openDocxUrl('https://files.example/draft.docx')
|
||||
expect(assign).toHaveBeenCalledWith('ms-word:ofe|u|https://files.example/draft.docx')
|
||||
expect(state.openNotice.value).toContain('อัตโนมัติ')
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue