Commit 6bf4a06e authored by Eric Eastwood's avatar Eric Eastwood

Remove overflow tabs logic (no longer used)

Fix
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12198#note_37143794
parent 15f37411
<script> <script>
import Vue from 'vue';
import Store from '../stores/repo_store'; import Store from '../stores/repo_store';
import RepoTab from './repo_tab.vue'; import RepoTab from './repo_tab.vue';
import RepoMixin from '../mixins/repo_mixin'; import RepoMixin from '../mixins/repo_mixin';
...@@ -14,29 +13,19 @@ const RepoTabs = { ...@@ -14,29 +13,19 @@ const RepoTabs = {
data: () => Store, data: () => Store,
methods: { methods: {
isOverflow() {
return this.$el.scrollWidth > this.$el.offsetWidth;
},
xClicked(file) { xClicked(file) {
Store.removeFromOpenedFiles(file); Store.removeFromOpenedFiles(file);
}, },
}, },
watch: {
openedFiles() {
Vue.nextTick(() => {
this.tabsOverflow = this.isOverflow();
});
},
},
}; };
export default RepoTabs; export default RepoTabs;
</script> </script>
<template> <template>
<ul id="tabs" v-if="isMini" v-cloak :class="{'overflown': tabsOverflow}"> <ul
v-if="isMini"
id="tabs">
<repo-tab v-for="tab in openedFiles" :key="tab.id" :tab="tab" :class="{'active' : tab.active}" @xclicked="xClicked"/> <repo-tab v-for="tab in openedFiles" :key="tab.id" :tab="tab" :class="{'active' : tab.active}" @xclicked="xClicked"/>
<li class="tabs-divider" /> <li class="tabs-divider" />
</ul> </ul>
......
...@@ -27,7 +27,6 @@ const RepoStore = { ...@@ -27,7 +27,6 @@ const RepoStore = {
tabSize: 100, tabSize: 100,
defaultTabSize: 100, defaultTabSize: 100,
minTabSize: 30, minTabSize: 30,
tabsOverflow: 41,
submitCommitsLoading: false, submitCommitsLoading: false,
binaryLoaded: false, binaryLoaded: false,
dialog: { dialog: {
......
...@@ -18,13 +18,11 @@ describe('RepoTabs', () => { ...@@ -18,13 +18,11 @@ describe('RepoTabs', () => {
it('renders a list of tabs', () => { it('renders a list of tabs', () => {
RepoStore.openedFiles = openedFiles; RepoStore.openedFiles = openedFiles;
RepoStore.tabsOverflow = true;
const vm = createComponent(); const vm = createComponent();
const tabs = [...vm.$el.querySelectorAll(':scope > li')]; const tabs = [...vm.$el.querySelectorAll(':scope > li')];
expect(vm.$el.id).toEqual('tabs'); expect(vm.$el.id).toEqual('tabs');
expect(vm.$el.classList.contains('overflown')).toBeTruthy();
expect(tabs.length).toEqual(3); expect(tabs.length).toEqual(3);
expect(tabs[0].classList.contains('active')).toBeTruthy(); expect(tabs[0].classList.contains('active')).toBeTruthy();
expect(tabs[1].classList.contains('active')).toBeFalsy(); expect(tabs[1].classList.contains('active')).toBeFalsy();
...@@ -39,15 +37,6 @@ describe('RepoTabs', () => { ...@@ -39,15 +37,6 @@ describe('RepoTabs', () => {
expect(vm.$el.innerHTML).toBeFalsy(); expect(vm.$el.innerHTML).toBeFalsy();
}); });
it('does not apply overflown class if not tabsOverflow', () => {
RepoStore.openedFiles = openedFiles;
RepoStore.tabsOverflow = false;
const vm = createComponent();
expect(vm.$el.classList.contains('overflown')).toBeFalsy();
});
describe('methods', () => { describe('methods', () => {
describe('xClicked', () => { describe('xClicked', () => {
it('calls removeFromOpenedFiles with file obj', () => { it('calls removeFromOpenedFiles with file obj', () => {
......
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