@fortawesome/vue-fontawesome
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -13,2 +13,9 @@ # Change Log | ||
## [2.0.3](https://github.com/FortAwesome/vue-fontawesome/releases/tag/2.0.3) - 2021-10-15 | ||
### Fixed | ||
* Skip parse.icon if the icon is imported directly from an icon package | ||
--- | ||
## [2.0.2](https://github.com/FortAwesome/vue-fontawesome/releases/tag/2.0.2) - 2020-12-17 | ||
@@ -15,0 +22,0 @@ |
@@ -331,2 +331,8 @@ import { parse, icon, config, text } from '@fortawesome/fontawesome-svg-core'; | ||
function normalizeIconArgs(icon$$1) { | ||
// this has everything that it needs to be rendered which means it was probably imported | ||
// directly from an icon svg package | ||
if (icon$$1 && (typeof icon$$1 === 'undefined' ? 'undefined' : _typeof(icon$$1)) === 'object' && icon$$1.prefix && icon$$1.iconName && icon$$1.icon) { | ||
return icon$$1; | ||
} | ||
if (parse.icon) { | ||
@@ -333,0 +339,0 @@ return parse.icon(icon$$1); |
@@ -335,2 +335,8 @@ (function (global, factory) { | ||
function normalizeIconArgs(icon) { | ||
// this has everything that it needs to be rendered which means it was probably imported | ||
// directly from an icon svg package | ||
if (icon && (typeof icon === 'undefined' ? 'undefined' : _typeof(icon)) === 'object' && icon.prefix && icon.iconName && icon.icon) { | ||
return icon; | ||
} | ||
if (fontawesomeSvgCore.parse.icon) { | ||
@@ -337,0 +343,0 @@ return fontawesomeSvgCore.parse.icon(icon); |
{ | ||
"name": "@fortawesome/vue-fontawesome", | ||
"description": "Official Vue component for Font Awesome 5", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "module": "index.es.js", |
@@ -24,3 +24,2 @@ <a href="https://fontawesome.com"> | ||
- [Introduction](#introduction) | ||
* [CodeSandbox Starter Sample 🚀](#codesandbox-starter-sample-%F0%9F%9A%80) | ||
* [Upgrading Font Awesome?](#upgrading-font-awesome) | ||
@@ -73,6 +72,2 @@ * [Get started](#get-started) | ||
### CodeSandbox Starter Sample 🚀 | ||
Here's a [CodeSandbox Starter Sample](https://codesandbox.io/s/github/FortAwesome/vue-fontawesome/tree/master/examples/vue-cli-webpack) on how to display Solid, Regular, and Brand icons [using the Icon Library](https://github.com/FortAwesome/vue-fontawesome#usage). | ||
### Upgrading Font Awesome? | ||
@@ -79,0 +74,0 @@ |
@@ -33,3 +33,3 @@ import Vue from 'vue/dist/vue' | ||
export function coreHasFeature (feature) { | ||
if (feature === REFERENCE_ICON_BY_STYLE || feature === ICON_ALIASES) { | ||
if (feature === REFERENCE_ICON_BY_STYLE || feature === ICON_ALIASES || feature === REFERENCE_ICON_USING_STRING) { | ||
return parse.icon | ||
@@ -40,2 +40,3 @@ } | ||
export const REFERENCE_ICON_BY_STYLE = 0x00 | ||
export const ICON_ALIASES = 0x01 | ||
export const ICON_ALIASES = 0x01 | ||
export const REFERENCE_ICON_USING_STRING = 0x02 |
import Vue from 'vue/dist/vue' | ||
import FontAwesomeIcon from '../FontAwesomeIcon' | ||
import { library } from '@fortawesome/fontawesome-svg-core' | ||
import { faClose } from '@fortawesome/free-solid-svg-icons' | ||
import { faClose, faUser } from '@fortawesome/free-solid-svg-icons' | ||
import { faCoffee, faCircle, faSpartan } from '../__fixtures__/icons' | ||
import { coreHasFeature, REFERENCE_ICON_BY_STYLE, ICON_ALIASES, compileAndMount, mountFromProps } from '../__fixtures__/helpers' | ||
import { coreHasFeature, REFERENCE_ICON_USING_STRING, REFERENCE_ICON_BY_STYLE, ICON_ALIASES, compileAndMount, mountFromProps } from '../__fixtures__/helpers' | ||
@@ -13,2 +13,6 @@ beforeEach(() => { | ||
afterEach(() => { | ||
library.reset() | ||
}) | ||
test('using a FAT icon with array format', () => { | ||
@@ -31,3 +35,3 @@ const vm = mountFromProps({ icon: ['fat', 'spartan'] }) | ||
test('find a free-solid-svg-icon that is an alias ', () => { | ||
test('find a free-solid-svg-icon that is an alias', () => { | ||
library.reset() | ||
@@ -42,2 +46,18 @@ library.add(faClose) | ||
if(coreHasFeature(REFERENCE_ICON_USING_STRING)) { | ||
test('find an icon using string format', () => { | ||
const vm = mountFromProps({ icon: 'fa-coffee' }) | ||
expect(vm.$el.tagName).toBe('svg') | ||
expect(vm.$el.classList.contains('fa-coffee')).toBeTruthy() | ||
}) | ||
test('find an icon using string format with style', () => { | ||
const vm = mountFromProps({ icon: 'fa-solid fa-coffee' }) | ||
expect(vm.$el.tagName).toBe('svg') | ||
expect(vm.$el.classList.contains('fa-coffee')).toBeTruthy() | ||
}) | ||
} | ||
if (coreHasFeature(REFERENCE_ICON_BY_STYLE)) { | ||
@@ -73,2 +93,8 @@ test('find a THIN icon with array format', () => { | ||
test.only('using imported object from svg icons package', () => { | ||
const vm = mountFromProps({ icon: faUser }) | ||
expect(vm.$el.tagName).toBe('svg') | ||
}) | ||
test('missing icon', () => { | ||
@@ -75,0 +101,0 @@ const vm = mountFromProps({ icon: ['fas', 'noicon'] }) |
@@ -7,2 +7,8 @@ import { parse as faParse, icon as faIcon } from '@fortawesome/fontawesome-svg-core' | ||
function normalizeIconArgs (icon) { | ||
// this has everything that it needs to be rendered which means it was probably imported | ||
// directly from an icon svg package | ||
if (icon && typeof icon === 'object' && icon.prefix && icon.iconName && icon.icon) { | ||
return icon | ||
} | ||
if (faParse.icon) { | ||
@@ -9,0 +15,0 @@ return faParse.icon(icon) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
560164
13911
869