diff --git a/spec/frontend/__helpers__/keep_alive_component_helper.js b/spec/frontend/__helpers__/keep_alive_component_helper.js deleted file mode 100644 index 54f40bf9093a7ce11b3d47a570da1b3ff3ce245f..0000000000000000000000000000000000000000 --- a/spec/frontend/__helpers__/keep_alive_component_helper.js +++ /dev/null @@ -1,29 +0,0 @@ -import Vue from 'vue'; - -export function keepAlive(KeptAliveComponent) { - return Vue.extend({ - components: { - KeptAliveComponent, - }, - data() { - return { - view: 'KeptAliveComponent', - }; - }, - methods: { - async activate() { - this.view = 'KeptAliveComponent'; - await this.$nextTick(); - }, - async deactivate() { - this.view = 'div'; - await this.$nextTick(); - }, - async reactivate() { - await this.deactivate(); - await this.activate(); - }, - }, - template: ``, - }); -} diff --git a/spec/frontend/__helpers__/keep_alive_component_helper_spec.js b/spec/frontend/__helpers__/keep_alive_component_helper_spec.js deleted file mode 100644 index 8b6cdedfd9f4f5b11383ac90c43a85e945cf64bc..0000000000000000000000000000000000000000 --- a/spec/frontend/__helpers__/keep_alive_component_helper_spec.js +++ /dev/null @@ -1,28 +0,0 @@ -import { mount } from '@vue/test-utils'; -import { keepAlive } from './keep_alive_component_helper'; - -const component = { - template: '
Test Component
', -}; - -describe('keepAlive', () => { - let wrapper; - - beforeEach(() => { - wrapper = mount(keepAlive(component)); - }); - - it('converts a component to a keep-alive component', async () => { - const { element } = wrapper.findComponent(component); - - await wrapper.vm.deactivate(); - expect(wrapper.findComponent(component).exists()).toBe(false); - - await wrapper.vm.activate(); - - // assert that when the component is destroyed and re-rendered, the - // newly rendered component has the reference to the old component - // (i.e. the old component was deactivated and activated) - expect(wrapper.findComponent(component).element).toBe(element); - }); -});