diff options
author | Mike Greiling <mike@pixelcog.com> | 2019-06-28 21:49:44 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2019-06-28 21:49:44 +0300 |
commit | be83c8eae0f9ca46c7ab08ba4f293935430932f0 (patch) | |
tree | df9844ae23e6360747200bfc4a0fe9e952489230 /spec | |
parent | 1cd8fb49f9b9150faf50767edbdfb564fde8576b (diff) | |
parent | 2643d3b38534533c16f36d37fe56a6be56445479 (diff) |
Merge branch 'leipert-absolute-scss-paths' into 'master'
Use absolute paths for SCSS imports
See merge request gitlab-org/gitlab-ce!30161
Diffstat (limited to 'spec')
-rw-r--r-- | spec/frontend/test_setup.js | 13 | ||||
-rw-r--r-- | spec/javascripts/monitoring/dashboard_spec.js | 2 | ||||
-rw-r--r-- | spec/javascripts/registry/components/collapsible_container_spec.js | 18 | ||||
-rw-r--r-- | spec/javascripts/registry/components/table_registry_spec.js | 19 | ||||
-rw-r--r-- | spec/javascripts/test_bundle.js | 4 |
5 files changed, 30 insertions, 26 deletions
diff --git a/spec/frontend/test_setup.js b/spec/frontend/test_setup.js index c17d5253997..15cf18700ed 100644 --- a/spec/frontend/test_setup.js +++ b/spec/frontend/test_setup.js @@ -3,6 +3,7 @@ import * as jqueryMatchers from 'custom-jquery-matchers'; import $ from 'jquery'; import Translate from '~/vue_shared/translate'; import axios from '~/lib/utils/axios_utils'; +import { config as testUtilsConfig } from '@vue/test-utils'; import { initializeTestTimeout } from './helpers/timeout'; import { loadHTMLFixture, setHTMLFixture } from './helpers/fixtures'; @@ -60,9 +61,21 @@ Object.assign(global, { preloadFixtures() {}, }); +Object.assign(global, { + MutationObserver() { + return { + disconnect() {}, + observe() {}, + }; + }, +}); + // custom-jquery-matchers was written for an old Jest version, we need to make it compatible Object.entries(jqueryMatchers).forEach(([matcherName, matcherFactory]) => { expect.extend({ [matcherName]: matcherFactory().compare, }); }); + +// Tech debt issue TBD +testUtilsConfig.logModifiedComponents = false; diff --git a/spec/javascripts/monitoring/dashboard_spec.js b/spec/javascripts/monitoring/dashboard_spec.js index ab8360193be..d3e10194d92 100644 --- a/spec/javascripts/monitoring/dashboard_spec.js +++ b/spec/javascripts/monitoring/dashboard_spec.js @@ -241,7 +241,7 @@ describe('Dashboard', () => { Vue.nextTick() .then(() => { const dropdownItems = component.$el.querySelectorAll( - '.js-environments-dropdown .dropdown-item.is-active', + '.js-environments-dropdown .dropdown-item.active', ); expect(dropdownItems.length).toEqual(1); diff --git a/spec/javascripts/registry/components/collapsible_container_spec.js b/spec/javascripts/registry/components/collapsible_container_spec.js index 9ed4b04324a..55017b3e26b 100644 --- a/spec/javascripts/registry/components/collapsible_container_spec.js +++ b/spec/javascripts/registry/components/collapsible_container_spec.js @@ -72,21 +72,15 @@ describe('collapsible registry container', () => { expect(findDeleteBtn()).not.toBeNull(); }); - describe('clicked on delete', () => { - beforeEach(done => { - findDeleteBtn().click(); - Vue.nextTick(done); - }); - - it('should open confirmation modal', () => { - expect(vm.$el.querySelector('#confirm-repo-deletion-modal')).not.toBeNull(); - }); + it('should call deleteItem when confirming deletion', done => { + findDeleteBtn().click(); + spyOn(vm, 'deleteItem').and.returnValue(Promise.resolve()); - it('should call deleteItem when confirming deletion', () => { - spyOn(vm, 'deleteItem').and.returnValue(Promise.resolve()); - vm.$el.querySelector('#confirm-repo-deletion-modal .btn-danger').click(); + Vue.nextTick(() => { + document.querySelector('#confirm-repo-deletion-modal .btn-danger').click(); expect(vm.deleteItem).toHaveBeenCalledWith(vm.repo); + done(); }); }); }); diff --git a/spec/javascripts/registry/components/table_registry_spec.js b/spec/javascripts/registry/components/table_registry_spec.js index d366c67a1b9..6a0b16f592e 100644 --- a/spec/javascripts/registry/components/table_registry_spec.js +++ b/spec/javascripts/registry/components/table_registry_spec.js @@ -46,23 +46,16 @@ describe('table registry', () => { expect(findDeleteBtn()).toBeDefined(); }); - describe('clicked on delete', () => { - beforeEach(done => { - findDeleteBtn().click(); - Vue.nextTick(done); - }); - - it('should open confirmation modal and set itemToBeDeleted properly', () => { - expect(vm.itemToBeDeleted).toEqual(firstImage); - expect(vm.$el.querySelector('#confirm-image-deletion-modal')).not.toBeNull(); - }); + it('should call deleteItem and reset itemToBeDeleted when confirming deletion', done => { + findDeleteBtn().click(); + spyOn(vm, 'deleteItem').and.returnValue(Promise.resolve()); - it('should call deleteItem and reset itemToBeDeleted when confirming deletion', () => { - spyOn(vm, 'deleteItem').and.returnValue(Promise.resolve()); - vm.$el.querySelector('#confirm-image-deletion-modal .btn-danger').click(); + Vue.nextTick(() => { + document.querySelector('#confirm-image-deletion-modal .btn-danger').click(); expect(vm.deleteItem).toHaveBeenCalledWith(firstImage); expect(vm.itemToBeDeleted).toBeNull(); + done(); }); }); }); diff --git a/spec/javascripts/test_bundle.js b/spec/javascripts/test_bundle.js index 8c80a425581..2cc476ed52a 100644 --- a/spec/javascripts/test_bundle.js +++ b/spec/javascripts/test_bundle.js @@ -10,12 +10,16 @@ import VueResource from 'vue-resource'; import Translate from '~/vue_shared/translate'; import CheckEE from '~/vue_shared/mixins/is_ee'; import jasmineDiff from 'jasmine-diff'; +import { config as testUtilsConfig } from '@vue/test-utils'; import { getDefaultAdapter } from '~/lib/utils/axios_utils'; import { FIXTURES_PATH, TEST_HOST } from './test_constants'; import customMatchers from './matchers'; +// Tech debt issue TBD +testUtilsConfig.logModifiedComponents = false; + const isHeadlessChrome = /\bHeadlessChrome\//.test(navigator.userAgent); Vue.config.devtools = !isHeadlessChrome; Vue.config.productionTip = false; |