Commit e1ba7861 authored by Vitaly Slobodin's avatar Vitaly Slobodin

Introduce constant for the old sidebar width

parent 15e1a3a5
...@@ -21,6 +21,7 @@ describe('Fly out sidebar navigation', () => { ...@@ -21,6 +21,7 @@ describe('Fly out sidebar navigation', () => {
let el; let el;
let breakpointSize = 'lg'; let breakpointSize = 'lg';
const OLD_SIDEBAR_WIDTH = 200;
const CONTAINER_INITIAL_BOUNDING_RECT = { const CONTAINER_INITIAL_BOUNDING_RECT = {
x: 8, x: 8,
y: 8, y: 8,
...@@ -51,7 +52,8 @@ describe('Fly out sidebar navigation', () => { ...@@ -51,7 +52,8 @@ describe('Fly out sidebar navigation', () => {
mockBoundingClientRect(el, CONTAINER_INITIAL_BOUNDING_RECT); mockBoundingClientRect(el, CONTAINER_INITIAL_BOUNDING_RECT);
mockBoundingClientRect(subItems, SUB_ITEMS_INITIAL_BOUNDING_RECT); mockBoundingClientRect(subItems, SUB_ITEMS_INITIAL_BOUNDING_RECT);
}; };
const mockSidebarFragment = (styleProps = '') => `<div class="sidebar-sub-level-items" style="${styleProps}"></div>` const mockSidebarFragment = (styleProps = '') =>
`<div class="sidebar-sub-level-items" style="${styleProps}"></div>`;
beforeEach(() => { beforeEach(() => {
el = document.createElement('div'); el = document.createElement('div');
...@@ -82,7 +84,6 @@ describe('Fly out sidebar navigation', () => { ...@@ -82,7 +84,6 @@ describe('Fly out sidebar navigation', () => {
describe('getHideSubItemsInterval', () => { describe('getHideSubItemsInterval', () => {
beforeEach(() => { beforeEach(() => {
el.innerHTML = mockSidebarFragment('position: fixed; top: 0; left: 100px; height: 150px;'); el.innerHTML = mockSidebarFragment('position: fixed; top: 0; left: 100px; height: 150px;');
mockBoundingRects(); mockBoundingRects();
}); });
...@@ -177,7 +178,9 @@ describe('Fly out sidebar navigation', () => { ...@@ -177,7 +178,9 @@ describe('Fly out sidebar navigation', () => {
describe('mouseEnterTopItems', () => { describe('mouseEnterTopItems', () => {
beforeEach(() => { beforeEach(() => {
el.innerHTML = mockSidebarFragment('position: absolute; top: 0; left: 100px; height: 200px;'); el.innerHTML = mockSidebarFragment(
`position: absolute; top: 0; left: 100px; height: ${OLD_SIDEBAR_WIDTH}px;`,
);
mockBoundingRects(); mockBoundingRects();
}); });
...@@ -271,7 +274,7 @@ describe('Fly out sidebar navigation', () => { ...@@ -271,7 +274,7 @@ describe('Fly out sidebar navigation', () => {
const sidebar = document.createElement('div'); const sidebar = document.createElement('div');
const subItems = findSubItems(); const subItems = findSubItems();
sidebar.style.width = '200px'; sidebar.style.width = `${OLD_SIDEBAR_WIDTH}px`;
document.body.appendChild(sidebar); document.body.appendChild(sidebar);
...@@ -279,7 +282,7 @@ describe('Fly out sidebar navigation', () => { ...@@ -279,7 +282,7 @@ describe('Fly out sidebar navigation', () => {
showSubLevelItems(el); showSubLevelItems(el);
expect(subItems.style.transform).toBe( expect(subItems.style.transform).toBe(
`translate3d(200px, ${ `translate3d(${OLD_SIDEBAR_WIDTH}px, ${
Math.floor(el.getBoundingClientRect().top) - getHeaderHeight() Math.floor(el.getBoundingClientRect().top) - getHeaderHeight()
}px, 0)`, }px, 0)`,
); );
......
Markdown is supported
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