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

8.3.x
Alex Pott 2016-10-27 22:39:08 -07:00
parent 0aed30b60e
commit 552513f8e8
3 changed files with 13 additions and 2 deletions

View File

@ -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'};
});
}

View File

@ -2,6 +2,7 @@
namespace Drupal\offcanvas_test\Controller;
use Drupal\Component\Serialization\Json;
use Drupal\Core\Url;
/**
@ -66,6 +67,9 @@ class TestController {
'class' => ['use-ajax'],
'data-dialog-type' => 'dialog',
'data-dialog-renderer' => 'offcanvas',
'data-dialog-options' => Json::encode([
'width' => 555,
]),
],
'#attached' => [
'library' => [

View File

@ -52,10 +52,13 @@ class OffCanvasTest extends OutsideInJavascriptTestBase {
$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.