Skip to content

Commit 6bc98a4

Browse files
committed
✨ <Menu /> support static option for Items
1 parent 6cc6b28 commit 6bc98a4

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

addon/components/menu/items.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{! template-lint-disable no-down-event-binding }}
2-
{{#if @isOpen}}
2+
{{#if (or @isOpen @static)}}
33
<div
44
id={{@itemsGuid}}
55
aria-labelledby={{@buttonGuid}}

tests/integration/components/menu-test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,21 @@ module('Integration | Component | <Menu>', (hooks) => {
219219
assert.dom('[data-test-item-a]').hasTagName('a');
220220
assert.dom('[data-test-item-a]').hasAttribute('href', '/menu');
221221
});
222+
223+
test('should be possible to always render the Menu.Items if we provide it a `static` prop', async function (assert) {
224+
await render(hbs`
225+
<Menu as |menu|>
226+
<menu.Button>Trigger</menu.Button>
227+
<menu.Items data-test-menu-items @static={{true}} as |items|>
228+
<items.Item>Item A</items.Item>
229+
<items.Item>Item B</items.Item>
230+
<items.Item>Item C</items.Item>
231+
</menu.Items>
232+
</Menu>
233+
`);
234+
235+
assert.dom('[data-test-menu-items]').isVisible();
236+
});
222237
});
223238

224239
module('Keyboard interactions', function () {

0 commit comments

Comments
 (0)