Skip to content

Commit

Permalink
Merge branch 'feature/update-icon' into feature/update
Browse files Browse the repository at this point in the history
  • Loading branch information
ofrankowska committed Jul 16, 2021
2 parents 848a58e + 58bbc95 commit 0e15bd6
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 110 deletions.
6 changes: 0 additions & 6 deletions src/atoms/icon/Icon.css

This file was deleted.

2 changes: 1 addition & 1 deletion src/atoms/icon/Icon.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
xmlns="http://www.w3.org/2000/svg"
:width="`${width}px`"
:height="`${height}px`"
class="a-icon"
:viewBox="viewBox ? viewBox : `0 0 ${width} ${height}`"
:aria-labelledby="ariaId"
:role="title ? 'img' : 'presentation'"
:focusable="title ? null : 'false'"
:class="getClass('icon')"
>
<title
v-if="title"
Expand Down
17 changes: 16 additions & 1 deletion src/atoms/icon/Icon.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// @vue/component
import getClass from '../../../utils/helpers/get-class.js'

export default {
mixins: [getClass],
props: {
/**
* Icon id for aria-labelledby
Expand Down Expand Up @@ -37,6 +39,19 @@ export default {
default: false
}
},
data () {
return {
config: {
base: {
icon: [
'block',
'pointer-events-none',
'transition-all', 'duration-200', 'ease-in-out'
]
}
}
}
},
computed: {
ariaId () {
return this.id || (this.title && this.title.toLowerCase().replace(/ /g, '-'))
Expand Down
4 changes: 1 addition & 3 deletions src/atoms/icon/Icon.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ describe('Icon', () => {
const wrapper = mount(AIcon)

expect(wrapper.element.tagName).toBe('svg')
expect(wrapper.classes()).toContain('a-icon')
expect(wrapper.classes().length).toBe(1)
expect(wrapper.attributes().xmlns).toBeDefined()
expect(wrapper.attributes().xmlns).toEqual('http://www.w3.org/2000/svg')
expect(wrapper.attributes().role).toBeDefined()
Expand All @@ -29,7 +27,7 @@ describe('Icon', () => {
}
})

const title = wrapper.find('.a-icon > title')
const title = wrapper.find('svg > title')

expect(wrapper.attributes().role).toBeDefined()
expect(wrapper.attributes().role).toEqual('img')
Expand Down
Loading

0 comments on commit 0e15bd6

Please sign in to comment.