Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 7961e14

Browse files
author
Sérgio Gomes
committed
test(menu): Add more tests to improve branch coverage.
1 parent c4a040a commit 7961e14

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/unit/mdc-menu/mdc-simple-menu.test.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,28 @@ test('get/set open', (t) => {
5656
t.end();
5757
});
5858

59+
test('show opens the menu', (t) => {
60+
const {component} = setupTest();
61+
component.show();
62+
t.true(component.open);
63+
t.end();
64+
});
65+
66+
test('show with a focus index opens the menu', (t) => {
67+
const {component} = setupTest();
68+
component.show({focusIndex: 1});
69+
t.true(component.open);
70+
t.end();
71+
});
72+
73+
test('hide closes the menu', (t) => {
74+
const {component} = setupTest();
75+
component.open = true;
76+
component.hide();
77+
t.false(component.open);
78+
t.end();
79+
});
80+
5981
test('items returns all menu items', (t) => {
6082
const {root, component} = setupTest();
6183
const items = [].slice.call(root.querySelectorAll('[role="menuitem"]'));
@@ -379,5 +401,8 @@ test('adapter#setPosition sets the correct position on the menu element', (t) =>
379401
component.getDefaultFoundation().adapter_.setPosition({top: '10px', left: '11px'});
380402
t.equal(root.style.top, '10px');
381403
t.equal(root.style.left, '11px');
404+
component.getDefaultFoundation().adapter_.setPosition({bottom: '10px', right: '11px'});
405+
t.equal(root.style.bottom, '10px');
406+
t.equal(root.style.right, '11px');
382407
t.end();
383408
});

0 commit comments

Comments
 (0)