Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewfulton9 committed Dec 17, 2024
1 parent f8013ed commit 58e99aa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions packages/widgets/src/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,9 @@ export class Menu extends Widget {
let forceY = options.forceY || false;
const host = options.host ?? null;
const ref = options.ref ?? null;
const align = options.align ?? (document.documentElement.dir === 'rtl' ? 'right' : 'left');

const align =
options.align ??
(document.documentElement.dir === 'rtl' ? 'right' : 'left');

// Open the menu as a root menu.
Private.openRootMenu(this, x, y, forceX, forceY, align, host, ref);
Expand Down
10 changes: 7 additions & 3 deletions packages/widgets/tests/src/menu.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,9 @@ describe('@lumino/widgets', () => {
menu.open(300, 300, { align: 'right' });
let { width } = menu.node.getBoundingClientRect();
const expectedX = parseFloat((300 - width).toFixed(3));
expect(menu.node.style.transform).to.equal(`translate(${ expectedX }px, 300px)`);
expect(menu.node.style.transform).to.equal(
`translate(${expectedX}px, 300px)`
);
});

it('align should default to right if language direction is rtl', () => {
Expand All @@ -618,8 +620,10 @@ describe('@lumino/widgets', () => {
menu.open(300, 300);
let { width } = menu.node.getBoundingClientRect();
const expectedX = parseFloat((300 - width).toFixed(3));
expect(menu.node.style.transform).to.equal(`translate(${ expectedX }px, 300px)`);
document.documentElement.removeAttribute('dir'); // Reset the direction
expect(menu.node.style.transform).to.equal(
`translate(${expectedX}px, 300px)`
);
document.documentElement.removeAttribute('dir'); // Reset the direction
});

it('should bail if already attached', () => {
Expand Down

0 comments on commit 58e99aa

Please sign in to comment.