import { expect, test } from "bun:test";
import { compile } from "../src/index.ts";

test("compiles declarative portals, transitions and dynamic component cases", () => {
  const result = compile(`page Ui {
    view {
      <Portal to="#modal"><p>Modal</p></Portal>
      <Transition name="fade"><p>Animated</p></Transition>
      <Component is="Admin"><section data-component-case="Admin">Admin</section><section data-component-case="Guest">Guest</section></Component>
    }
  }`);
  expect(result.code).toContain('data-wrn-portal="#modal"');
  expect(result.code).toContain('data-wrn-transition="fade"');
  expect(result.code).toContain('data-wrn-dynamic-component="Admin"');
});
