Commit 5bcabb88 authored by Phil Hughes's avatar Phil Hughes

Stops rendering the collapsed warning message all the time

This changes the collapsed warning message to only be rendered
when we want it to be. With `v-show` we will always create the DOM
elements and add to the DOM even if we won't ever show it.

Closes https://gitlab.com/gitlab-org/gitlab/-/issues/335222
parent 8e948357
......@@ -386,7 +386,7 @@ export default {
</div>
<template v-else>
<div
v-show="showWarning"
v-if="showWarning"
class="collapsed-file-warning gl-p-7 gl-bg-orange-50 gl-text-center gl-rounded-bottom-left-base gl-rounded-bottom-right-base"
>
<p class="gl-mb-5">
......@@ -402,7 +402,7 @@ export default {
</gl-button>
</div>
<diff-content
v-show="showContent"
v-if="showContent"
:class="hasBodyClasses.content"
:diff-file="file"
:help-page-path="helpPagePath"
......
......@@ -110,7 +110,6 @@ const findLoader = (wrapper) => wrapper.find('[data-testid="loader-icon"]');
const findToggleButton = (wrapper) => wrapper.find('[data-testid="expand-button"]');
const toggleFile = (wrapper) => findDiffHeader(wrapper).vm.$emit('toggleFile');
const isDisplayNone = (element) => element.style.display === 'none';
const getReadableFile = () => JSON.parse(JSON.stringify(diffFileMockDataReadable));
const getUnreadableFile = () => JSON.parse(JSON.stringify(diffFileMockDataUnreadable));
......@@ -305,9 +304,7 @@ describe('DiffFile', () => {
it('should not have any content at all', async () => {
await wrapper.vm.$nextTick();
Array.from(findDiffContentArea(wrapper).element.children).forEach((child) => {
expect(isDisplayNone(child)).toBe(true);
});
expect(findDiffContentArea(wrapper).element.children.length).toBe(0);
});
it('should not have the class `has-body` to present the header differently', () => {
......
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