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:
authorPaul Slaughter <pslaughter@gitlab.com>2019-05-24 21:11:29 +0300
committerPaul Slaughter <pslaughter@gitlab.com>2019-05-31 05:00:52 +0300
commit00c8264faf6e02f741240b5c430cebcebd730280 (patch)
tree4f051776be659cd41d1cf8a6f69961eee1ec98a5 /spec/javascripts
parent5e88463d3089e3b764ae6347b9ce709a01acb8b7 (diff)
Jestify activities spec
Also add `jQuery` to global in `test_setup`. This was needed because: - `vendor/jquery.endless-scroll` depends on it. - Adding it to `global` in the spec itself didn't work.
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/activities_spec.js71
1 files changed, 0 insertions, 71 deletions
diff --git a/spec/javascripts/activities_spec.js b/spec/javascripts/activities_spec.js
deleted file mode 100644
index 23b6de7e4e0..00000000000
--- a/spec/javascripts/activities_spec.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/* eslint-disable no-unused-expressions, no-prototype-builtins, no-new, no-shadow */
-
-import $ from 'jquery';
-import 'vendor/jquery.endless-scroll';
-import Activities from '~/activities';
-import Pager from '~/pager';
-
-describe('Activities', () => {
- window.gon || (window.gon = {});
- const fixtureTemplate = 'static/event_filter.html';
- const filters = [
- {
- id: 'all',
- },
- {
- id: 'push',
- name: 'push events',
- },
- {
- id: 'merged',
- name: 'merge events',
- },
- {
- id: 'comments',
- },
- {
- id: 'team',
- },
- ];
-
- function getEventName(index) {
- const filter = filters[index];
- return filter.hasOwnProperty('name') ? filter.name : filter.id;
- }
-
- function getSelector(index) {
- const filter = filters[index];
- return `#${filter.id}_event_filter`;
- }
-
- beforeEach(() => {
- loadFixtures(fixtureTemplate);
- spyOn(Pager, 'init').and.stub();
- new Activities();
- });
-
- for (let i = 0; i < filters.length; i += 1) {
- (i => {
- describe(`when selecting ${getEventName(i)}`, () => {
- beforeEach(() => {
- $(getSelector(i)).click();
- });
-
- for (let x = 0; x < filters.length; x += 1) {
- (x => {
- const shouldHighlight = i === x;
- const testName = shouldHighlight ? 'should highlight' : 'should not highlight';
-
- it(`${testName} ${getEventName(x)}`, () => {
- expect(
- $(getSelector(x))
- .parent()
- .hasClass('active'),
- ).toEqual(shouldHighlight);
- });
- })(x);
- }
- });
- })(i);
- }
-});