@@ -143,16 +143,18 @@ public function testCanAddStimulusControllerViaStimulusAttributes(): void
143143 ], new EscaperRuntime ());
144144
145145 $ stimulusAttributes = new StimulusAttributes (new Environment (new ArrayLoader ()));
146- $ stimulusAttributes ->addController ('foo ' , ['name ' => 'ryan ' , 'some_array ' => ['a ' , 'b ' ]]);
146+ $ stimulusAttributes ->addController ('foo ' , ['name ' => 'ryan ' , 'some_array ' => ['a ' , 'b ' ], ' some_array_with_keys ' => [ ' key1 ' => ' value1 ' , ' key2 ' => ' value2 ' ] ]);
147147 $ attributes = $ attributes ->defaults ($ stimulusAttributes );
148148
149149 $ this ->assertEquals ([
150150 'class ' => 'foo ' ,
151151 'data-controller ' => 'foo live ' ,
152152 'data-live-data-value ' => '{} ' ,
153153 'data-foo-name-value ' => 'ryan ' ,
154- 'data-foo-some-array-value ' => '["a","b"] ' ,
154+ 'data-foo-some-array-value ' => '["a","b"] ' ,
155+ 'data-foo-some-array-with-keys-value ' => '{"key1":"value1","key2":"value2"} ' ,
155156 ], $ attributes ->all ());
157+ $ this ->assertSame (' data-controller="foo live" data-foo-name-value="ryan" data-foo-some-array-value="["a","b"]" data-foo-some-array-with-keys-value="{"key1":"value1","key2":"value2"}" class="foo" data-live-data-value="{}" ' , (string ) $ attributes );
156158 }
157159
158160 public function testCanAddStimulusActionViaStimulusAttributes (): void
@@ -175,6 +177,7 @@ public function testCanAddStimulusActionViaStimulusAttributes(): void
175177 'class ' => 'foo ' ,
176178 'data-action ' => 'foo#barMethod live#foo ' ,
177179 ], $ attributes ->all ());
180+ $ this ->assertSame (' data-action="foo#barMethod live#foo" class="foo" ' , (string ) $ attributes );
178181 }
179182
180183 public function testBooleanBehaviour (): void
0 commit comments