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>2019-12-20 18:07:34 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-20 18:07:34 +0300
commit8b61452138ecc511b52cd49be4ee6b8a80390c50 (patch)
tree122b817432c2a0f0e23767bd95791a89b20540c0 /spec/javascripts/droplab
parentf864f8a7aafa45b0e4c04e4312f89da4b1227c0f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/javascripts/droplab')
-rw-r--r--spec/javascripts/droplab/constants_spec.js39
-rw-r--r--spec/javascripts/droplab/plugins/ajax_filter_spec.js72
-rw-r--r--spec/javascripts/droplab/plugins/ajax_spec.js41
3 files changed, 0 insertions, 152 deletions
diff --git a/spec/javascripts/droplab/constants_spec.js b/spec/javascripts/droplab/constants_spec.js
deleted file mode 100644
index 23b69defec6..00000000000
--- a/spec/javascripts/droplab/constants_spec.js
+++ /dev/null
@@ -1,39 +0,0 @@
-import * as constants from '~/droplab/constants';
-
-describe('constants', function() {
- describe('DATA_TRIGGER', function() {
- it('should be `data-dropdown-trigger`', function() {
- expect(constants.DATA_TRIGGER).toBe('data-dropdown-trigger');
- });
- });
-
- describe('DATA_DROPDOWN', function() {
- it('should be `data-dropdown`', function() {
- expect(constants.DATA_DROPDOWN).toBe('data-dropdown');
- });
- });
-
- describe('SELECTED_CLASS', function() {
- it('should be `droplab-item-selected`', function() {
- expect(constants.SELECTED_CLASS).toBe('droplab-item-selected');
- });
- });
-
- describe('ACTIVE_CLASS', function() {
- it('should be `droplab-item-active`', function() {
- expect(constants.ACTIVE_CLASS).toBe('droplab-item-active');
- });
- });
-
- describe('TEMPLATE_REGEX', function() {
- it('should be a handlebars templating syntax regex', function() {
- expect(constants.TEMPLATE_REGEX).toEqual(/\{\{(.+?)\}\}/g);
- });
- });
-
- describe('IGNORE_CLASS', function() {
- it('should be `droplab-item-ignore`', function() {
- expect(constants.IGNORE_CLASS).toBe('droplab-item-ignore');
- });
- });
-});
diff --git a/spec/javascripts/droplab/plugins/ajax_filter_spec.js b/spec/javascripts/droplab/plugins/ajax_filter_spec.js
deleted file mode 100644
index 5dbe50af07f..00000000000
--- a/spec/javascripts/droplab/plugins/ajax_filter_spec.js
+++ /dev/null
@@ -1,72 +0,0 @@
-import AjaxCache from '~/lib/utils/ajax_cache';
-import AjaxFilter from '~/droplab/plugins/ajax_filter';
-
-describe('AjaxFilter', () => {
- let dummyConfig;
- const dummyData = 'dummy data';
- let dummyList;
-
- beforeEach(() => {
- dummyConfig = {
- endpoint: 'dummy endpoint',
- searchKey: 'dummy search key',
- };
- dummyList = {
- data: [],
- list: document.createElement('div'),
- };
-
- AjaxFilter.hook = {
- config: {
- AjaxFilter: dummyConfig,
- },
- list: dummyList,
- };
- });
-
- describe('trigger', () => {
- let ajaxSpy;
-
- beforeEach(() => {
- spyOn(AjaxCache, 'retrieve').and.callFake(url => ajaxSpy(url));
- spyOn(AjaxFilter, '_loadData');
-
- dummyConfig.onLoadingFinished = jasmine.createSpy('spy');
-
- const dynamicList = document.createElement('div');
- dynamicList.dataset.dynamic = true;
- dummyList.list.appendChild(dynamicList);
- });
-
- it('calls onLoadingFinished after loading data', done => {
- ajaxSpy = url => {
- expect(url).toBe('dummy endpoint?dummy search key=');
- return Promise.resolve(dummyData);
- };
-
- AjaxFilter.trigger()
- .then(() => {
- expect(dummyConfig.onLoadingFinished.calls.count()).toBe(1);
- })
- .then(done)
- .catch(done.fail);
- });
-
- it('does not call onLoadingFinished if Ajax call fails', done => {
- const dummyError = new Error('My dummy is sick! :-(');
- ajaxSpy = url => {
- expect(url).toBe('dummy endpoint?dummy search key=');
- return Promise.reject(dummyError);
- };
-
- AjaxFilter.trigger()
- .then(done.fail)
- .catch(error => {
- expect(error).toBe(dummyError);
- expect(dummyConfig.onLoadingFinished.calls.count()).toBe(0);
- })
- .then(done)
- .catch(done.fail);
- });
- });
-});
diff --git a/spec/javascripts/droplab/plugins/ajax_spec.js b/spec/javascripts/droplab/plugins/ajax_spec.js
deleted file mode 100644
index 2f492d00c0a..00000000000
--- a/spec/javascripts/droplab/plugins/ajax_spec.js
+++ /dev/null
@@ -1,41 +0,0 @@
-import AjaxCache from '~/lib/utils/ajax_cache';
-import Ajax from '~/droplab/plugins/ajax';
-
-describe('Ajax', () => {
- describe('preprocessing', () => {
- const config = {};
-
- describe('is not configured', () => {
- it('passes the data through', () => {
- const data = ['data'];
-
- expect(Ajax.preprocessing(config, data)).toEqual(data);
- });
- });
-
- describe('is configured', () => {
- const processedArray = ['processed'];
-
- beforeEach(() => {
- config.preprocessing = () => processedArray;
- spyOn(config, 'preprocessing').and.callFake(() => processedArray);
- });
-
- it('calls preprocessing', () => {
- Ajax.preprocessing(config, []);
-
- expect(config.preprocessing.calls.count()).toBe(1);
- });
-
- it('overrides AjaxCache', () => {
- spyOn(AjaxCache, 'override').and.callFake((endpoint, results) => {
- expect(results).toEqual(processedArray);
- });
-
- Ajax.preprocessing(config, []);
-
- expect(AjaxCache.override.calls.count()).toBe(1);
- });
- });
- });
-});