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,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