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

EWPP-3647: Add Accessibility footer link section. #137

Open
wants to merge 1 commit into
base: 4.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
langcode: en
status: true
dependencies: { }
id: accessibility
label: Accessibility
weight: 0
1 change: 1 addition & 0 deletions oe_corporate_blocks.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies:
config_devel:
install:
- oe_corporate_blocks.footer_link.section.about_us
- oe_corporate_blocks.footer_link.section.accessibility
- oe_corporate_blocks.footer_link.section.contact_us
- oe_corporate_blocks.footer_link.section.related_sites

Expand Down
17 changes: 17 additions & 0 deletions oe_corporate_blocks.post_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,20 @@ function oe_corporate_blocks_post_update_40006(): void {
$config->set('service_navigation', $service_navigation);
$config->save();
}

/**
* Create the Accessibility footer link section.
*/
function oe_corporate_blocks_post_update_40007(): void {
$storage = \Drupal::entityTypeManager()->getStorage('footer_link_section');
// We are creating the config which means that we are also shipping
// it in the config/install folder so we want to make sure it gets the hash
// so Drupal treats it as a shipped config. This means that it gets exposed
// to be translated via the locale system as well.
$config['_core']['default_config_hash'] = Crypt::hashBase64(serialize([
'id' => 'accessibility',
'label' => 'Accessibility',
'weight' => 0,
]));
$storage->create($config)->save();
}
6 changes: 6 additions & 0 deletions tests/features/custom-footer-settings.feature
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ Feature: Site specific footer links management.
When I fill in "Label" with "00000 European Commission, official website"
And I fill in "Machine-readable name" with "00000_eurpoean_commission_official_website"
And I fill in "URL" with "https://commission.europa.eu/index_en"
And I should have the following options for the "Section" select:
| - Disabled - |
| Contact us |
| About us |
| Related sites |
| Accessibility |
And I select "Related sites" from "Section"
And I press "Save"
Then I should see the heading "Footer Link General entities"
Expand Down
35 changes: 20 additions & 15 deletions tests/src/FunctionalJavascript/FooterLinkGeneralListBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,39 +50,44 @@ public function testGeneralLinkUi(): void {

// Move "Link 1" under "Contact us".
$link = $this->findRowByLabel('Link 1');
$this->moveRowWithKeyboard($link, 'up', 3);
$this->moveRowWithKeyboard($link, 'up', 4);
$this->assertGeneralLinkRow($link, 'contact_us', -9);

// Move "Link 2" under "About us".
$link = $this->findRowByLabel('Link 2');
$this->moveRowWithKeyboard($link, 'up', 2);
$this->moveRowWithKeyboard($link, 'up', 3);
$this->assertGeneralLinkRow($link, 'about_us', -7);

// Move "Link 3" under "Related sites".
$link = $this->findRowByLabel('Link 3');
$this->moveRowWithKeyboard($link, 'up', 1);
$this->moveRowWithKeyboard($link, 'up', 2);
$this->assertGeneralLinkRow($link, 'related_sites', -5);

// Move "Link 4" under "Accessibility".
$link = $this->findRowByLabel('Link 4');
$this->moveRowWithKeyboard($link, 'up', 1);
$this->assertGeneralLinkRow($link, 'accessibility', -3);

// Save current link disposition.
$this->getSession()->getPage()->pressButton('Save');

// Assert that sections and weights have actually being saved.
$this->assertGeneralLinkEntity('Link 1', 'http://example.com/link-1', 'contact_us', -9);
$this->assertGeneralLinkEntity('Link 2', 'http://example.com/link-2', 'about_us', -7);
$this->assertGeneralLinkEntity('Link 3', 'http://example.com/link-3', 'related_sites', -5);
$this->assertGeneralLinkEntity('Link 4', 'http://example.com/link-4', '', -3);
$this->assertGeneralLinkEntity('Link 5', 'http://example.com/link-5', '', -2);
$this->assertGeneralLinkEntity('Link 4', 'http://example.com/link-4', 'accessibility', -3);
$this->assertGeneralLinkEntity('Link 5', 'http://example.com/link-5', '', -1);

// Move "Link 3" under "Disabled".
$link = $this->findRowByLabel('Link 3');
$this->moveRowWithKeyboard($link, 'down', 1);
$this->assertGeneralLinkRow($link, '', -4);
$this->moveRowWithKeyboard($link, 'down', 3);
$this->assertGeneralLinkRow($link, '', -2);

// Save current link disposition.
$this->getSession()->getPage()->pressButton('Save');

// Assert that "Link 3" has has been correctly saved.
$this->assertGeneralLinkEntity('Link 3', 'http://example.com/link-3', '', -4);
// Assert that "Link 3" has been correctly saved.
$this->assertGeneralLinkEntity('Link 3', 'http://example.com/link-3', '', -2);

// Delete all sections.
$section_storage = \Drupal::entityTypeManager()->getStorage('footer_link_section');
Expand All @@ -93,16 +98,16 @@ public function testGeneralLinkUi(): void {
// Assert that all links have been assigned to the "Disabled" section.
$this->assertGeneralLinkEntity('Link 1', 'http://example.com/link-1', '', -9);
$this->assertGeneralLinkEntity('Link 2', 'http://example.com/link-2', '', -7);
$this->assertGeneralLinkEntity('Link 3', 'http://example.com/link-3', '', -4);
$this->assertGeneralLinkEntity('Link 4', 'http://example.com/link-4', '', -3);
$this->assertGeneralLinkEntity('Link 5', 'http://example.com/link-5', '', -2);
$this->assertGeneralLinkEntity('Link 3', 'http://example.com/link-3', '', -2);
$this->assertGeneralLinkEntity('Link 4', 'http://example.com/link-4', '', -4);
$this->assertGeneralLinkEntity('Link 5', 'http://example.com/link-5', '', -1);

// Assert that all link entities contain the correct values.
$this->assertGeneralLinkRow($this->findRowByLabel('Link 1'), '', -9);
$this->assertGeneralLinkRow($this->findRowByLabel('Link 2'), '', -7);
$this->assertGeneralLinkRow($this->findRowByLabel('Link 3'), '', -4);
$this->assertGeneralLinkRow($this->findRowByLabel('Link 4'), '', -3);
$this->assertGeneralLinkRow($this->findRowByLabel('Link 5'), '', -2);
$this->assertGeneralLinkRow($this->findRowByLabel('Link 3'), '', -2);
$this->assertGeneralLinkRow($this->findRowByLabel('Link 4'), '', -4);
$this->assertGeneralLinkRow($this->findRowByLabel('Link 5'), '', -1);
}

/**
Expand Down