'actions']; $form['actions']['key'] = [ '#type' => 'submit', '#value' => 'Key', '#dropbutton' => 'submit', '#cache' => [ 'tags' => ['foo'], ], '#attached' => [ 'library' => [ 'system/base', ], ], ]; $form['actions']['submit'] = [ '#type' => 'submit', '#value' => 'Save', ]; return $form; } /** * {@inheritdoc} */ public function validateForm(array &$form, FormStateInterface $form_state) { } /** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { } public function testDropbuttonWithBubbleableMetadata() { $result = \Drupal::formBuilder()->getForm($this); \Drupal::service('renderer')->renderRoot($result); $this->assertEquals(['system/base', 'core/drupal.dropbutton'], $result['#attached']['library']); $this->assertEquals(['foo'], $result['#cache']['tags']); } }