Commit 9a2eb9a4 authored by Martin Wortschack's avatar Martin Wortschack

Merge branch 'xanf-add-active-class-for-experiment-ui' into 'master'

Resolve "The "Project slug" field does not get filled with the "Project name" field when creating a project using a template with the new experimental UI"

See merge request gitlab-org/gitlab!34710
parents 71ae9893 deb03dab
...@@ -14,11 +14,13 @@ export default { ...@@ -14,11 +14,13 @@ export default {
} else { } else {
this.source = legacyEntry.parentNode; this.source = legacyEntry.parentNode;
this.$el.appendChild(legacyEntry); this.$el.appendChild(legacyEntry);
legacyEntry.classList.add('active');
} }
}, },
beforeDestroy() { beforeDestroy() {
if (this.source) { if (this.source) {
this.$el.firstChild.classList.remove('active');
this.source.appendChild(this.$el.firstChild); this.source.appendChild(this.$el.firstChild);
} }
}, },
......
...@@ -23,13 +23,28 @@ describe('Legacy container component', () => { ...@@ -23,13 +23,28 @@ describe('Legacy container component', () => {
createComponent({ selector: '.dummy-target' }); createComponent({ selector: '.dummy-target' });
}); });
it('moves node inside component when mounted', () => { describe('when mounted', () => {
expect(dummy.parentNode).toBe(wrapper.element); it('moves node inside component', () => {
expect(dummy.parentNode).toBe(wrapper.element);
});
it('sets active class', () => {
expect(dummy.classList.contains('active')).toBe(true);
});
}); });
it('moves node back when unmounted', () => { describe('when unmounted', () => {
wrapper.destroy(); beforeEach(() => {
expect(dummy.parentNode).toBe(document.body); wrapper.destroy();
});
it('moves node back', () => {
expect(dummy.parentNode).toBe(document.body);
});
it('removes active class', () => {
expect(dummy.classList.contains('active')).toBe(false);
});
}); });
}); });
......
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