This repository was archived by the owner on Jul 7, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,28 @@ public function testAltText(): void
8686 $ this ->assertXmlStringEqualsXmlString ($ iconString , $ this ->changeSvgTitleId ($ this ->icon ->render (), $ iconTitleId ));
8787 }
8888
89+ public function testSettingAttributes (): void
90+ {
91+ $ attributes = [
92+ 'data-custom-attribute ' => 'test ' ,
93+ 'data-other-attribute ' => 'test2 ' ,
94+ 'width ' => 12 ,
95+ 'height ' => 24 ,
96+ 'stroke ' => '#fff ' ,
97+ 'stroke-width ' => 2 ,
98+ 'class ' => 'custom-class '
99+ ];
100+
101+ $ this ->icon ->setAttributes (['data-custom-attribute ' => $ attributes ['data-custom-attribute ' ]])
102+ ->setAttribute ('data-other-attribute ' , $ attributes ['data-other-attribute ' ])
103+ ->setSize ($ attributes ['width ' ], $ attributes ['height ' ])
104+ ->setColor ($ attributes ['stroke ' ])
105+ ->setWeight ($ attributes ['stroke-width ' ])
106+ ->setCssClass ($ attributes ['class ' ]);
107+
108+ $ this ->assertEquals ($ attributes , $ this ->icon ->getAttributes ());
109+ }
110+
89111 private function changeSvgTitleId (string $ svg , string $ id ): string
90112 {
91113 $ xmlLoader = new Loader ();
You can’t perform that action at this time.
0 commit comments