@@ -14,8 +14,8 @@ function readSource(relativePath: string): string {
1414 return readFileSync ( resolve ( __dirname , relativePath ) , "utf-8" ) ;
1515}
1616
17- describe ( "callout-plugin design spec compliance" , ( ) => {
18- const source = readSource ( "./callout-plugin .tsx" ) ;
17+ describe ( "callout-node design spec compliance" , ( ) => {
18+ const source = readSource ( "./callout-node .tsx" ) ;
1919
2020 it ( "callout emoji does not use text-base (not in typography scale)" , ( ) => {
2121 // The typography scale does not include text-base. Emoji should use
@@ -32,6 +32,41 @@ describe("callout-plugin design spec compliance", () => {
3232 ) ;
3333 expect ( emojiClassLine ) . not . toBeNull ( ) ;
3434 } ) ;
35+
36+ it ( "callout emoji span is created in createDOM, not via mutation listener" , ( ) => {
37+ // The emoji must render immediately on insert, not asynchronously via
38+ // a mutation listener. Verify createDOM creates the emoji span.
39+ expect ( source ) . toContain ( "createDOM" ) ;
40+ const createDOMIndex = source . indexOf ( "createDOM" ) ;
41+ const emojiIndex = source . indexOf ( "callout-emoji" , createDOMIndex ) ;
42+ expect ( emojiIndex ) . toBeGreaterThan ( createDOMIndex ) ;
43+ } ) ;
44+
45+ it ( "callout uses a left border to distinguish from code blocks" , ( ) => {
46+ // Design spec: callouts need visual distinction from code blocks.
47+ // A colored left border provides this.
48+ expect ( source ) . toContain ( "border-l-2" ) ;
49+ } ) ;
50+
51+ it ( "each callout variant has a distinct border color" , ( ) => {
52+ // All four variants must map to different border color classes
53+ const variantBlock = source . match (
54+ / V A R I A N T _ C L A S S E S [ \s \S ] * ?\{ ( [ \s \S ] * ?) \} /
55+ ) ;
56+ expect ( variantBlock ) . not . toBeNull ( ) ;
57+ const block = variantBlock ! [ 1 ] ;
58+ expect ( block ) . toContain ( "border-l-accent" ) ;
59+ expect ( block ) . toContain ( "border-l-code-type" ) ;
60+ expect ( block ) . toContain ( "border-l-code-string" ) ;
61+ expect ( block ) . toContain ( "border-l-destructive" ) ;
62+ } ) ;
63+
64+ it ( "callout plugin does not use registerMutationListener for emoji" , ( ) => {
65+ // Emoji rendering moved to createDOM — the plugin should not
66+ // manipulate DOM via mutation listeners.
67+ const pluginSource = readSource ( "./callout-plugin.tsx" ) ;
68+ expect ( pluginSource ) . not . toContain ( "registerMutationListener" ) ;
69+ } ) ;
3570} ) ;
3671
3772describe ( "editor anchor element" , ( ) => {
0 commit comments