From 6d291cc3a6b5e5b7100fc6a4838430df42e89ea3 Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Thu, 5 Jul 2018 12:02:56 +0000 Subject: [PATCH] File Icons in Merge Requests --- .../diffs/components/diff_file_header.vue | 14 +++++++++----- app/assets/stylesheets/pages/diff.scss | 2 +- .../diffs/components/diff_file_header_spec.js | 8 ++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/diffs/components/diff_file_header.vue b/app/assets/javascripts/diffs/components/diff_file_header.vue index fba1d1af7cd..a8e8732053b 100644 --- a/app/assets/javascripts/diffs/components/diff_file_header.vue +++ b/app/assets/javascripts/diffs/components/diff_file_header.vue @@ -2,6 +2,7 @@ import _ from 'underscore'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import Icon from '~/vue_shared/components/icon.vue'; +import FileIcon from '~/vue_shared/components/file_icon.vue'; import Tooltip from '~/vue_shared/directives/tooltip'; import { truncateSha } from '~/lib/utils/text_utility'; import { __, s__, sprintf } from '~/locale'; @@ -12,6 +13,7 @@ export default { ClipboardButton, EditButton, Icon, + FileIcon, }, directives: { Tooltip, @@ -139,18 +141,20 @@ export default { :name="collapseIcon" :size="16" aria-hidden="true" - class="diff-toggle-caret" + class="diff-toggle-caret append-right-5" @click.stop="handleToggle" /> - + css-classes="js-file-icon append-right-5" + /> { }); }); - it('displays an icon in the title', () => { + it('displays an file icon in the title', () => { vm = mountComponent(Component, props); - - const icon = vm.$el.querySelector(`i[class="fa fa-fw fa-${vm.icon}"]`); - expect(icon).not.toBe(null); + expect(vm.$el.querySelector('svg.js-file-icon use').getAttribute('xlink:href')).toContain( + 'ruby', + ); }); describe('file paths', () => {