Commit 7311e69f authored by Phil Hughes's avatar Phil Hughes

added aria-label to buttons

updated variable name
removed un-used prop
parent 9f35f6d9
<script> <script>
import { mapActions, mapGetters, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import { ActivityBarViews } from '../constants'; import { activityBarViews } from '../constants';
export default { export default {
components: { components: {
...@@ -17,7 +17,7 @@ export default { ...@@ -17,7 +17,7 @@ export default {
methods: { methods: {
...mapActions(['updateActivityBarView']), ...mapActions(['updateActivityBarView']),
}, },
ActivityBarViews, activityBarViews,
}; };
</script> </script>
...@@ -41,9 +41,10 @@ export default { ...@@ -41,9 +41,10 @@ export default {
type="button" type="button"
class="ide-sidebar-link js-ide-edit-mode" class="ide-sidebar-link js-ide-edit-mode"
:class="{ :class="{
active: currentActivityView === $options.ActivityBarViews.edit active: currentActivityView === $options.activityBarViews.edit
}" }"
@click.prevent="updateActivityBarView($options.ActivityBarViews.edit)" @click.prevent="updateActivityBarView($options.activityBarViews.edit)"
:aria-label="s__('IDE|Edit mode')"
> >
<icon <icon
name="code" name="code"
...@@ -55,9 +56,10 @@ export default { ...@@ -55,9 +56,10 @@ export default {
type="button" type="button"
class="ide-sidebar-link js-ide-commit-mode" class="ide-sidebar-link js-ide-commit-mode"
:class="{ :class="{
active: currentActivityView === $options.ActivityBarViews.commit active: currentActivityView === $options.activityBarViews.commit
}" }"
@click.prevent="updateActivityBarView($options.ActivityBarViews.commit)" @click.prevent="updateActivityBarView($options.activityBarViews.commit)"
:aria-label="s__('IDE|Commit mode')"
> >
<icon <icon
name="commit" name="commit"
......
...@@ -17,12 +17,6 @@ export default { ...@@ -17,12 +17,6 @@ export default {
RepoEditor, RepoEditor,
FindFile, FindFile,
}, },
props: {
emptyStateSvgPath: {
type: String,
required: true,
},
},
computed: { computed: {
...mapState([ ...mapState([
'changedFiles', 'changedFiles',
...@@ -30,6 +24,7 @@ export default { ...@@ -30,6 +24,7 @@ export default {
'viewer', 'viewer',
'currentMergeRequestId', 'currentMergeRequestId',
'fileFindVisible', 'fileFindVisible',
'emptyStateSvgPath',
]), ]),
...mapGetters(['activeFile', 'hasChanges']), ...mapGetters(['activeFile', 'hasChanges']),
}, },
......
...@@ -7,7 +7,7 @@ export const FILE_FINDER_EMPTY_ROW_HEIGHT = 33; ...@@ -7,7 +7,7 @@ export const FILE_FINDER_EMPTY_ROW_HEIGHT = 33;
export const MAX_TITLE_LENGTH = 50; export const MAX_TITLE_LENGTH = 50;
export const MAX_BODY_LENGTH = 72; export const MAX_BODY_LENGTH = 72;
export const ActivityBarViews = { export const activityBarViews = {
edit: 'ide-tree', edit: 'ide-tree',
commit: 'commit-section', commit: 'commit-section',
}; };
...@@ -22,11 +22,7 @@ function initIde(el) { ...@@ -22,11 +22,7 @@ function initIde(el) {
}); });
}, },
render(createElement) { render(createElement) {
return createElement('ide', { return createElement('ide');
props: {
emptyStateSvgPath: el.dataset.emptyStateSvgPath,
},
});
}, },
}); });
} }
......
import { ActivityBarViews } from '../constants'; import { activityBarViews } from '../constants';
export default () => ({ export default () => ({
currentProjectId: '', currentProjectId: '',
...@@ -20,6 +20,6 @@ export default () => ({ ...@@ -20,6 +20,6 @@ export default () => ({
entries: {}, entries: {},
viewer: 'editor', viewer: 'editor',
delayViewerUpdated: false, delayViewerUpdated: false,
currentActivityView: ActivityBarViews.edit, currentActivityView: activityBarViews.edit,
fileFindVisible: false, fileFindVisible: false,
}); });
import Vue from 'vue'; import Vue from 'vue';
import store from '~/ide/stores'; import store from '~/ide/stores';
import { ActivityBarViews } from '~/ide/constants'; import { activityBarViews } from '~/ide/constants';
import ActivityBar from '~/ide/components/activity_bar.vue'; import ActivityBar from '~/ide/components/activity_bar.vue';
import { createComponentWithStore } from '../../helpers/vue_mount_component_helper'; import { createComponentWithStore } from '../../helpers/vue_mount_component_helper';
import { resetStore } from '../helpers'; import { resetStore } from '../helpers';
...@@ -54,13 +54,13 @@ describe('IDE activity bar', () => { ...@@ -54,13 +54,13 @@ describe('IDE activity bar', () => {
it('calls updateActivityBarView with edit value on click', () => { it('calls updateActivityBarView with edit value on click', () => {
vm.$el.querySelector('.js-ide-edit-mode').click(); vm.$el.querySelector('.js-ide-edit-mode').click();
expect(vm.updateActivityBarView).toHaveBeenCalledWith(ActivityBarViews.edit); expect(vm.updateActivityBarView).toHaveBeenCalledWith(activityBarViews.edit);
}); });
it('calls updateActivityBarView with commit value on click', () => { it('calls updateActivityBarView with commit value on click', () => {
vm.$el.querySelector('.js-ide-commit-mode').click(); vm.$el.querySelector('.js-ide-commit-mode').click();
expect(vm.updateActivityBarView).toHaveBeenCalledWith(ActivityBarViews.commit); expect(vm.updateActivityBarView).toHaveBeenCalledWith(activityBarViews.commit);
}); });
}); });
...@@ -74,7 +74,7 @@ describe('IDE activity bar', () => { ...@@ -74,7 +74,7 @@ describe('IDE activity bar', () => {
}); });
it('sets commit item active', done => { it('sets commit item active', done => {
vm.$store.state.currentActivityView = ActivityBarViews.commit; vm.$store.state.currentActivityView = activityBarViews.commit;
vm.$nextTick(() => { vm.$nextTick(() => {
expect(vm.$el.querySelector('.js-ide-commit-mode').classList).toContain('active'); expect(vm.$el.querySelector('.js-ide-commit-mode').classList).toContain('active');
......
import Vue from 'vue'; import Vue from 'vue';
import store from '~/ide/stores'; import store from '~/ide/stores';
import ideSidebar from '~/ide/components/ide_side_bar.vue'; import ideSidebar from '~/ide/components/ide_side_bar.vue';
import { ActivityBarViews } from '~/ide/constants'; import { activityBarViews } from '~/ide/constants';
import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper'; import { createComponentWithStore } from 'spec/helpers/vue_mount_component_helper';
import { resetStore } from '../helpers'; import { resetStore } from '../helpers';
import { projectData } from '../mock_data'; import { projectData } from '../mock_data';
...@@ -45,7 +45,7 @@ describe('IdeSidebar', () => { ...@@ -45,7 +45,7 @@ describe('IdeSidebar', () => {
}); });
it('renders commit component', done => { it('renders commit component', done => {
vm.$store.state.currentActivityView = ActivityBarViews.commit; vm.$store.state.currentActivityView = activityBarViews.commit;
vm.$nextTick(() => { vm.$nextTick(() => {
expect(vm.$el.querySelector('.multi-file-commit-panel-section')).not.toBeNull(); expect(vm.$el.querySelector('.multi-file-commit-panel-section')).not.toBeNull();
......
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