Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SHS-5958: Bug: Inconsistent "Add Above" feature #1692

Merged
merged 22 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
243e9bc
fix(SHS-5958): Fix issue with paragraphs features to allow add button…
codechefmarc Nov 28, 2024
d4e3c96
Merge branch '11.6.1-release' into SHS-5958--fix-add-above
codechefmarc Dec 3, 2024
dd4192c
feat(SHS-5958): Add config and update hook to allow add paragraphs in…
codechefmarc Dec 3, 2024
3ed4c8e
refactor(SHS-5958): Change how we are updating the add in between to …
codechefmarc Dec 4, 2024
338c3ca
test(SHS-5958): Update test to refelect new buttons
codechefmarc Dec 4, 2024
3ed393a
test(SHS-5958): Update testPostCard test for new add in between buttons
codechefmarc Dec 4, 2024
0040930
test(SHS-5958): Update other tests for new add in between buttons
codechefmarc Dec 4, 2024
0c1e3ea
test(SHS-5958): Add a wait in test to make sure JS add in between but…
codechefmarc Dec 4, 2024
20bc3a1
test(SHS-5958): Fix photo album test - photo album can come before or…
codechefmarc Dec 4, 2024
56e40a5
fix(shs-5958): fix video embed test
cienvaras Dec 5, 2024
bc12420
fix(shs-5958): fix private page tests
cienvaras Dec 5, 2024
e57db70
fix(shs-5958): fix video embed test
cienvaras Dec 5, 2024
3cc1e15
fix(shs-5958): fix private page tests
cienvaras Dec 5, 2024
e7d1407
fix(shs-5958): fixes in tests
cienvaras Dec 5, 2024
df15c7a
fix(shs-5958): fix private page tests
cienvaras Dec 5, 2024
aec9d46
fix(shs-5958): fix private page tests
cienvaras Dec 5, 2024
c5aae88
chore(SHS-5958): Remove unnecessary layout builder config
codechefmarc Dec 5, 2024
3da27c6
Merge branch '11.6.1-release' into SHS-5958--fix-add-above
codechefmarc Dec 9, 2024
8e828ea
Merge branch '11.6.1-release' into SHS-5958--fix-add-above
codechefmarc Dec 11, 2024
732b1f7
chore(SHS-5958): Revert hidden layout builder layout
codechefmarc Dec 11, 2024
2375faa
chore(SHS-5958): Revert composer.lock to 11.6.1 version
codechefmarc Dec 11, 2024
9dbacbe
Merge branch '11.6.1-release' of github.com:SU-HSDO/suhumsci into SHS…
cienvaras Dec 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@
"https://www.drupal.org/project/paragraphs_browser/issues/3381981": "https://www.drupal.org/files/issues/2023-08-22/3381981-sort-by-weight-4.patch",
"https://www.drupal.org/project/paragraphs_browser/issues/3064852": "https://www.drupal.org/files/issues/2023-11-07/3064852-allow-hiding-browser-12.patch"
},
"drupal/paragraphs_features": {
"Add-in only works if active theme is claro or gin https://www.drupal.org/project/paragraphs_features/issues/3353704": "https://www.drupal.org/files/issues/2024-03-22/3353704-mr12-18.patch"
},
"drupal/redirect": {
"https://www.drupal.org/project/redirect/issues/3057250": "https://www.drupal.org/files/issues/2024-08-11/redirect--2024-08-11--3057250-79.patch",
"https://www.drupal.org/project/redirect/issues/3018897": "https://www.drupal.org/files/issues/2024-08-12/redirect-3018897-28.patch"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dependencies:
- field.field.node.hs_basic_page.layout_builder__layout
- node.type.hs_basic_page
module:
- field_formatter_class
- menu_link
- paragraphs
- paragraphs_ee
Expand Down Expand Up @@ -48,16 +49,19 @@ content:
duplicate: duplicate
expose_drag_drop: '1'
third_party_settings:
field_formatter_class:
class: ''
paragraphs_features:
add_in_between: false
add_in_between_link_count: 3
add_in_between: true
add_in_between_link_count: 0
delete_confirmation: false
show_drag_and_drop: true
show_collapse_all: true
paragraphs_ee:
paragraphs_ee:
dialog_off_canvas: false
dialog_style: tiles
drag_drop: false
field_hs_page_hero:
type: paragraphs
weight: 1
Expand All @@ -79,16 +83,19 @@ content:
duplicate: duplicate
expose_drag_drop: '1'
third_party_settings:
field_formatter_class:
class: ''
paragraphs_features:
add_in_between: false
add_in_between_link_count: 3
add_in_between: true
add_in_between_link_count: 0
delete_confirmation: false
show_drag_and_drop: true
show_collapse_all: true
paragraphs_ee:
paragraphs_ee:
dialog_off_canvas: false
dialog_style: tiles
drag_drop: false
field_menulink:
type: menu_link_default
weight: 26
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dependencies:
- field.field.node.hs_private_page.layout_builder__layout
- node.type.hs_private_page
module:
- field_formatter_class
- file
- insert
- menu_link
Expand Down Expand Up @@ -46,17 +47,21 @@ content:
collapse_edit_all: collapse_edit_all
convert: '0'
duplicate: duplicate
expose_drag_drop: '1'
third_party_settings:
field_formatter_class:
class: ''
paragraphs_features:
add_in_between: false
add_in_between_link_count: 3
add_in_between: true
add_in_between_link_count: 0
delete_confirmation: false
show_drag_and_drop: true
show_collapse_all: true
paragraphs_ee:
paragraphs_ee:
dialog_off_canvas: false
dialog_style: tiles
drag_drop: false
field_menulink:
type: menu_link_default
weight: 26
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,3 +376,32 @@ function hs_paragraph_types_update_10010() {
$hs_priv_collection_style->delete();
}
}

/**
* Adds add between buttons to existing paragraphs.
*/
function hs_paragraph_types_update_10011() {
$fields = [
'field_hs_page_components' => 'node.hs_basic_page.default',
'field_hs_page_hero' => 'node.hs_basic_page.default',
'field_hs_priv_page_components' => 'node.hs_private_page.default',
];
$form_display_storage = \Drupal::entityTypeManager()->getStorage('entity_form_display');
foreach ($fields as $field => $form_display_id) {
/** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */
$form_display = $form_display_storage->load($form_display_id);
if (empty($form_display)) {
continue;
}

$component = $form_display->getComponent($field);

if (empty($component)) {
continue;
}
$component['third_party_settings']['paragraphs_features']['add_in_between'] = 'true';
$component['third_party_settings']['paragraphs_features']['add_in_between_link_count'] = 0;
$form_display->setComponent($field, $component)
->save();
}
}
24 changes: 12 additions & 12 deletions tests/codeception/functional/Install/Content/FlexiblePageCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public function testDuplicateScroll(FunctionalTester $I) {
'type' => 'hs_basic_page',
]);
$I->amOnPage($node->toUrl('edit-form')->toString());
$I->scrollTo('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more');
$I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more');
$I->scrollTo('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button');
$I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button');
$I->waitForText('Add Component');
$I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'Collection');
$I->click('Collection', '.paragraphs-ee-add-dialog');
Expand Down Expand Up @@ -91,7 +91,7 @@ public function testHeroParagraph(FunctionalTester $I) {
// Prevent JS alerts from firing before loading a new page.
$I->executeJS('window.onbeforeunload = undefined;');
$I->fillField('Title', 'Demo Basic Page');
$I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more');
$I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button');
$I->waitForText('Add Component');
$I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'Banner');
$I->click('Banner image with full overlay and text', '.paragraphs-ee-add-dialog');
Expand Down Expand Up @@ -132,7 +132,7 @@ public function testPhotoAlbum(FunctionalTester $I) {
// Prevent JS alerts from firing before loading a new page.
$I->executeJS('window.onbeforeunload = undefined;');
$I->fillField('Title', 'Demo Basic Page');
$I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more');
$I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button');
$I->waitForText('Add Component');
$I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'Photo Album');
$I->click('Photo Album', '.paragraphs-ee-add-dialog');
Expand All @@ -158,7 +158,7 @@ public function testPhotoAlbum(FunctionalTester $I) {
$I->canSeeNumberOfElements('#cboxContent img', 0);
$I->waitForText('Edit');
$I->click('Edit', '.tabs');
$I->click('field_hs_page_components_1_edit');
$I->click('//input[@data-paragraphs-split-text-type="stanford_gallery"]/preceding::input[contains(@class, "paragraphs-icon-button-edit")][1]');
$I->waitForText('Content');
$I->scrollTo('Style');
$I->selectOption('Style', 'Slideshow');
Expand Down Expand Up @@ -236,7 +236,7 @@ public function testSpotlightSlider(FunctionalTester $I) {
'type' => 'hs_basic_page',
]);
$I->amOnPage($node->toUrl('edit-form')->toString());
$I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more');
$I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button');
$I->waitForText('Add Component');
$I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'Spotlight');
$I->click('Spotlight(s)', '.paragraphs-ee-add-dialog');
Expand Down Expand Up @@ -308,7 +308,7 @@ public function testVerticalTimeline(FunctionalTester $I) {
$I->logInWithRole('administrator');
$I->amOnPage('node/add/hs_basic_page');
$I->fillField('Title', $this->faker->words(3, TRUE));
$I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more');
$I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button');
$I->waitForText('Add Component');
$I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'Vertical Timeline');
$I->click('Vertical Timeline', '.paragraphs-ee-add-dialog');
Expand Down Expand Up @@ -352,7 +352,7 @@ public function testPostCard(FunctionalTester $I) {
$I->logInWithRole('contributor');
$I->amOnPage('/node/add/hs_basic_page');
$I->fillField('Title', 'Demo Basic Page');
$I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more');
$I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button');
$I->waitForText('Add Component');
$I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'Postcard');
$I->click('Postcard', '.paragraphs-ee-add-dialog');
Expand All @@ -376,7 +376,7 @@ public function testAccordion(FunctionalTester $I) {
$I->logInWithRole('contributor');
$I->amOnPage('/node/add/hs_basic_page');
$I->fillField('Title', 'Demo Basic Page');
$I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more');
$I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button');
$I->waitForText('Add Component');
$I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'accordion');
$I->click('Accordion', '.paragraphs-ee-add-dialog');
Expand Down Expand Up @@ -405,7 +405,7 @@ public function testBackToTopExists(FunctionalTester $I) {
}
catch (\Exception $e) {
// Add component if does not already exist.
$I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more');
$I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button');
$I->waitForText('Add Component');
$I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'text area');
$I->click('Text Area', '.paragraphs-ee-add-dialog');
Expand Down Expand Up @@ -446,7 +446,7 @@ public function testTextArea(FunctionalTester $I) {
}
catch (\Exception $e) {
// Add component if does not already exist.
$I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more');
$I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button');
$I->waitForText('Add Component');
$I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'text area');
$I->click('Text Area', '.paragraphs-ee-add-dialog');
Expand Down Expand Up @@ -477,7 +477,7 @@ public function testCollections(FunctionalTester $I) {
$I->amOnPage('/node/add/hs_basic_page');
$I->fillField('Title', 'Demo Basic Page');
// Add a Collection component to the page.
$I->click('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more');
$I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button');
$I->waitForText('Add Component');
$I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'Collection');
$I->click('Collection', '.paragraphs-ee-add-dialog');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public function testPrivatePageContent(FunctionalTester $I) {
$I->amOnPage('/node/add/hs_private_page');
$I->fillField('Title', 'Test Private Page');
foreach ($this->fieldsToCheck as $component => $component_info) {
$I->scrollTo('.field--name-field-priv-wysiwyg-files');
$I->click('Add Component');
$I->scrollTo('table[id^="field-hs-priv-page-components-values"] tr:last-child .paragraphs-features__add-in-between__button');
$I->click('table[id^="field-hs-priv-page-components-values"] tr:last-child .paragraphs-features__add-in-between__button');
$I->waitForText('Add Component');
$I->fillField('.paragraphs-ee-add-dialog input[type="search"]', $component);
$I->click($component_info['component_button_name'], '.paragraphs-ee-add-dialog');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ public function testVideoEmbed(FunctionalTester $I) {
$I->fillField('Title', $this->faker->words(3, TRUE));

// Add text field.
$I->scrollTo('#edit-field-hs-page-components-add-more-add-modal-form-area-add-more');
$I->click('Add Component');
$I->click('#field-hs-page-components-values tr:last-child .paragraphs-features__add-in-between__button');
$I->waitForText('Add Component');
$I->fillField('.paragraphs-ee-add-dialog input[type="search"]', 'Text Area');
$I->click('Text Area', '.paragraphs-ee-add-dialog');
Expand Down
Loading