@@ -75,4 +75,66 @@ public function testIcon()
7575 ];
7676 $ this ->assertHtml ($ expected , $ result );
7777 }
78+
79+ public function testIconWithoutNamespace (): void
80+ {
81+ // Remixicon style: ri-home-line (no namespace, just prefix)
82+ $ result = $ this ->Html ->icon ('home-line ' , ['namespace ' => null , 'prefix ' => 'ri ' ]);
83+ $ expected = [
84+ 'i ' => ['class ' => 'ri-home-line ' ],
85+ '/i ' ,
86+ ];
87+ $ this ->assertHtml ($ expected , $ result );
88+
89+ // With empty string namespace
90+ $ result = $ this ->Html ->icon ('home-line ' , ['namespace ' => '' , 'prefix ' => 'ri ' ]);
91+ $ expected = [
92+ 'i ' => ['class ' => 'ri-home-line ' ],
93+ '/i ' ,
94+ ];
95+ $ this ->assertHtml ($ expected , $ result );
96+
97+ // With size
98+ $ result = $ this ->Html ->icon ('home-line ' , ['namespace ' => null , 'prefix ' => 'ri ' , 'size ' => 'lg ' ]);
99+ $ expected = [
100+ 'i ' => ['class ' => 'ri-home-line ri-lg ' ],
101+ '/i ' ,
102+ ];
103+ $ this ->assertHtml ($ expected , $ result );
104+ }
105+
106+ public function testIconWithoutPrefix (): void
107+ {
108+ // Icon set with namespace but no prefix
109+ $ result = $ this ->Html ->icon ('home ' , ['namespace ' => 'icons ' , 'prefix ' => null ]);
110+ $ expected = [
111+ 'i ' => ['class ' => 'icons home ' ],
112+ '/i ' ,
113+ ];
114+ $ this ->assertHtml ($ expected , $ result );
115+ }
116+
117+ public function testIconWithoutNamespaceAndPrefix (): void
118+ {
119+ // Hypothetical icon set using custom tag and just the icon name
120+ $ result = $ this ->Html ->icon ('home ' , ['tag ' => 'icon ' , 'namespace ' => null , 'prefix ' => null ]);
121+ $ expected = [
122+ 'icon ' => ['class ' => 'home ' ],
123+ '/icon ' ,
124+ ];
125+ $ this ->assertHtml ($ expected , $ result );
126+
127+ // With additional class
128+ $ result = $ this ->Html ->icon ('home ' , [
129+ 'tag ' => 'icon ' ,
130+ 'namespace ' => null ,
131+ 'prefix ' => null ,
132+ 'class ' => 'fs-5 ' ,
133+ ]);
134+ $ expected = [
135+ 'icon ' => ['class ' => 'fs-5 home ' ],
136+ '/icon ' ,
137+ ];
138+ $ this ->assertHtml ($ expected , $ result );
139+ }
78140}
0 commit comments