import { describe, it, expect } from 'vitest'; import { TREK_UI_CSS, TREK_THEME_JS, TREK_UI_MARKER, injectTrekUi } from '../src/index.js'; describe('design kit', () => { it('ships a token-driven stylesheet with the signature TREK components', () => { // Components an author leans on. for (const cls of ['.trek-card', '.trek-glass', '.trek-btn', '.trek-input', '.trek-chip', '.trek-row']) { expect(TREK_UI_CSS).toContain(cls); } // The glass recipe is baked (it can't be read over the bridge) and swaps for dark. expect(TREK_UI_CSS).toContain('--glass-bg'); expect(TREK_UI_CSS).toContain('--glass-highlight'); expect(TREK_UI_CSS).toContain('[data-theme="dark"]'); // Honours the same accessibility choices as the host. expect(TREK_UI_CSS).toContain('prefers-reduced-motion'); expect(TREK_UI_CSS).toContain('[data-no-transparency]'); }); it('ships a bootstrap that wires the frame and never breaks inline embedding', () => { expect(TREK_THEME_JS).toContain("type: 'trek:ready'"); expect(TREK_THEME_JS).toContain('window.trek'); expect(TREK_THEME_JS).toContain("'trek:context'"); // Applies the host tokens + theme to the document. expect(TREK_THEME_JS).toContain('setProperty'); expect(TREK_THEME_JS).toContain("setAttribute('data-theme'"); // Auto-sizing so a widget/page reports its own height. expect(TREK_THEME_JS).toContain('trek:resize'); // Trusts only the real parent window (opaque frame has a 'null' origin). expect(TREK_THEME_JS).toContain('ev.source !== window.parent'); }); it('never contains a closing tag that would break