From c19d06acbf4c4776ebd1a1357de324c27de8a4da Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Fri, 20 Nov 2020 20:50:40 +0200 Subject: [PATCH] Update modal.spec.js --- js/tests/unit/modal.spec.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/js/tests/unit/modal.spec.js b/js/tests/unit/modal.spec.js index 7cd74fdc2..34e1ac2d8 100644 --- a/js/tests/unit/modal.spec.js +++ b/js/tests/unit/modal.spec.js @@ -149,20 +149,19 @@ describe('Modal', () => { ].join('') const stickyTopEl = fixtureEl.querySelector('.sticky-top') - const originalMargin = parseInt(window.getComputedStyle(stickyTopEl).marginRight, 10) + const originalMargin = Number.parseInt(window.getComputedStyle(stickyTopEl).marginRight, 10) const modalEl = fixtureEl.querySelector('.modal') const modal = new Modal(modalEl) modalEl.addEventListener('shown.bs.modal', () => { - const expectedMargin = 0 - const currentMargin = parseInt(window.getComputedStyle(stickyTopEl).marginRight, 10) + const currentMargin = Number.parseInt(window.getComputedStyle(stickyTopEl).marginRight, 10) - expect(currentMargin).toEqual(expectedMargin, 'sticky element margin should not be adjusted while opening') + expect(currentMargin).toEqual(originalMargin, 'sticky element margin should not be adjusted while opening') modal.toggle() }) modalEl.addEventListener('hidden.bs.modal', () => { - const currentMargin = parseInt(window.getComputedStyle(stickyTopEl).marginRight, 10) + const currentMargin = Number.parseInt(window.getComputedStyle(stickyTopEl).marginRight, 10) expect(stickyTopEl.getAttribute('data-margin-right')).toEqual(null, 'data-margin-right should be cleared after closing') expect(currentMargin).toEqual(originalMargin, 'sticky element margin should be reset after closing')