Verified Commit 2e403c17 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3256922 by danflanagan8, GaëlG: Warning on AJAX call when changing the...

Issue #3256922 by danflanagan8, GaëlG: Warning on AJAX call when changing the breakpoint_group field value of a responsive image style

(cherry picked from commit 9dc6f60e)
parent 9266e0ea
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -225,6 +225,7 @@ public function validateForm(array &$form, FormStateInterface $form_state) {
      if ($form_state->getValue('breakpoint_group') != $form_state->getCompleteForm()['breakpoint_group']['#default_value']) {
        // Remove the image style mappings since the breakpoint ID has changed.
        $form_state->unsetValue('keyed_styles');
        return;
      }

      // Check that at least 1 image style has been selected when using sizes.
+10 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ public function testResponsiveImageAdmin() {
    $edit = [
      'label' => 'Style One',
      'id' => 'style_one',
      'breakpoint_group' => 'responsive_image_test_module',
      'breakpoint_group' => 'responsive_image',
      'fallback_image_style' => 'thumbnail',
    ];
    $this->drupalGet('admin/config/media/responsive-image-style/add');
@@ -67,6 +67,15 @@ public function testResponsiveImageAdmin() {
    $this->assertSession()->pageTextNotContains('There are no responsive image styles yet.');
    $this->assertSession()->pageTextContains('Style One');

    // Edit the breakpoint_group.
    $this->drupalGet('admin/config/media/responsive-image-style/style_one');
    $this->assertSession()->fieldValueEquals('label', 'Style One');
    $this->assertSession()->fieldValueEquals('breakpoint_group', 'responsive_image');
    $edit = [
      'breakpoint_group' => 'responsive_image_test_module',
    ];
    $this->submitForm($edit, 'Save');

    // Edit the group.
    $this->drupalGet('admin/config/media/responsive-image-style/style_one');
    $this->assertSession()->fieldValueEquals('label', 'Style One');