Commit b3f96e34 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch 'F8348-DropdownMenuViaAS_link' into 'master'

F8348 dropdown menu via as link

See merge request !142
parents 1d70b760 992cdc6d
Pipeline #1866 passed with stage
in 2 minutes and 3 seconds
...@@ -515,7 +515,7 @@ class Link { ...@@ -515,7 +515,7 @@ class Link {
$li .= '<li' . $attribute . '>' . $link . '</li>'; $li .= '<li' . $attribute . '>' . $link . '</li>';
} }
$ul = Support::wrapTag('<ul class="dropdown-menu" aria-labelledby="' . $htmlId . '">', $li); $ul = Support::wrapTag('<ul style="max-height: 70vh; overflow-y: auto" class="dropdown-menu" aria-labelledby="' . $htmlId . '">', $li);
} }
return Support::wrapTag('<span class="dropdown">', $dropdownSymbol . $ul); return Support::wrapTag('<span class="dropdown">', $dropdownSymbol . $ul);
......
...@@ -1467,22 +1467,22 @@ EOF; ...@@ -1467,22 +1467,22 @@ EOF;
$link = new Link($this->sip, DB_INDEX_DEFAULT, true); $link = new Link($this->sip, DB_INDEX_DEFAULT, true);
// Empty definition // Empty definition
$expect = '<span class="dropdown"><span title="Details" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" class="dropdown-toggle" id="0.123 1234 0" ><span class="glyphicon glyphicon-option-vertical" ></span></span><ul class="dropdown-menu" aria-labelledby="0.123 1234 0"></ul></span>'; $expect = '<span class="dropdown"><span title="Details" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" class="dropdown-toggle" id="0.123 1234 0" ><span class="glyphicon glyphicon-option-vertical" ></span></span><ul style="max-height: 70vh; overflow-y: auto" class="dropdown-menu" aria-labelledby="0.123 1234 0"></ul></span>';
$result = $link->renderLink('z'); $result = $link->renderLink('z');
$this->assertEquals($expect, $result); $this->assertEquals($expect, $result);
// Empty definition. // Empty definition.
$expect = '<span class="dropdown"><span title="Details" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" class="dropdown-toggle" id="0.123 1234 1" ><span class="glyphicon glyphicon-option-vertical" ></span></span><ul class="dropdown-menu" aria-labelledby="0.123 1234 1"></ul></span>'; $expect = '<span class="dropdown"><span title="Details" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" class="dropdown-toggle" id="0.123 1234 1" ><span class="glyphicon glyphicon-option-vertical" ></span></span><ul style="max-height: 70vh; overflow-y: auto" class="dropdown-menu" aria-labelledby="0.123 1234 1"></ul></span>';
$result = $link->renderLink('z:'); $result = $link->renderLink('z:');
$this->assertEquals($expect, $result); $this->assertEquals($expect, $result);
// Dropdown menu with text, custom Glyph and a tooltip. // Dropdown menu with text, custom Glyph and a tooltip.
$expect = '<span class="dropdown"><span title="Open menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" class="dropdown-toggle" id="0.123 1234 2" ><span class="glyphicon glyph-icon-left" ></span> Menu</span><ul class="dropdown-menu" aria-labelledby="0.123 1234 2"></ul></span>'; $expect = '<span class="dropdown"><span title="Open menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" class="dropdown-toggle" id="0.123 1234 2" ><span class="glyphicon glyph-icon-left" ></span> Menu</span><ul style="max-height: 70vh; overflow-y: auto" class="dropdown-menu" aria-labelledby="0.123 1234 2"></ul></span>';
$result = $link->renderLink('z|t:Menu|G:glyph-icon-left|o:Open menu'); $result = $link->renderLink('z|t:Menu|G:glyph-icon-left|o:Open menu');
$this->assertEquals($expect, $result); $this->assertEquals($expect, $result);
// Dropdown menu with menu entry. // Dropdown menu with menu entry.
$expect = '<span class="dropdown"><span title="Open menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" class="dropdown-toggle" id="0.123 1234 3" ><span class="glyphicon glyph-icon-left" ></span> Menu</span><ul class="dropdown-menu" aria-labelledby="0.123 1234 3"><li><a href="?id=home" >Home</a></li></ul></span>'; $expect = '<span class="dropdown"><span title="Open menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" class="dropdown-toggle" id="0.123 1234 3" ><span class="glyphicon glyph-icon-left" ></span> Menu</span><ul style="max-height: 70vh; overflow-y: auto" class="dropdown-menu" aria-labelledby="0.123 1234 3"><li><a href="?id=home" >Home</a></li></ul></span>';
$result = $link->renderLink('z|t:Menu|G:glyph-icon-left|o:Open menu||p:home|t:Home'); $result = $link->renderLink('z|t:Menu|G:glyph-icon-left|o:Open menu||p:home|t:Home');
$this->assertEquals($expect, $result); $this->assertEquals($expect, $result);
...@@ -1492,12 +1492,12 @@ EOF; ...@@ -1492,12 +1492,12 @@ EOF;
$this->assertEquals($expect, $result); $this->assertEquals($expect, $result);
// Dropdown menu with two entries, one is SIP encoded. // Dropdown menu with two entries, one is SIP encoded.
$expect = '<span class="dropdown"><span title="Open menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" class="dropdown-toggle" id="0.123 1234 5" ><span class="glyphicon glyph-icon-left" ></span> Menu</span><ul class="dropdown-menu" aria-labelledby="0.123 1234 5"><li><a href="index.php?id=home&s=badcaffee1234" >Home</a></li><li><a href="?id=back" title="Navigate back" >Back</a></li></ul></span>'; $expect = '<span class="dropdown"><span title="Open menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" class="dropdown-toggle" id="0.123 1234 5" ><span class="glyphicon glyph-icon-left" ></span> Menu</span><ul style="max-height: 70vh; overflow-y: auto" class="dropdown-menu" aria-labelledby="0.123 1234 5"><li><a href="index.php?id=home&s=badcaffee1234" >Home</a></li><li><a href="?id=back" title="Navigate back" >Back</a></li></ul></span>';
$result = $link->renderLink('z|t:Menu|G:glyph-icon-left|o:Open menu||p:home|t:Home|s||p:back|t:Back|o:Navigate back'); $result = $link->renderLink('z|t:Menu|G:glyph-icon-left|o:Open menu||p:home|t:Home|s||p:back|t:Back|o:Navigate back');
$this->assertEquals($expect, $result); $this->assertEquals($expect, $result);
// Dropdown menu header, separator and disabled entry. // Dropdown menu header, separator and disabled entry.
$expect = '<span class="dropdown"><span title="Open menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" class="dropdown-toggle" id="0.123 1234 6" ><span class="glyphicon glyph-icon-left" ></span> Menu</span><ul class="dropdown-menu" aria-labelledby="0.123 1234 6"><li><a href="index.php?id=home&s=badcaffee1234" >Home</a></li><li><a href="?id=back" title="Navigate back" >Back</a></li><li role="separator" class="divider"></li><li class="dropdown-header">Header</li><li class="disabled"><a href="#">Disabled entry</a></li></ul></span>'; $expect = '<span class="dropdown"><span title="Open menu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" class="dropdown-toggle" id="0.123 1234 6" ><span class="glyphicon glyph-icon-left" ></span> Menu</span><ul style="max-height: 70vh; overflow-y: auto" class="dropdown-menu" aria-labelledby="0.123 1234 6"><li><a href="index.php?id=home&s=badcaffee1234" >Home</a></li><li><a href="?id=back" title="Navigate back" >Back</a></li><li role="separator" class="divider"></li><li class="dropdown-header">Header</li><li class="disabled"><a href="#">Disabled entry</a></li></ul></span>';
$result = $link->renderLink('z|t:Menu|G:glyph-icon-left|o:Open menu||p:home|t:Home|s||p:back|t:Back|o:Navigate back||r:1|t:---||t:===Header|r:1||r:1|t:---Disabled entry'); $result = $link->renderLink('z|t:Menu|G:glyph-icon-left|o:Open menu||p:home|t:Home|s||p:back|t:Back|o:Navigate back||r:1|t:---||t:===Header|r:1||r:1|t:---Disabled entry');
$this->assertEquals($expect, $result); $this->assertEquals($expect, $result);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment