Commit 57364932 authored by jrockowitz's avatar jrockowitz Committed by jrockowitz

Issue #2999958 by jrockowitz, zenimagine: How to update the new library with Composer ?

parent 81c02909
......@@ -107,23 +107,22 @@ class WebformLibrariesTest extends WebformTestBase {
// Check that status report excludes optional libraries.
$this->drupalGet('admin/reports/status');
$this->assertText('The CKEditor: Fakeobjects library is excluded.');
$this->assertText('The CKEditor: Image library is excluded.');
$this->assertText('The CKEditor: Link library is excluded.');
$this->assertText('The Code Mirror library is excluded.');
$this->assertText('The jQuery: iCheck library is excluded.');
$this->assertText('The jQuery: Input Mask library is excluded.');
$this->assertText('The jQuery: Select2 library is excluded.');
$this->assertText('The jQuery: Chosen library is excluded.');
$this->assertText('The jQuery: Timepicker library is excluded.');
$this->assertText('The jQuery: Text Counter library is excluded.');
$this->assertNoText('CKEditor: Fakeobjects library ');
$this->assertNoText('CKEditor: Image library ');
$this->assertNoText('CKEditor: Link library ');
$this->assertNoText('Code Mirror library ');
$this->assertNoText('jQuery: iCheck library ');
$this->assertNoText('jQuery: Input Mask library ');
$this->assertNoText('jQuery: Select2 library ');
$this->assertNoText('jQuery: Chosen library ');
$this->assertNoText('jQuery: Timepicker library ');
$this->assertNoText('jQuery: Text Counter library ');
// Issue #2934542: Fix broken Webform.Drupal\webform\Tests\WebformLibrariesTest
// @see https://www.drupal.org/project/webform/issues/2934542
/*
// Exclude element types that require libraries.
$edit = [
'excluded_elements[webform_image_select]' => FALSE,
'excluded_elements[webform_location_geocomplete]' => FALSE,
'excluded_elements[webform_rating]' => FALSE,
'excluded_elements[webform_signature]' => FALSE,
......@@ -134,11 +133,11 @@ class WebformLibrariesTest extends WebformTestBase {
// Check that status report excludes libraries required by element types.
$this->drupalGet('admin/reports/status');
$this->assertText('The jQuery: Geocoding and Places Autocomplete Plugin library is excluded because required element types (webform_location_geocomplete) are excluded.');
$this->assertText('The jQuery: Image Picker library is excluded because required element types (webform_image_select) are excluded.');
$this->assertText('The jQuery: RateIt library is excluded because required element types (webform_rating) are excluded.');
$this->assertText('The jQuery: Toggles library is excluded because required element types (webform_toggle; webform_toggles) are excluded.');
$this->assertText('The Signature Pad library is excluded because required element types (webform_signature) are excluded.');
$this->assertNoText('jQuery: Geocoding and Places Autocomplete Plugin library');
$this->assertNoText('jQuery: Image Picker library');
$this->assertNoText('jQuery: RateIt library');
$this->assertNoText('jQuery: Toggles library');
$this->assertNoText('Signature Pad library');
*/
}
......
......@@ -102,6 +102,12 @@ class WebformLibrariesManager implements WebformLibrariesManagerInterface {
];
foreach ($libraries as $library_name => $library) {
// Excluded.
if ($this->isExcluded($library_name)) {
$stats['@excluded']++;
continue;
}
$library_path = '/libraries/' . $library_name;
$library_exists = (file_exists(DRUPAL_ROOT . $library_path)) ? TRUE : FALSE;
......@@ -117,19 +123,7 @@ class WebformLibrariesManager implements WebformLibrariesManagerInterface {
':settings_elements_href' => Url::fromRoute('webform.config.elements')->toString(),
];
if ($this->isExcluded($library_name)) {
// Excluded.
$stats['@excluded']++;
$title = $this->t('<strong>@title</strong> (Excluded)', $t_args);
if (!empty($library['elements']) && $this->areElementsExcluded($library['elements'])) {
$t_args['@element_type'] = implode('; ', $library['elements']);
$description = $this->t('The <a href=":homepage_href">@title</a> library is excluded because required element types (@element_type) are <a href=":settings_elements_href">excluded</a>.', $t_args);
}
else {
$description = $this->t('The <a href=":homepage_href">@title</a> library is <a href=":settings_libraries_href">excluded</a>.', $t_args);
}
}
elseif ($library_exists) {
if ($library_exists) {
// Installed.
$stats['@installed']++;
$title = $this->t('<strong>@title @version</strong> (Installed)', $t_args);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment