Skip to content
Snippets Groups Projects
Commit 552513f8 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2804639 by tedbow, drpal, catch: Offcanvas dialog width not respected

parent 0aed30b6
No related branches found
No related tags found
No related merge requests found
......@@ -186,7 +186,11 @@
// @todo Move logic for data-dialog-renderer attribute into ajax.js
// https://www.drupal.org/node/2784443
instance.options.url = instance.options.url.replace(search, replace);
instance.options.data.dialogOptions = {outsideInActiveEditableId: $(instance.element).parents('.outside-in-editable').attr('id')};
// Check to make sure existing dialogOptions aren't overridden.
if (!('dialogOptions' in instance.options.data)) {
instance.options.data.dialogOptions = {};
}
instance.options.data.dialogOptions.outsideInActiveEditableId = $(instance.element).parents('.outside-in-editable').attr('id');
instance.progress = {type: 'fullscreen'};
});
}
......
......@@ -2,6 +2,7 @@
namespace Drupal\offcanvas_test\Controller;
use Drupal\Component\Serialization\Json;
use Drupal\Core\Url;
/**
......@@ -66,6 +67,9 @@ public function linksDisplay() {
'class' => ['use-ajax'],
'data-dialog-type' => 'dialog',
'data-dialog-renderer' => 'offcanvas',
'data-dialog-options' => Json::encode([
'width' => 555,
]),
],
'#attached' => [
'library' => [
......
......@@ -52,10 +52,13 @@ public function testOffCanvasLinks() {
$tray_text = $offcanvas_tray->findById('drupal-offcanvas')->getText();
$this->assertEquals("Thing $link_index says hello", $tray_text);
// Check no title behavior.
if ($link_index == '2') {
// Check no title behavior.
$web_assert->elementExists('css', '.ui-dialog-empty-title');
$this->assertEquals('', $header_text);
$style = $page->find('css', '.ui-dialog-offcanvas')->getAttribute('style');
self::assertTrue(strstr($style, 'width: 555px;') !== FALSE, 'Dialog width respected.');
}
else {
// Check that header is correct.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment