Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-15 15:07:19 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-15 15:07:19 +0300
commite6fed37d941271b897d37820fd3b571feab280b0 (patch)
treec81c9a7d38d6a8b0c1dc5f8ebb784fce68acb288 /spec/frontend/lib
parent45a8c43afe8a17de19a92708b380b29b6ae04ce6 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/lib')
-rw-r--r--spec/frontend/lib/utils/sticky_spec.js77
1 files changed, 0 insertions, 77 deletions
diff --git a/spec/frontend/lib/utils/sticky_spec.js b/spec/frontend/lib/utils/sticky_spec.js
deleted file mode 100644
index ec9e746c838..00000000000
--- a/spec/frontend/lib/utils/sticky_spec.js
+++ /dev/null
@@ -1,77 +0,0 @@
-import { setHTMLFixture } from 'helpers/fixtures';
-import { isSticky } from '~/lib/utils/sticky';
-
-const TEST_OFFSET_TOP = 500;
-
-describe('sticky', () => {
- let el;
- let offsetTop;
-
- beforeEach(() => {
- setHTMLFixture(
- `
- <div class="parent">
- <div id="js-sticky"></div>
- </div>
- `,
- );
-
- offsetTop = TEST_OFFSET_TOP;
- el = document.getElementById('js-sticky');
- Object.defineProperty(el, 'offsetTop', {
- get() {
- return offsetTop;
- },
- });
- });
-
- afterEach(() => {
- el = null;
- });
-
- describe('when stuck', () => {
- it('does not remove is-stuck class', () => {
- isSticky(el, 0, el.offsetTop);
- isSticky(el, 0, el.offsetTop);
-
- expect(el.classList.contains('is-stuck')).toBe(true);
- });
-
- it('adds is-stuck class', () => {
- isSticky(el, 0, el.offsetTop);
-
- expect(el.classList.contains('is-stuck')).toBe(true);
- });
-
- it('inserts placeholder element', () => {
- isSticky(el, 0, el.offsetTop, true);
-
- expect(document.querySelector('.sticky-placeholder')).not.toBeNull();
- });
- });
-
- describe('when not stuck', () => {
- it('removes is-stuck class', () => {
- jest.spyOn(el.classList, 'remove');
-
- isSticky(el, 0, el.offsetTop);
- isSticky(el, 0, 0);
-
- expect(el.classList.remove).toHaveBeenCalledWith('is-stuck');
- expect(el.classList.contains('is-stuck')).toBe(false);
- });
-
- it('does not add is-stuck class', () => {
- isSticky(el, 0, 0);
-
- expect(el.classList.contains('is-stuck')).toBe(false);
- });
-
- it('removes placeholder', () => {
- isSticky(el, 0, el.offsetTop, true);
- isSticky(el, 0, 0, true);
-
- expect(document.querySelector('.sticky-placeholder')).toBeNull();
- });
- });
-});