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 {
} else {
this.source = legacyEntry.parentNode;
this.$el.appendChild(legacyEntry);
legacyEntry.classList.add('active');
}
},
beforeDestroy() {
if (this.source) {
this.$el.firstChild.classList.remove('active');
this.source.appendChild(this.$el.firstChild);
}
},
......
......@@ -23,13 +23,28 @@ describe('Legacy container component', () => {
createComponent({ selector: '.dummy-target' });
});
it('moves node inside component when mounted', () => {
expect(dummy.parentNode).toBe(wrapper.element);
describe('when mounted', () => {
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', () => {
wrapper.destroy();
expect(dummy.parentNode).toBe(document.body);
describe('when unmounted', () => {
beforeEach(() => {
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