updated core from 8.4 to 8.5 : bug with login_destination
This commit is contained in:
@@ -5,8 +5,8 @@ package: Core
|
||||
# version: VERSION
|
||||
# core: 8.x
|
||||
|
||||
# Information added by Drupal.org packaging script on 2018-01-03
|
||||
version: '8.4.4'
|
||||
# Information added by Drupal.org packaging script on 2018-03-07
|
||||
version: '8.5.0'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1515021228
|
||||
datestamp: 1520457826
|
||||
|
||||
@@ -20,6 +20,7 @@ drupal.contextual-links:
|
||||
dependencies:
|
||||
- core/jquery
|
||||
- core/drupal
|
||||
- core/drupal.ajax
|
||||
- core/drupalSettings
|
||||
- core/backbone
|
||||
- core/modernizr
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
margin: 0;
|
||||
}
|
||||
.toolbar .toolbar-bar .contextual-toolbar-tab .toolbar-item.is-active {
|
||||
background-image:-webkit-linear-gradient(rgb(78,159,234) 0%, rgb(69,132,221) 100%);
|
||||
background-image:linear-gradient(rgb(78,159,234) 0%,rgb(69,132,221) 100%);
|
||||
background-image: -webkit-linear-gradient(rgb(78, 159, 234) 0%, rgb(69, 132, 221) 100%);
|
||||
background-image: linear-gradient(rgb(78, 159, 234) 0%, rgb(69, 132, 221) 100%);
|
||||
}
|
||||
|
||||
/* @todo get rid of this declaration by making toolbar.module's CSS less specific */
|
||||
|
||||
@@ -249,4 +249,18 @@
|
||||
Drupal.theme.contextualTrigger = function () {
|
||||
return '<button class="trigger visually-hidden focusable" type="button"></button>';
|
||||
};
|
||||
|
||||
/**
|
||||
* Bind Ajax contextual links when added.
|
||||
*
|
||||
* @param {jQuery.Event} event
|
||||
* The `drupalContextualLinkAdded` event.
|
||||
* @param {object} data
|
||||
* An object containing the data relevant to the event.
|
||||
*
|
||||
* @listens event:drupalContextualLinkAdded
|
||||
*/
|
||||
$(document).on('drupalContextualLinkAdded', (event, data) => {
|
||||
Drupal.ajax.bindAjaxLinks(data.$el[0]);
|
||||
});
|
||||
}(jQuery, Drupal, drupalSettings, _, Backbone, window.JSON, window.sessionStorage));
|
||||
|
||||
@@ -144,4 +144,8 @@
|
||||
Drupal.theme.contextualTrigger = function () {
|
||||
return '<button class="trigger visually-hidden focusable" type="button"></button>';
|
||||
};
|
||||
|
||||
$(document).on('drupalContextualLinkAdded', function (event, data) {
|
||||
Drupal.ajax.bindAjaxLinks(data.$el[0]);
|
||||
});
|
||||
})(jQuery, Drupal, drupalSettings, _, Backbone, window.JSON, window.sessionStorage);
|
||||
@@ -22,7 +22,7 @@
|
||||
}
|
||||
|
||||
const contextualToolbar = Drupal.contextualToolbar;
|
||||
const model = contextualToolbar.model = new contextualToolbar.StateModel({
|
||||
contextualToolbar.model = new contextualToolbar.StateModel({
|
||||
// Checks whether localStorage indicates we should start in edit mode
|
||||
// rather than view mode.
|
||||
// @see Drupal.contextualToolbar.VisualView.persist
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
const viewOptions = {
|
||||
el: $('.toolbar .toolbar-bar .contextual-toolbar-tab'),
|
||||
model,
|
||||
model: contextualToolbar.model,
|
||||
strings,
|
||||
};
|
||||
new contextualToolbar.VisualView(viewOptions);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
}
|
||||
|
||||
var contextualToolbar = Drupal.contextualToolbar;
|
||||
var model = contextualToolbar.model = new contextualToolbar.StateModel({
|
||||
contextualToolbar.model = new contextualToolbar.StateModel({
|
||||
isViewing: localStorage.getItem('Drupal.contextualToolbar.isViewing') !== 'false'
|
||||
}, {
|
||||
contextualCollection: Drupal.contextual.collection
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
var viewOptions = {
|
||||
el: $('.toolbar .toolbar-bar .contextual-toolbar-tab'),
|
||||
model: model,
|
||||
model: contextualToolbar.model,
|
||||
strings: strings
|
||||
};
|
||||
new contextualToolbar.VisualView(viewOptions);
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
this.listenTo(this.model, 'change:isViewing', this.manageTabbing);
|
||||
|
||||
$(document).on('keyup', _.bind(this.onKeypress, this));
|
||||
this.manageTabbing();
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
this.listenTo(this.model, 'change:isViewing', this.manageTabbing);
|
||||
|
||||
$(document).on('keyup', _.bind(this.onKeypress, this));
|
||||
this.manageTabbing();
|
||||
},
|
||||
render: function render() {
|
||||
this.$el.find('button').attr('aria-pressed', !this.model.get('isViewing'));
|
||||
|
||||
@@ -7,8 +7,8 @@ package: Testing
|
||||
dependencies:
|
||||
- contextual
|
||||
|
||||
# Information added by Drupal.org packaging script on 2018-01-03
|
||||
version: '8.4.4'
|
||||
# Information added by Drupal.org packaging script on 2018-03-07
|
||||
version: '8.5.0'
|
||||
core: '8.x'
|
||||
project: 'drupal'
|
||||
datestamp: 1515021228
|
||||
datestamp: 1520457826
|
||||
|
||||
+8
@@ -2,3 +2,11 @@ contextual_test:
|
||||
title: 'Test Link'
|
||||
route_name: 'contextual_test'
|
||||
group: 'contextual_test'
|
||||
contextual_test_ajax:
|
||||
title: 'Test Link with Ajax'
|
||||
route_name: 'contextual_test'
|
||||
group: 'contextual_test'
|
||||
options:
|
||||
attributes:
|
||||
class: ['use-ajax']
|
||||
data-dialog-type: 'modal'
|
||||
|
||||
@@ -15,3 +15,23 @@ function contextual_test_block_view_alter(array &$build, BlockPluginInterface $b
|
||||
'route_parameters' => [],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_contextual_links_view_alter().
|
||||
*
|
||||
* @todo Apparently this too late to attach the library?
|
||||
* It won't work without contextual_test_page_attachments_alter()
|
||||
* Is that a problem? Should the contextual module itself do the attaching?
|
||||
*/
|
||||
function contextual_test_contextual_links_view_alter(&$element, $items) {
|
||||
if (isset($element['#links']['contextual-test-ajax'])) {
|
||||
$element['#attached']['library'][] = 'core/drupal.dialog.ajax';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_page_attachments_alter().
|
||||
*/
|
||||
function contextual_test_page_attachments_alter(array &$attachments) {
|
||||
$attachments['#attached']['library'][] = 'core/drupal.dialog.ajax';
|
||||
}
|
||||
|
||||
@@ -69,6 +69,17 @@ class ContextualLinksTest extends JavascriptTestBase {
|
||||
$this->clickContextualLink('#block-branding', 'Test Link');
|
||||
$this->assertSession()->pageTextContains('Everything is contextual!');
|
||||
|
||||
// Test click a contextual link that uses ajax.
|
||||
$this->drupalGet('user');
|
||||
$this->assertSession()->assertWaitOnAjaxRequest();
|
||||
$current_page_string = 'NOT_RELOADED_IF_ON_PAGE';
|
||||
$this->getSession()->executeScript('document.body.appendChild(document.createTextNode("' . $current_page_string . '"));');
|
||||
$this->clickContextualLink('#block-branding', 'Test Link with Ajax');
|
||||
$this->assertNotEmpty($this->assertSession()->waitForElementVisible('css', '#drupal-modal'));
|
||||
$this->assertSession()->elementContains('css', '#drupal-modal', 'Everything is contextual!');
|
||||
// Check to make sure that page was not reloaded.
|
||||
$this->assertSession()->pageTextContains($current_page_string);
|
||||
|
||||
// Test clicking contextual link with toolbar.
|
||||
$this->container->get('module_installer')->install(['toolbar']);
|
||||
$this->grantPermissions(Role::load(Role::AUTHENTICATED_ID), ['access toolbar']);
|
||||
|
||||
@@ -44,27 +44,45 @@ class EditModeTest extends JavascriptTestBase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that Drupal.announce messages appear.
|
||||
* Tests enabling and disabling edit mode.
|
||||
*/
|
||||
public function testAnnounceEditMode() {
|
||||
public function testEditModeEnableDisalbe() {
|
||||
$web_assert = $this->assertSession();
|
||||
$this->drupalGet('user');
|
||||
$page = $this->getSession()->getPage();
|
||||
// Get the page twice to ensure edit mode remains enabled after a new page
|
||||
// request.
|
||||
for ($page_get_count = 0; $page_get_count < 2; $page_get_count++) {
|
||||
$this->drupalGet('user');
|
||||
$expected_restricted_tab_count = 1 + count($page->findAll('css', '[data-contextual-id]'));
|
||||
|
||||
// After the page loaded we need to additionally wait until the settings
|
||||
// tray Ajax activity is done.
|
||||
$web_assert->assertWaitOnAjaxRequest();
|
||||
// After the page loaded we need to additionally wait until the settings
|
||||
// tray Ajax activity is done.
|
||||
$web_assert->assertWaitOnAjaxRequest();
|
||||
|
||||
if ($page_get_count == 0) {
|
||||
$unrestricted_tab_count = $this->getTabbableElementsCount();
|
||||
$this->assertGreaterThan($expected_restricted_tab_count, $unrestricted_tab_count);
|
||||
|
||||
// Enable edit mode.
|
||||
// After the first page load the page will be in edit mode when loaded.
|
||||
$this->pressToolbarEditButton();
|
||||
}
|
||||
|
||||
$this->assertAnnounceEditMode();
|
||||
$this->assertSame($expected_restricted_tab_count, $this->getTabbableElementsCount());
|
||||
|
||||
// Disable edit mode.
|
||||
$this->pressToolbarEditButton();
|
||||
$this->assertAnnounceLeaveEditMode();
|
||||
$this->assertSame($unrestricted_tab_count, $this->getTabbableElementsCount());
|
||||
// Enable edit mode again.
|
||||
$this->pressToolbarEditButton();
|
||||
// Finally assert that the 'edit mode enabled' announcement is still
|
||||
// correct after toggling the edit mode at least once.
|
||||
$this->assertAnnounceEditMode();
|
||||
$this->assertSame($expected_restricted_tab_count, $this->getTabbableElementsCount());
|
||||
}
|
||||
|
||||
// Enable edit mode.
|
||||
$this->pressToolbarEditButton();
|
||||
$this->assertAnnounceEditMode();
|
||||
// Disable edit mode.
|
||||
$this->pressToolbarEditButton();
|
||||
$this->assertAnnounceLeaveEditMode();
|
||||
// Enable edit mode again.
|
||||
$this->pressToolbarEditButton();
|
||||
// Finally assert that the 'edit mode enabled' announcement is still correct
|
||||
// after toggling the edit mode at least once.
|
||||
$this->assertAnnounceEditMode();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,4 +118,20 @@ class EditModeTest extends JavascriptTestBase {
|
||||
$web_assert->elementNotContains('css', static::ANNOUNCE_SELECTOR, 'Tabbing is constrained to a set of');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of elements that are tabbable.
|
||||
*
|
||||
* @return int
|
||||
* The number of tabbable elements.
|
||||
*/
|
||||
protected function getTabbableElementsCount() {
|
||||
// Mark all tabbable elements.
|
||||
$this->getSession()->executeScript("jQuery(':tabbable').attr('data-marked', '');");
|
||||
// Count all marked elements.
|
||||
$count = count($this->getSession()->getPage()->findAll('css', "[data-marked]"));
|
||||
// Remove set attributes.
|
||||
$this->getSession()->executeScript("jQuery('[data-marked]').removeAttr('data-marked');");
|
||||
return $count;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user