Commit 0e30f242 authored by Brian T's avatar Brian T Committed by Martin Wortschack

Fix unable to expand or collapse files in merge request by clicking caret

parent e3b83f06
...@@ -61,7 +61,7 @@ export default { ...@@ -61,7 +61,7 @@ export default {
</script> </script>
<template> <template>
<svg :class="[iconSizeClass, iconTestClass]" aria-hidden="true"> <svg :class="[iconSizeClass, iconTestClass]" aria-hidden="true" v-on="$listeners">
<use v-bind="{ 'xlink:href': spriteHref }" /> <use v-bind="{ 'xlink:href': spriteHref }" />
</svg> </svg>
</template> </template>
---
title: Fix unable to expand or collapse files in merge request by clicking caret
merge_request: 19222
author: Brian T
type: fixed
import Vue from 'vue'; import Vue from 'vue';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper'; import mountComponent from 'spec/helpers/vue_mount_component_helper';
import { mount } from '@vue/test-utils';
describe('Sprite Icon Component', function() { describe('Sprite Icon Component', function() {
describe('Initialization', function() { describe('Initialization', function() {
...@@ -57,4 +58,16 @@ describe('Sprite Icon Component', function() { ...@@ -57,4 +58,16 @@ describe('Sprite Icon Component', function() {
expect(Icon.props.name.validator('commit')).toBe(true); expect(Icon.props.name.validator('commit')).toBe(true);
}); });
}); });
it('should call registered listeners when they are triggered', () => {
const clickHandler = jasmine.createSpy('clickHandler');
const wrapper = mount(Icon, {
propsData: { name: 'commit' },
listeners: { click: clickHandler },
});
wrapper.find('svg').trigger('click');
expect(clickHandler).toHaveBeenCalled();
});
}); });
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