Commit 098a9805 authored by Phil Hughes's avatar Phil Hughes

spec fixes

increased perf of scrolling tabs into view
parent 5c75d750
<script> <script>
import { mapActions, mapState } from 'vuex'; import { mapActions } from 'vuex';
import { __ } from '../../../locale'; import { __ } from '../../../locale';
import popupDialog from '../../../vue_shared/components/popup_dialog.vue'; import popupDialog from '../../../vue_shared/components/popup_dialog.vue';
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
]), ]),
createEntryInStore() { createEntryInStore() {
this.createTempEntry({ this.createTempEntry({
name: this.entryName.replace(new RegExp(`^${this.path}\/`), ''), name: this.entryName.replace(new RegExp(`^${this.path}/`), ''),
type: this.type, type: this.type,
}); });
......
...@@ -26,12 +26,14 @@ export default { ...@@ -26,12 +26,14 @@ export default {
RepoPreview, RepoPreview,
}, },
mounted() { mounted() {
const alertMessage = 'Are you sure you want to lose unsaved changes?'; const returnValue = 'Are you sure you want to lose unsaved changes?';
window.onbeforeunload = (e) => { window.onbeforeunload = (e) => {
if (!this.changedFiles.length) return undefined; if (!this.changedFiles.length) return undefined;
e.returnValue = alertMessage; Object.assign(e, {
return alertMessage; returnValue,
});
return returnValue;
}; };
}, },
}; };
......
...@@ -8,7 +8,7 @@ export default { ...@@ -8,7 +8,7 @@ export default {
'activeFile', 'activeFile',
]), ]),
renderErrorTooLarge() { renderErrorTooLarge() {
return this.activeFile.renderError == 'too_large'; return this.activeFile.renderError === 'too_large';
}, },
}, },
methods: { methods: {
......
...@@ -2,9 +2,6 @@ import Vue from 'vue'; ...@@ -2,9 +2,6 @@ import Vue from 'vue';
import flash from '../../flash'; import flash from '../../flash';
import service from '../services'; import service from '../services';
import * as types from './mutation_types'; import * as types from './mutation_types';
import {
pushState,
} from './utils';
export const redirectToUrl = url => gl.utils.visitUrl(url); export const redirectToUrl = url => gl.utils.visitUrl(url);
...@@ -118,9 +115,9 @@ export const scrollToTab = () => { ...@@ -118,9 +115,9 @@ export const scrollToTab = () => {
const tabs = document.getElementById('tabs'); const tabs = document.getElementById('tabs');
if (tabs) { if (tabs) {
const tabEl = tabs.querySelector('.active'); const tabEl = tabs.querySelector('.active .repo-tab');
tabs.scrollLeft = tabEl.offsetLeft; tabEl.focus();
} }
}); });
}; };
......
...@@ -41,7 +41,9 @@ ...@@ -41,7 +41,9 @@
} }
.panel-right { .panel-right {
display: -webkit-flex;
display: flex; display: flex;
-webkit-flex-direction: column;
flex-direction: column; flex-direction: column;
width: 80%; width: 80%;
height: 100%; height: 100%;
...@@ -73,6 +75,7 @@ ...@@ -73,6 +75,7 @@
} }
.blob-viewer-container { .blob-viewer-container {
-webkit-flex: 1;
flex: 1; flex: 1;
overflow: auto; overflow: auto;
......
...@@ -28,7 +28,7 @@ feature 'Multi-file editor new file', :js do ...@@ -28,7 +28,7 @@ feature 'Multi-file editor new file', :js do
click_button('Create file') click_button('Create file')
end end
find('.inputarea', visible: false).send_keys('file content') find('.inputarea').send_keys('file content')
fill_in('commit-message', with: 'commit message') fill_in('commit-message', with: 'commit message')
......
...@@ -10,7 +10,11 @@ describe('new dropdown component', () => { ...@@ -10,7 +10,11 @@ describe('new dropdown component', () => {
beforeEach(() => { beforeEach(() => {
const component = Vue.extend(newDropdown); const component = Vue.extend(newDropdown);
vm = createComponentWithStore(component, store).$mount(); vm = createComponentWithStore(component, store);
vm.$store.state.path = '';
vm.$mount();
}); });
afterEach(() => { afterEach(() => {
......
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