@fortawesome/vue-fontawesome 2.0.5 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +8 -803
  3. package/index.es.js +288 -229
  4. package/index.js +636 -577
  5. package/package.json +41 -24
  6. package/src/components/FontAwesomeIcon.js +15 -3
  7. package/src/utils.js +5 -1
  8. package/.babelrc +0 -3
  9. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -24
  10. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  11. package/.github/workflows/ci.yml +0 -31
  12. package/.npmrc.proregistry +0 -2
  13. package/.tool-versions +0 -2
  14. package/CODE_OF_CONDUCT.md +0 -74
  15. package/CONTRIBUTING.md +0 -57
  16. package/DEVELOPMENT.md +0 -44
  17. package/bin/dev +0 -3
  18. package/bin/setup +0 -8
  19. package/examples/vue-cli-webpack/.babelrc +0 -12
  20. package/examples/vue-cli-webpack/.editorconfig +0 -9
  21. package/examples/vue-cli-webpack/.eslintignore +0 -4
  22. package/examples/vue-cli-webpack/.eslintrc.js +0 -29
  23. package/examples/vue-cli-webpack/.postcssrc.js +0 -10
  24. package/examples/vue-cli-webpack/README.md +0 -21
  25. package/examples/vue-cli-webpack/build/build.js +0 -41
  26. package/examples/vue-cli-webpack/build/check-versions.js +0 -54
  27. package/examples/vue-cli-webpack/build/logo.png +0 -0
  28. package/examples/vue-cli-webpack/build/utils.js +0 -101
  29. package/examples/vue-cli-webpack/build/vue-loader.conf.js +0 -22
  30. package/examples/vue-cli-webpack/build/webpack.base.conf.js +0 -91
  31. package/examples/vue-cli-webpack/build/webpack.dev.conf.js +0 -95
  32. package/examples/vue-cli-webpack/build/webpack.prod.conf.js +0 -145
  33. package/examples/vue-cli-webpack/config/dev.env.js +0 -7
  34. package/examples/vue-cli-webpack/config/index.js +0 -76
  35. package/examples/vue-cli-webpack/config/prod.env.js +0 -4
  36. package/examples/vue-cli-webpack/index.html +0 -13
  37. package/examples/vue-cli-webpack/package-lock.json +0 -11632
  38. package/examples/vue-cli-webpack/package.json +0 -77
  39. package/examples/vue-cli-webpack/src/App.vue +0 -66
  40. package/examples/vue-cli-webpack/src/assets/logo.png +0 -0
  41. package/examples/vue-cli-webpack/src/components/HelloWorld.vue +0 -113
  42. package/examples/vue-cli-webpack/src/main.js +0 -28
  43. package/examples/vue-cli-webpack/static/.gitkeep +0 -0
  44. package/rollup.config.js +0 -54
  45. package/src/components/__fixtures__/helpers.js +0 -40
  46. package/src/components/__fixtures__/icons.js +0 -35
  47. package/src/components/__tests__/FontAwesomeIcon.test.js +0 -337
  48. package/src/components/__tests__/FontAwesomeLayers.test.js +0 -55
  49. package/src/components/__tests__/FontAwesomeLayersText.test.js +0 -52
@@ -1,337 +0,0 @@
1
- import Vue from 'vue/dist/vue'
2
- import FontAwesomeIcon from '../FontAwesomeIcon'
3
- import { library } from '@fortawesome/fontawesome-svg-core'
4
- import { faClose, faUser } from '@fortawesome/free-solid-svg-icons'
5
- import { faCoffee, faCircle, faSpartan } from '../__fixtures__/icons'
6
- import { coreHasFeature, REFERENCE_ICON_USING_STRING, REFERENCE_ICON_BY_STYLE, ICON_ALIASES, compileAndMount, mountFromProps } from '../__fixtures__/helpers'
7
-
8
- beforeEach(() => {
9
- library.add(faCoffee, faCircle, faSpartan)
10
- Vue.component('font-awesome-icon', FontAwesomeIcon)
11
- })
12
-
13
- afterEach(() => {
14
- library.reset()
15
- })
16
-
17
- test('using a FAT icon with array format', () => {
18
- const vm = mountFromProps({ icon: ['fat', 'spartan'] })
19
-
20
- expect(vm.$el.tagName).toBe('svg')
21
- expect(vm.$el.classList.contains('fa-spartan')).toBeTruthy()
22
- })
23
-
24
- if(coreHasFeature(ICON_ALIASES)) {
25
- test('find a free-solid-svg-icon with array format', () => {
26
- library.reset()
27
- library.add(faClose)
28
- const vm = mountFromProps({ icon: ['fas', 'xmark'] })
29
-
30
- expect(vm.$el.tagName).toBe('svg')
31
- expect(vm.$el.classList.contains('fa-xmark')).toBeTruthy()
32
- })
33
-
34
- test('find a free-solid-svg-icon that is an alias', () => {
35
- library.reset()
36
- library.add(faClose)
37
- const vm = mountFromProps({ icon: ['fas', 'close'] })
38
-
39
- expect(vm.$el.tagName).toBe('svg')
40
- expect(vm.$el.classList.contains('fa-close')).toBeTruthy()
41
- })
42
- }
43
-
44
- if(coreHasFeature(REFERENCE_ICON_USING_STRING)) {
45
- test('find an icon using string format', () => {
46
- const vm = mountFromProps({ icon: 'fa-coffee' })
47
-
48
- expect(vm.$el.tagName).toBe('svg')
49
- expect(vm.$el.classList.contains('fa-coffee')).toBeTruthy()
50
- })
51
-
52
- test('find an icon using string format with style', () => {
53
- const vm = mountFromProps({ icon: 'fa-solid fa-coffee' })
54
-
55
- expect(vm.$el.tagName).toBe('svg')
56
- expect(vm.$el.classList.contains('fa-coffee')).toBeTruthy()
57
- })
58
- }
59
-
60
- if (coreHasFeature(REFERENCE_ICON_BY_STYLE)) {
61
- test('find a THIN icon with array format', () => {
62
- const vm = mountFromProps({ icon: ['thin', 'spartan'] })
63
-
64
- expect(vm.$el.tagName).toBe('svg')
65
- expect(vm.$el.classList.contains('fa-spartan')).toBeTruthy()
66
- })
67
-
68
- test('find a FA-THIN icon with array format', () => {
69
- const vm = mountFromProps({ icon: ['fa-thin', 'spartan'] })
70
-
71
- expect(vm.$el.tagName).toBe('svg')
72
- expect(vm.$el.classList.contains('fa-spartan')).toBeTruthy()
73
- })
74
- }
75
-
76
- test('using array format', () => {
77
- const vm = mountFromProps({ icon: ['fas', 'coffee'] })
78
-
79
- expect(vm.$el.tagName).toBe('svg')
80
- expect(vm.$el.classList.contains('fa-coffee')).toBeTruthy()
81
- })
82
-
83
- test('using string format', () => {
84
- const vm = mountFromProps({ icon: 'coffee' })
85
-
86
- expect(vm.$el.tagName).toBe('svg')
87
- expect(vm.$el.classList.contains('fa-coffee')).toBeTruthy()
88
- })
89
-
90
- test.only('using imported object from svg icons package', () => {
91
- const vm = mountFromProps({ icon: faUser })
92
-
93
- expect(vm.$el.tagName).toBe('svg')
94
- })
95
-
96
- test('missing icon', () => {
97
- const vm = mountFromProps({ icon: ['fas', 'noicon'] })
98
-
99
- expect(vm.$el.tagName).toBeFalsy()
100
- })
101
-
102
- test('using iconDefinition', () => {
103
- const vm = mountFromProps({ icon: faCoffee })
104
-
105
- expect(vm.$el.tagName).toBe('svg')
106
- expect(vm.$el.classList.contains('fa-coffee')).toBeTruthy()
107
- })
108
-
109
- describe('unrelated Vue data options', () => {
110
- test('with extra static class', () => {
111
- const vm = compileAndMount(
112
- `<font-awesome-icon class="extra" :icon="icon" />`,
113
- { data: { icon: faCoffee } }
114
- )
115
-
116
- expect(vm.$el.classList.contains('extra')).toBeTruthy()
117
- })
118
-
119
- test('with extra bound class', () => {
120
- const vm = compileAndMount(
121
- `<font-awesome-icon :class="['extra1', {'extra2': true}]" :icon="icon" />`,
122
- { data: { icon: faCoffee } }
123
- )
124
-
125
- expect(vm.$el.classList.contains('extra1')).toBeTruthy()
126
- expect(vm.$el.classList.contains('extra2')).toBeTruthy()
127
- })
128
-
129
- test('with extra style', () => {
130
- const vm = compileAndMount(
131
- `<font-awesome-icon :style="{'font-size': '42px'}" :icon="icon" />`,
132
- { data: { icon: faCoffee } }
133
- )
134
-
135
- expect(vm.$el.style.getPropertyValue('font-size')).toBe('42px')
136
- })
137
-
138
- test('with extra DOM property', () => {
139
- const vm = compileAndMount(
140
- `<font-awesome-icon rel="local" :icon="icon" />`,
141
- { data: { icon: faCoffee } }
142
- )
143
-
144
- expect(vm.$el.getAttribute('rel')).toBe('local')
145
- })
146
-
147
- test('with listener', () => {
148
- let hasBeenClicked = false
149
-
150
- const vm = compileAndMount(
151
- `<font-awesome-icon @click="clicked" :icon="icon" />`,
152
- { data: { icon: faCoffee }, methods: { clicked () { hasBeenClicked = true } } }
153
- )
154
-
155
- expect(hasBeenClicked).toBeFalsy()
156
- vm.$el.dispatchEvent(new Event('click'))
157
- expect(hasBeenClicked).toBeTruthy()
158
- })
159
- })
160
-
161
- test('using border', () => {
162
- const vm = mountFromProps({ icon: faCoffee, border: true })
163
-
164
- expect(vm.$el.classList.contains('fa-border')).toBeTruthy()
165
- })
166
-
167
- test('using fixedWidth', () => {
168
- const vm = mountFromProps({ icon: faCoffee, fixedWidth: true })
169
-
170
- expect(vm.$el.classList.contains('fa-fw')).toBeTruthy()
171
- })
172
-
173
- describe('using flip', () => {
174
- test('horizontal', () => {
175
- const vm = mountFromProps({ icon: faCoffee, flip: "horizontal" })
176
-
177
- expect(vm.$el.classList.contains('fa-flip-horizontal')).toBeTruthy()
178
- })
179
-
180
- test('vertical', () => {
181
- const vm = mountFromProps({ icon: faCoffee, flip: "vertical" })
182
-
183
- expect(vm.$el.classList.contains('fa-flip-vertical')).toBeTruthy()
184
- })
185
-
186
- test('both', () => {
187
- const vm = mountFromProps({ icon: faCoffee, flip: "both" })
188
-
189
- expect(vm.$el.classList.contains('fa-flip-horizontal')).toBeTruthy()
190
- expect(vm.$el.classList.contains('fa-flip-vertical')).toBeTruthy()
191
- })
192
- })
193
-
194
- test('using listItem', () => {
195
- const vm = mountFromProps({ icon: faCoffee, listItem: true })
196
-
197
- expect(vm.$el.classList.contains('fa-li')).toBeTruthy()
198
- })
199
-
200
- describe('using pull', () => {
201
- test('right', () => {
202
- const vm = mountFromProps({ icon: faCoffee, pull: "right" })
203
-
204
- expect(vm.$el.classList.contains('fa-pull-right')).toBeTruthy()
205
- })
206
-
207
- test('left', () => {
208
- const vm = mountFromProps({ icon: faCoffee, pull: "left" })
209
-
210
- expect(vm.$el.classList.contains('fa-pull-left')).toBeTruthy()
211
- })
212
- })
213
-
214
- test('using pulse', () => {
215
- const vm = mountFromProps({ icon: faCoffee, pulse: true })
216
-
217
- expect(vm.$el.classList.contains('fa-pulse')).toBeTruthy()
218
- })
219
-
220
- describe('using rotation', () => {
221
- test('90', () => {
222
- const vm = mountFromProps({ icon: faCoffee, rotation: 90 })
223
-
224
- expect(vm.$el.classList.contains('fa-rotate-90')).toBeTruthy()
225
- })
226
-
227
- test('180', () => {
228
- const vm = mountFromProps({ icon: faCoffee, rotation: 180 })
229
-
230
- expect(vm.$el.classList.contains('fa-rotate-180')).toBeTruthy()
231
- })
232
-
233
- test('270', () => {
234
- const vm = mountFromProps({ icon: faCoffee, rotation: 270 })
235
-
236
- expect(vm.$el.classList.contains('fa-rotate-270')).toBeTruthy()
237
- })
238
-
239
- test('as a string', () => {
240
- const vm = mountFromProps({ icon: faCoffee, rotation: '90' })
241
-
242
- expect(vm.$el.classList.contains('fa-rotate-90')).toBeTruthy()
243
- })
244
- })
245
-
246
- test('swap opacity', () => {
247
- const vm = mountFromProps({ icon: faCoffee, swapOpacity: true })
248
-
249
- expect(vm.$el.classList.contains('fa-swap-opacity')).toBeTruthy()
250
- })
251
-
252
- test('using size', () => {
253
- ['2xs', 'xs', 'sm', 'lg', 'xl', '2xl', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x'].forEach(size => {
254
- const vm = mountFromProps({ icon: faCoffee, size: size })
255
-
256
- expect(vm.$el.classList.contains(`fa-${size}`)).toBeTruthy()
257
- })
258
- })
259
-
260
- test('using spin', () => {
261
- const vm = mountFromProps({ icon: faCoffee, spin: true })
262
-
263
- expect(vm.$el.classList.contains('fa-spin')).toBeTruthy()
264
- })
265
-
266
- test('using spinPulse and spinReverse', () => {
267
- const vm = mountFromProps({ icon: faCoffee, spinPulse: true, spinReverse: true })
268
-
269
- expect(vm.$el.classList.contains('fa-spin-pulse')).toBeTruthy()
270
- expect(vm.$el.classList.contains('fa-spin-reverse')).toBeTruthy()
271
- })
272
-
273
- test('using inverse', () => {
274
- const vm = mountFromProps({ icon: faCoffee, inverse: true })
275
-
276
- expect(vm.$el.classList.contains('fa-inverse')).toBeTruthy()
277
- })
278
-
279
- describe('using transform', () => {
280
- test('string', () => {
281
- const vm = mountFromProps({ icon: faCoffee, transform: 'grow-40 left-4 rotate-15' })
282
-
283
- expect(vm.$el).toBeTruthy()
284
- })
285
-
286
- test('object', () => {
287
- const vm = mountFromProps({ icon: faCoffee, transform: { flipX: false, flipY: false, rotate: 15, size: 56, x: -4, y: 0 } })
288
-
289
- expect(vm.$el).toBeTruthy()
290
- })
291
- })
292
-
293
- describe('mask', () => {
294
- test('will add icon', () => {
295
- const vm = mountFromProps({ icon: faCoffee, mask: faCircle })
296
-
297
- expect(vm.$el.innerHTML).toMatch(/clipPath/)
298
- })
299
-
300
- test('will add icon referencing librbary', () => {
301
- const vm = mountFromProps({ icon: ['fas', 'coffee'], mask: ['fas', 'circle'] })
302
- })
303
- })
304
-
305
- describe('symbol', () => {
306
- test("will not create a symbol", () => {
307
- const vm = mountFromProps({ icon: faCoffee })
308
-
309
- expect(vm.$el.style.getPropertyValue('display'))
310
- .toBe('')
311
- })
312
-
313
- test("will create a symbol", () => {
314
- const vm = mountFromProps({ icon: faCoffee, symbol: 'coffee-icon' })
315
-
316
- expect(vm.$el.style.getPropertyValue('display'))
317
- .toBe('none')
318
- expect(vm.$el.children[0].tagName)
319
- .toBe('symbol')
320
- })
321
- })
322
-
323
- describe('title', () => {
324
- test('using title', () => {
325
- const vm = mountFromProps({ icon: faCoffee, title: 'Coffee' })
326
-
327
- expect(vm.$el.getElementsByTagName('title')[0].innerHTML)
328
- .toBe('Coffee')
329
- })
330
-
331
- test('not using title', () => {
332
- const vm = mountFromProps({ icon: faCoffee })
333
-
334
- expect(vm.$el.getElementsByTagName('title').length)
335
- .toBe(0)
336
- })
337
- })
@@ -1,55 +0,0 @@
1
- import Vue from 'vue/dist/vue'
2
- import FontAwesomeLayers from '../FontAwesomeLayers'
3
- import { library } from '@fortawesome/fontawesome-svg-core'
4
- import { faCoffee, faCircle } from '../__fixtures__/icons'
5
- import { compileAndMount, mountFromProps } from '../__fixtures__/helpers'
6
-
7
- beforeEach(() => {
8
- library.add(faCoffee, faCircle)
9
- Vue.component('font-awesome-layers', FontAwesomeLayers)
10
- })
11
-
12
- test('empty layers', () => {
13
- const vm = compileAndMount(
14
- `<font-awesome-layers />`
15
- )
16
-
17
- expect(vm.$el.children.length).toBe(0)
18
- })
19
-
20
- test('empty layers', () => {
21
- const vm = compileAndMount(
22
- `<font-awesome-layers><i /><i /></font-awesome-layers>`
23
- )
24
-
25
- expect(vm.$el.children.length).toBe(2)
26
- })
27
-
28
- describe('class handling', () => {
29
- test('extra static', () => {
30
- const vm = compileAndMount(
31
- `<font-awesome-layers class="extra" />`,
32
- )
33
-
34
- expect(vm.$el.getAttribute('class'))
35
- .toBe('extra fa-layers')
36
- })
37
-
38
- test('extra bound', () => {
39
- const vm = compileAndMount(
40
- `<font-awesome-layers :class="['extra']" />`,
41
- )
42
-
43
- expect(vm.$el.getAttribute('class'))
44
- .toBe('fa-layers extra')
45
- })
46
-
47
- test('fixed width', () => {
48
- const vm = compileAndMount(
49
- `<font-awesome-layers fixed-width />`,
50
- )
51
-
52
- expect(vm.$el.getAttribute('class'))
53
- .toBe('fa-layers fa-fw')
54
- })
55
- })
@@ -1,52 +0,0 @@
1
- import Vue from 'vue/dist/vue'
2
- import FontAwesomeLayersText from '../FontAwesomeLayersText'
3
- import { compileAndMount } from '../__fixtures__/helpers'
4
-
5
- beforeEach(() => {
6
- Vue.component('font-awesome-layers-text', FontAwesomeLayersText)
7
- })
8
-
9
- test('empty', () => {
10
- const vm = compileAndMount('<font-awesome-layers-text />')
11
-
12
- expect(vm.$el.tagName).toBe('SPAN')
13
- })
14
-
15
- test('simple text', () => {
16
- const vm = compileAndMount('<font-awesome-layers-text value="Test" />')
17
-
18
- expect(vm.$el.getAttribute('class')).toBe('fa-layers-text')
19
- expect(vm.$el.innerHTML).toBe('Test')
20
- })
21
-
22
- test('accept number for value', () => {
23
- const vm = compileAndMount('<font-awesome-layers-text :value="42" />')
24
-
25
- expect(vm.$el.getAttribute('class')).toBe('fa-layers-text')
26
- expect(vm.$el.innerHTML).toBe('42')
27
- })
28
-
29
- describe('transform', () => {
30
- test('string', () => {
31
- const vm = compileAndMount('<font-awesome-layers-text value="1" transform="shrink-6" />')
32
-
33
- // It appears the jsdom doesn't set the transform for this, not sure why
34
- expect(vm.$el)
35
- })
36
- })
37
-
38
- describe('counter', () => {
39
- test('simple', () => {
40
- const vm = compileAndMount('<font-awesome-layers-text :value="42" :counter="true" />')
41
-
42
- expect(vm.$el.getAttribute('class')).toBe('fa-layers-counter')
43
- expect(vm.$el.getAttribute('class')).not.toBe('fa-layers-text')
44
- expect(vm.$el.innerHTML).toBe('42')
45
- })
46
-
47
- test('position', () => {
48
- const vm = compileAndMount('<font-awesome-layers-text value="42" counter position="bottom-right" />')
49
-
50
- expect(vm.$el.getAttribute('class')).toBe('fa-layers-counter fa-layers-bottom-right')
51
- })
52
- })