summaryrefslogtreecommitdiff
path: root/spec/frontend/vue_shared/directives/autofocusonshow_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/vue_shared/directives/autofocusonshow_spec.js')
-rw-r--r--spec/frontend/vue_shared/directives/autofocusonshow_spec.js11
1 files changed, 3 insertions, 8 deletions
diff --git a/spec/frontend/vue_shared/directives/autofocusonshow_spec.js b/spec/frontend/vue_shared/directives/autofocusonshow_spec.js
index 90530b7d5c2..1c9e89f99e9 100644
--- a/spec/frontend/vue_shared/directives/autofocusonshow_spec.js
+++ b/spec/frontend/vue_shared/directives/autofocusonshow_spec.js
@@ -1,3 +1,4 @@
+import { useMockIntersectionObserver } from 'helpers/mock_dom_observer';
import autofocusonshow from '~/vue_shared/directives/autofocusonshow';
/**
@@ -6,20 +7,14 @@ import autofocusonshow from '~/vue_shared/directives/autofocusonshow';
* on underlying DOM methods.
*/
describe('AutofocusOnShow directive', () => {
+ useMockIntersectionObserver();
+
describe('with input invisible on component render', () => {
let el;
beforeEach(() => {
setFixtures('<div id="container" style="display: none;"><input id="inputel"/></div>');
el = document.querySelector('#inputel');
-
- window.IntersectionObserver = class {
- observe = jest.fn();
- };
- });
-
- afterEach(() => {
- delete window.IntersectionObserver;
});
it('should bind IntersectionObserver on input element', () => {