Skip to content
Snippets Groups Projects
Verified Commit be4ba84f authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3375806 by urvashi_vora, Lendude, tinto, Harish1688, finne: Views...

Issue #3375806 by urvashi_vora, Lendude, tinto, Harish1688, finne: Views 'Rearrange' dialog show the 'Remove' checkbox, which should be visually hidden

(cherry picked from commit 597cf49e)
parent 27e200c8
No related branches found
No related tags found
20 merge requests!11628Update file MediaLibraryWidget.php,!7564Revert "Issue #3364773 by roshnichordiya, Chris Matthews, thakurnishant_06,...,!5752Issue #3275828 by joachim, quietone, bradjones1, Berdir: document the reason...,!5627Issue #3261805: Field not saved when change of 0 on string start,!5427Issue #3338518: send credentials in ajax if configured in CORS settings.,!5395Issue #3387916 by fjgarlin, Spokje: Each GitLab job exposes user email,!5217Issue #3386607 by alexpott: Improve spell checking in commit-code-check.sh,!5064Issue #3379522 by finnsky, Gauravvvv, kostyashupenko, smustgrave, Chi: Revert...,!5040SDC ComponentElement: Transform slots scalar values to #plain_text instead of throwing an exception,!4958Issue #3392147: Whitelist IP for a Ban module.,!4894Issue #3280279: Add API to allow sites to opt in to upload SVG images in CKEditor 5,!4857Issue #3336994: StringFormatter always displays links to entity even if the user in context does not have access,!4856Issue #3336994: StringFormatter always displays links to entity even if the user in context does not have access,!4788Issue #3272985: RSS Feed header reverts to text/html when cached,!4716Issue #3362929: Improve 400 responses for broken/invalid image style routes,!4553Draft: Issue #2980951: Permission to see own unpublished comments in comment thread,!3679Issue #115801: Allow password on registration without disabling e-mail verification,!3106Issue #3017548: "Filtered HTML" text format does not support manual teaser break (<!--break-->),!925Issue #2339235: Remove taxonomy hard dependency on node module,!872Draft: Issue #3221319: Race condition when creating menu links and editing content deletes menu links
......@@ -125,7 +125,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
'#title' => $this->t('Remove @title', ['@title' => $name]),
'#title_display' => 'invisible',
'#id' => 'views-removed-' . $id,
'#attributes' => ['class' => ['views-remove-checkbox']],
'#attributes' => ['class' => ['views-remove-checkbox', 'js-hide']],
'#default_value' => 0,
'#suffix' => Link::fromTextAndUrl(new FormattableMarkup('<span>@text</span>', ['@text' => $this->t('Remove')]),
Url::fromRoute('<none>', [], [
......
<?php
namespace Drupal\Tests\views_ui\FunctionalJavascript;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
use Drupal\views\Tests\ViewTestData;
/**
* Tests the fields dialogs.
*
* @group views_ui
*/
class FieldDialogsTest extends WebDriverTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'node',
'views',
'views_ui',
'views_test_config',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Views used by this test.
*
* @var string[]
*/
public static $testViews = ['test_content_ajax'];
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
ViewTestData::createTestViews(self::class, ['views_test_config']);
$admin_user = $this->drupalCreateUser([
'administer site configuration',
'administer views',
'access content overview',
]);
// Disable automatic live preview to make the sequence of calls clearer.
\Drupal::configFactory()->getEditable('views.settings')->set('ui.always_live_preview', FALSE)->save();
$this->drupalLogin($admin_user);
}
/**
* Tests removing a field through the rearrange dialog.
*/
public function testRemoveFieldHandler() {
$this->drupalGet('admin/structure/views/view/test_content_ajax');
$page = $this->getSession()->getPage();
$this->openFieldDialog();
$remove_link = $page->findAll('css', '.views-remove-link')[1];
$parent = $remove_link->getParent();
$this->assertTrue($remove_link->isVisible());
$remove_checkbox = $this->assertSession()->fieldExists('fields[title][removed]', $parent);
$this->assertFalse($remove_checkbox->isVisible());
$this->assertFalse($remove_checkbox->isChecked());
$remove_link->click();
$this->assertFalse($remove_link->isVisible());
$this->assertTrue($remove_checkbox->isChecked());
}
/**
* Uses the 'And/Or Rearrange' link for fields to open a dialog.
*/
protected function openFieldDialog() {
$assert_session = $this->assertSession();
$page = $this->getSession()->getPage();
$dropbutton = $page->find('css', '.views-ui-display-tab-bucket.field .dropbutton-toggle button');
$dropbutton->click();
$add_link = $page->findById('views-rearrange-field');
$this->assertTrue($add_link->isVisible(), 'And/Or Rearrange button found.');
$add_link->click();
$assert_session->assertWaitOnAjaxRequest();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment