summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorPaul Slaughter <pslaughter@gitlab.com>2018-06-01 16:24:56 +0000
committerClement Ho <clemmakesapps@gmail.com>2018-06-01 16:24:56 +0000
commit399e1e83c038685f15bf3049382a16c6ccb8fa37 (patch)
tree7160803a6e1d554f9f3a9eac5643b9bda322376c /spec
parenteeb73247aaf7002e81a3863bcbf376bbb7e692a4 (diff)
downloadgitlab-ce-399e1e83c038685f15bf3049382a16c6ccb8fa37.tar.gz
Update position sticky polyfill
Diffstat (limited to 'spec')
-rw-r--r--spec/javascripts/lib/utils/sticky_spec.js79
1 files changed, 0 insertions, 79 deletions
diff --git a/spec/javascripts/lib/utils/sticky_spec.js b/spec/javascripts/lib/utils/sticky_spec.js
deleted file mode 100644
index b87c836654d..00000000000
--- a/spec/javascripts/lib/utils/sticky_spec.js
+++ /dev/null
@@ -1,79 +0,0 @@
-import { isSticky } from '~/lib/utils/sticky';
-
-describe('sticky', () => {
- let el;
-
- beforeEach(() => {
- document.body.innerHTML += `
- <div class="parent">
- <div id="js-sticky"></div>
- </div>
- `;
-
- el = document.getElementById('js-sticky');
- });
-
- afterEach(() => {
- el.parentNode.remove();
- });
-
- 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'),
- ).toBeTruthy();
- });
-
- it('adds is-stuck class', () => {
- isSticky(el, 0, el.offsetTop);
-
- expect(
- el.classList.contains('is-stuck'),
- ).toBeTruthy();
- });
-
- 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', () => {
- spyOn(el.classList, 'remove').and.callThrough();
-
- isSticky(el, 0, el.offsetTop);
- isSticky(el, 0, 0);
-
- expect(
- el.classList.remove,
- ).toHaveBeenCalledWith('is-stuck');
- expect(
- el.classList.contains('is-stuck'),
- ).toBeFalsy();
- });
-
- it('does not add is-stuck class', () => {
- isSticky(el, 0, 0);
-
- expect(
- el.classList.contains('is-stuck'),
- ).toBeFalsy();
- });
-
- it('removes placeholder', () => {
- isSticky(el, 0, el.offsetTop, true);
- isSticky(el, 0, 0, true);
-
- expect(
- document.querySelector('.sticky-placeholder'),
- ).toBeNull();
- });
- });
-});