Commit deb03dab authored by Illya Klymov's avatar Illya Klymov

Add active class when switching tabs in new UI

parent d9b199ef
......@@ -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,14 +23,29 @@ describe('Legacy container component', () => {
createComponent({ selector: '.dummy-target' });
});
it('moves node inside component when mounted', () => {
describe('when mounted', () => {
it('moves node inside component', () => {
expect(dummy.parentNode).toBe(wrapper.element);
});
it('moves node back when unmounted', () => {
it('sets active class', () => {
expect(dummy.classList.contains('active')).toBe(true);
});
});
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);
});
});
});
describe('when selector targets template node', () => {
......
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