Commit 8a4928c1 authored by Cristina Chumillas's avatar Cristina Chumillas
Browse files

Issue #3223233 by joachim, danflanagan8, longwave: Form to edit or add a...

Issue #3223233 by joachim, danflanagan8, longwave: Form to edit or add a single image effect doesn't tell you which style you're in
parent 9d75e740
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -46,7 +46,10 @@ public static function create(ContainerInterface $container) {
  public function buildForm(array $form, FormStateInterface $form_state, ImageStyleInterface $image_style = NULL, $image_effect = NULL) {
    $form = parent::buildForm($form, $form_state, $image_style, $image_effect);

    $form['#title'] = $this->t('Add %label effect', ['%label' => $this->imageEffect->label()]);
    $form['#title'] = $this->t('Add %label effect to style %style', [
      '%label' => $this->imageEffect->label(),
      '%style' => $image_style->label(),
    ]);
    $form['actions']['submit']['#value'] = $this->t('Add effect');

    return $form;
+4 −1
Original line number Diff line number Diff line
@@ -18,7 +18,10 @@ class ImageEffectEditForm extends ImageEffectFormBase {
  public function buildForm(array $form, FormStateInterface $form_state, ImageStyleInterface $image_style = NULL, $image_effect = NULL) {
    $form = parent::buildForm($form, $form_state, $image_style, $image_effect);

    $form['#title'] = $this->t('Edit %label effect', ['%label' => $this->imageEffect->label()]);
    $form['#title'] = $this->t('Edit %label effect on style %style', [
      '%label' => $this->imageEffect->label(),
      '%style' => $image_style->label(),
    ]);
    $form['actions']['submit']['#value'] = $this->t('Update effect');

    return $form;
+4 −0
Original line number Diff line number Diff line
@@ -140,6 +140,8 @@ public function testStyle() {
      $this->drupalGet($style_path);
      $this->submitForm(['new' => $effect], 'Add');
      if (!empty($edit)) {
        $effect_label = \Drupal::service('plugin.manager.image.effect')->createInstance($effect)->label();
        $this->assertSession()->pageTextContains("Add {$effect_label} effect to style {$style_label}");
        $this->submitForm($edit_data, 'Add effect');
      }
    }
@@ -391,6 +393,7 @@ public function testEditEffect() {

    // There should normally be only one edit link on this page initially.
    $this->clickLink('Edit');
    $this->assertSession()->pageTextContains("Edit Scale and crop effect on style Test style effect edit");
    $this->submitForm(['data[width]' => '360', 'data[height]' => '240'], 'Update effect');
    $this->assertSession()->pageTextContains('Scale and crop 360×240');

@@ -405,6 +408,7 @@ public function testEditEffect() {

    // Edit the scale effect that was just added.
    $this->clickLink('Edit');
    $this->assertSession()->pageTextContains("Edit Scale effect on style Test style scale edit scale");
    $this->submitForm(['data[width]' => '24', 'data[height]' => '19'], 'Update effect');

    // Add another scale effect and make sure both exist. Click through from