diff options
author | Phil Hughes <me@iamphill.com> | 2017-10-30 19:25:32 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-10-30 19:25:32 +0300 |
commit | 098a98055abd32a7049b5429064f1ed45e45eea8 (patch) | |
tree | 8faf66231d3a5ca47179e0674e211e3467f28466 /app/assets/javascripts | |
parent | 5c75d750cf3b86e7e61df89b4b0efef1207829e0 (diff) |
spec fixes
increased perf of scrolling tabs into view
Diffstat (limited to 'app/assets/javascripts')
4 files changed, 10 insertions, 11 deletions
diff --git a/app/assets/javascripts/repo/components/new_dropdown/modal.vue b/app/assets/javascripts/repo/components/new_dropdown/modal.vue index e780b88b04c..ac1f613bb71 100644 --- a/app/assets/javascripts/repo/components/new_dropdown/modal.vue +++ b/app/assets/javascripts/repo/components/new_dropdown/modal.vue @@ -1,5 +1,5 @@ <script> - import { mapActions, mapState } from 'vuex'; + import { mapActions } from 'vuex'; import { __ } from '../../../locale'; import popupDialog from '../../../vue_shared/components/popup_dialog.vue'; @@ -28,7 +28,7 @@ ]), createEntryInStore() { this.createTempEntry({ - name: this.entryName.replace(new RegExp(`^${this.path}\/`), ''), + name: this.entryName.replace(new RegExp(`^${this.path}/`), ''), type: this.type, }); diff --git a/app/assets/javascripts/repo/components/repo.vue b/app/assets/javascripts/repo/components/repo.vue index 1f0e168c777..98117802016 100644 --- a/app/assets/javascripts/repo/components/repo.vue +++ b/app/assets/javascripts/repo/components/repo.vue @@ -26,12 +26,14 @@ export default { RepoPreview, }, 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) => { if (!this.changedFiles.length) return undefined; - e.returnValue = alertMessage; - return alertMessage; + Object.assign(e, { + returnValue, + }); + return returnValue; }; }, }; diff --git a/app/assets/javascripts/repo/components/repo_preview.vue b/app/assets/javascripts/repo/components/repo_preview.vue index b189a603c57..d4d0a667ce4 100644 --- a/app/assets/javascripts/repo/components/repo_preview.vue +++ b/app/assets/javascripts/repo/components/repo_preview.vue @@ -8,7 +8,7 @@ export default { 'activeFile', ]), renderErrorTooLarge() { - return this.activeFile.renderError == 'too_large'; + return this.activeFile.renderError === 'too_large'; }, }, methods: { diff --git a/app/assets/javascripts/repo/stores/actions.js b/app/assets/javascripts/repo/stores/actions.js index 008de3d8315..856a3994b37 100644 --- a/app/assets/javascripts/repo/stores/actions.js +++ b/app/assets/javascripts/repo/stores/actions.js @@ -2,9 +2,6 @@ import Vue from 'vue'; import flash from '../../flash'; import service from '../services'; import * as types from './mutation_types'; -import { - pushState, -} from './utils'; export const redirectToUrl = url => gl.utils.visitUrl(url); @@ -118,9 +115,9 @@ export const scrollToTab = () => { const tabs = document.getElementById('tabs'); if (tabs) { - const tabEl = tabs.querySelector('.active'); + const tabEl = tabs.querySelector('.active .repo-tab'); - tabs.scrollLeft = tabEl.offsetLeft; + tabEl.focus(); } }); }; |