Commit 7d6903a4 authored by Winnie Hellmann's avatar Winnie Hellmann

Remove scroll fade tests from boards_selector_spec.js

parent ef1a5483
import Vue from 'vue'; import Vue from 'vue';
import BoardService from 'ee/boards/services/board_service'; import BoardService from 'ee/boards/services/board_service';
import BoardsSelector from 'ee/boards/components/boards_selector.vue'; import BoardsSelector from 'ee/boards/components/boards_selector.vue';
import setTimeoutPromiseHelper from 'spec/helpers/set_timeout_promise_helper';
import mountComponent from 'spec/helpers/vue_mount_component_helper'; import mountComponent from 'spec/helpers/vue_mount_component_helper';
import { TEST_HOST } from 'spec/test_constants'; import { TEST_HOST } from 'spec/test_constants';
const throttleDuration = 1; const throttleDuration = 1;
function waitForScroll() {
return Vue.nextTick()
.then(() => setTimeoutPromiseHelper(throttleDuration))
.then(() => Vue.nextTick());
}
describe('BoardsSelector', () => { describe('BoardsSelector', () => {
let vm; let vm;
let scrollContainer;
let scrollFade;
let boardServiceResponse; let boardServiceResponse;
const boards = new Array(20).fill().map((board, id) => { const boards = new Array(20).fill().map((board, id) => {
const name = `board${id}`; const name = `board${id}`;
...@@ -75,13 +66,6 @@ describe('BoardsSelector', () => { ...@@ -75,13 +66,6 @@ describe('BoardsSelector', () => {
boardServiceResponse boardServiceResponse
.then(() => vm.$nextTick()) .then(() => vm.$nextTick())
.then(() => {
scrollFade = vm.$el.querySelector('.js-scroll-fade');
scrollContainer = scrollFade.querySelector('.js-dropdown-list');
scrollContainer.style.maxHeight = '100px';
scrollContainer.style.overflowY = 'scroll';
})
.then(done) .then(done)
.catch(done.fail); .catch(done.fail);
}); });
...@@ -91,29 +75,6 @@ describe('BoardsSelector', () => { ...@@ -91,29 +75,6 @@ describe('BoardsSelector', () => {
window.gl.boardService = undefined; window.gl.boardService = undefined;
}); });
it('shows the scroll fade if isScrolledUp', done => {
vm.scrollFadeInitialized = false;
scrollContainer.scrollTop = 0;
waitForScroll()
.then(() => {
expect(scrollFade.classList.contains('fade-out')).toEqual(false);
})
.then(done)
.catch(done.fail);
});
it('hides the scroll fade if not isScrolledUp', done => {
scrollContainer.scrollTop = scrollContainer.scrollHeight;
waitForScroll()
.then(() => {
expect(scrollFade.classList.contains('fade-out')).toEqual(true);
})
.then(done)
.catch(done.fail);
});
describe('filtering', () => { describe('filtering', () => {
const fillSearchBox = filterTerm => { const fillSearchBox = filterTerm => {
const { searchBox } = vm.$refs; const { searchBox } = vm.$refs;
...@@ -122,10 +83,15 @@ describe('BoardsSelector', () => { ...@@ -122,10 +83,15 @@ describe('BoardsSelector', () => {
searchBoxInput.dispatchEvent(new Event('input')); searchBoxInput.dispatchEvent(new Event('input'));
}; };
it('shows all boards without filtering', () => { it('shows all boards without filtering', done => {
const dropdownItemCount = vm.$el.querySelectorAll('.js-dropdown-item'); vm.$nextTick()
.then(() => {
const dropdownItemCount = vm.$el.querySelectorAll('.js-dropdown-item');
expect(dropdownItemCount.length).toBe(boards.length); expect(dropdownItemCount.length).toBe(boards.length);
})
.then(done)
.catch(done.fail);
}); });
it('shows only matching boards when filtering', done => { it('shows only matching boards when filtering', done => {
......
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