@@ -6,45 +6,33 @@ import {
66} from '../../constants/classNames' ;
77
88describe ( 'buildMentionRulesCSS' , ( ) => {
9- it . each ( [
10- {
11- description : 'EnrichedTextInput' ,
12- input : 'input' as const ,
13- expected : ENRICHED_TEXT_INPUT_CLASSNAME ,
14- } ,
15- {
16- description : 'EnrichedText' ,
17- input : 'text' as const ,
18- expected : ENRICHED_TEXT_CLASSNAME ,
19- } ,
20- ] ) (
21- '[$description] emits default class rule and attribute rule for @' ,
22- ( { input, expected } ) => {
23- const merged = mergeWithDefaultHtmlStyle ( {
24- mention : { '@' : { color : 'red' } } ,
25- } ) ;
26- const css = buildMentionRulesCSS ( input , merged ) ;
9+ it ( 'emits base rules for both containers (default + @)' , ( ) => {
10+ const merged = mergeWithDefaultHtmlStyle ( {
11+ mention : { '@' : { color : 'red' } } ,
12+ } ) ;
13+ const css = buildMentionRulesCSS ( merged ) ;
2714
28- expect ( css ) . toMatch ( new RegExp ( `\\.${ expected } mention\\s*\\{` ) ) ;
29- expect ( css ) . toContain ( 'var(--et-mention-default-color)' ) ;
30- expect ( css ) . toContain ( 'var(--et-mention-default-background-color)' ) ;
31- expect ( css ) . toContain ( 'var(--et-mention-default-text-decoration-line)' ) ;
15+ expect ( css ) . toContain ( `.${ ENRICHED_TEXT_INPUT_CLASSNAME } mention` ) ;
16+ expect ( css ) . toContain ( `.${ ENRICHED_TEXT_CLASSNAME } mention` ) ;
17+ expect ( css ) . toContain ( 'var(--et-mention-default-color)' ) ;
18+ expect ( css ) . toContain ( 'var(--et-mention-default-background-color)' ) ;
19+ expect ( css ) . toContain ( 'var(--et-mention-default-text-decoration-line)' ) ;
3220
33- expect ( css ) . toContain ( `.${ expected } mention[indicator="@"]` ) ;
34- expect ( css ) . toContain ( 'var(--et-mention-u0040-color)' ) ;
35- expect ( css ) . toContain ( 'var(--et-mention-u0040-background-color)' ) ;
36- expect ( css ) . toContain ( 'var(--et-mention-u0040-text-decoration-line)' ) ;
37- }
38- ) ;
21+ expect ( css ) . toContain (
22+ `.${ ENRICHED_TEXT_INPUT_CLASSNAME } mention[indicator="@"]`
23+ ) ;
24+ expect ( css ) . toContain ( `.${ ENRICHED_TEXT_CLASSNAME } mention[indicator="@"]` ) ;
25+ expect ( css ) . toContain ( 'var(--et-mention-u0040-color)' ) ;
26+ expect ( css ) . toContain ( 'var(--et-mention-u0040-background-color)' ) ;
27+ expect ( css ) . toContain ( 'var(--et-mention-u0040-text-decoration-line)' ) ;
28+ } ) ;
3929
4030 it ( 'returns empty string when mention is missing' , ( ) => {
41- expect ( buildMentionRulesCSS ( 'input' , undefined ) ) . toBe ( '' ) ;
42- expect ( buildMentionRulesCSS ( 'input' , { } ) ) . toBe ( '' ) ;
31+ expect ( buildMentionRulesCSS ( undefined ) ) . toBe ( '' ) ;
32+ expect ( buildMentionRulesCSS ( { } ) ) . toBe ( '' ) ;
4333 } ) ;
4434
4535 it ( 'returns empty string when mention is not a style record' , ( ) => {
46- expect ( buildMentionRulesCSS ( 'input' , { mention : { color : 'red' } } ) ) . toBe (
47- ''
48- ) ;
36+ expect ( buildMentionRulesCSS ( { mention : { color : 'red' } } ) ) . toBe ( '' ) ;
4937 } ) ;
5038} ) ;
0 commit comments