mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 09:18:59 +00:00
efb35b537a
* add prettier and have it format all js code except website: : * trying running prettier check in CI * fix runs on in CI * change CI job name * fix prettier erros and fix CI
32 lines
843 B
JavaScript
32 lines
843 B
JavaScript
import { calculateTooltipDirection } from "./helpers";
|
|
|
|
describe("EllipsisMenu - helpers", () => {
|
|
describe("#calculateTooltipDirection", () => {
|
|
it('returns "left" if the element does not fit to the right in the browser', () => {
|
|
const el = {
|
|
getBoundingClientRect: () => {
|
|
return {
|
|
// test DOM window.innerWidth is 1024px
|
|
right: 725,
|
|
};
|
|
},
|
|
};
|
|
|
|
expect(calculateTooltipDirection(el)).toEqual("left");
|
|
});
|
|
|
|
it('returns "right" if the element fits to the right in the browser', () => {
|
|
const el = {
|
|
getBoundingClientRect: () => {
|
|
return {
|
|
// test DOM window.innerWidth is 1024px
|
|
right: 724,
|
|
};
|
|
},
|
|
};
|
|
|
|
expect(calculateTooltipDirection(el)).toEqual("right");
|
|
});
|
|
});
|
|
});
|