Automerge backed Markdown editor for the Atmosphere
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960import { describe, it, expect, beforeEach } from 'vitest'import { createTestApp } from '../loader/__tests__/test-utils'import type { App } from '../app'
describe('App plugin compat stubs', () => { let app: App
beforeEach(async () => { app = await createTestApp() })
it('has app.foldManager stub', () => { expect((app as any).foldManager).toBeDefined() // foldManager.save/load are no-ops expect(typeof (app as any).foldManager.save).toBe('function') expect(typeof (app as any).foldManager.load).toBe('function') })
it('has app.customCss.theme', () => { expect((app as any).customCss).toBeDefined() expect(typeof (app as any).customCss.theme).toBe('string') })
it('has internal app.reamsDom.appContainerEl', () => { expect((app as any).reamsDom).toBeDefined() expect((app as any).reamsDom.appContainerEl).toBeInstanceOf(HTMLElement) })
it('has app.keymap.pushScope/popScope', () => { expect(typeof app.keymap.pushScope).toBe('function') expect(typeof app.keymap.popScope).toBe('function') })
it('pushScope/popScope do not throw', async () => { const { Scope } = await import('../../plugin/obsidian-stubs') const scope = new Scope() expect(() => app.keymap.pushScope(scope)).not.toThrow() expect(() => app.keymap.popScope(scope)).not.toThrow() })
it('has app.renderContext (Obsidian 1.10.0+)', async () => { const { RenderContext, HoverPopover } = await import('../../plugin/obsidian-stubs') expect(app.renderContext).toBeDefined() expect(app.renderContext).toBeInstanceOf(RenderContext) // RenderContext implements HoverParent which has hoverPopover: HoverPopover | null expect(app.renderContext.hoverPopover).toBeNull() // Upstream contract has renderContext as writable (not readonly) const newContext = new RenderContext() app.renderContext = newContext expect(app.renderContext).toBe(newContext) // Can set hoverPopover (HoverParent interface) const mockPopover = new HoverPopover( { hoverPopover: null }, // parent implementing HoverParent null // targetEl ) app.renderContext.hoverPopover = mockPopover expect(app.renderContext.hoverPopover).toBe(mockPopover) })})