@fortawesome/vue-fontawesome 3.0.0-3 → 3.0.0
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.
- package/CHANGELOG.md +31 -0
- package/README.md +18 -28
- package/index.d.ts +1 -1
- package/index.es.js +366 -247
- package/index.js +651 -532
- package/package.json +46 -23
- package/src/components/FontAwesomeIcon.js +65 -24
- package/src/components/FontAwesomeLayers.js +4 -4
- package/src/components/FontAwesomeLayersText.js +14 -11
- package/src/converter.js +15 -18
- package/src/utils.js +10 -1
- package/.babelrc +0 -3
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -24
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/workflows/ci.yml +0 -29
- package/.tool-versions +0 -2
- package/CODE_OF_CONDUCT.md +0 -74
- package/CONTRIBUTING.md +0 -57
- package/DEVELOPMENT.md +0 -46
- package/bin/dev +0 -3
- package/bin/setup +0 -8
- package/examples/vue-awesome-example/.browserslistrc +0 -3
- package/examples/vue-awesome-example/.editorconfig +0 -7
- package/examples/vue-awesome-example/.eslintrc.js +0 -18
- package/examples/vue-awesome-example/babel.config.js +0 -5
- package/examples/vue-awesome-example/package-lock.json +0 -20468
- package/examples/vue-awesome-example/package.json +0 -38
- package/examples/vue-awesome-example/public/favicon.ico +0 -0
- package/examples/vue-awesome-example/public/index.html +0 -18
- package/examples/vue-awesome-example/src/App.vue +0 -74
- package/examples/vue-awesome-example/src/main.ts +0 -19
- package/examples/vue-awesome-example/src/shims-vue.d.ts +0 -5
- package/examples/vue-awesome-example/tsconfig.json +0 -39
- package/examples/vue-awesome-example/vue.config.js +0 -3
- package/rollup.config.js +0 -55
- package/src/components/__fixtures__/helpers.js +0 -10
- package/src/components/__fixtures__/icons.js +0 -23
- package/src/components/__tests__/FontAwesomeIcon.test.js +0 -285
- package/src/components/__tests__/FontAwesomeLayers.test.js +0 -66
- package/src/components/__tests__/FontAwesomeLayersText.test.js +0 -77
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vue-awesome-example",
|
|
3
|
-
"version": "2.0.0",
|
|
4
|
-
"description": "A vue-awesome example project",
|
|
5
|
-
"private": true,
|
|
6
|
-
"scripts": {
|
|
7
|
-
"serve": "vue-cli-service serve",
|
|
8
|
-
"build": "vue-cli-service build",
|
|
9
|
-
"lint": "vue-cli-service lint"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@fortawesome/fontawesome-svg-core": "^1.2.30",
|
|
13
|
-
"@fortawesome/free-brands-svg-icons": "^5.14.0",
|
|
14
|
-
"@fortawesome/free-regular-svg-icons": "^5.14.0",
|
|
15
|
-
"@fortawesome/free-solid-svg-icons": "^5.14.0",
|
|
16
|
-
"@fortawesome/vue-fontawesome": "file:../..",
|
|
17
|
-
"core-js": "^3.6.5",
|
|
18
|
-
"vue": "^3.0.0-0"
|
|
19
|
-
},
|
|
20
|
-
"devDependencies": {
|
|
21
|
-
"@typescript-eslint/eslint-plugin": "^2.33.0",
|
|
22
|
-
"@typescript-eslint/parser": "^2.33.0",
|
|
23
|
-
"@vue/cli-plugin-babel": "~4.5.0",
|
|
24
|
-
"@vue/cli-plugin-eslint": "~4.5.0",
|
|
25
|
-
"@vue/cli-plugin-typescript": "~4.5.0",
|
|
26
|
-
"@vue/cli-service": "~4.5.0",
|
|
27
|
-
"@vue/compiler-sfc": "^3.0.0-0",
|
|
28
|
-
"@vue/eslint-config-standard": "^5.1.2",
|
|
29
|
-
"@vue/eslint-config-typescript": "^5.0.2",
|
|
30
|
-
"eslint": "^6.7.2",
|
|
31
|
-
"eslint-plugin-import": "^2.20.2",
|
|
32
|
-
"eslint-plugin-node": "^11.1.0",
|
|
33
|
-
"eslint-plugin-promise": "^4.2.1",
|
|
34
|
-
"eslint-plugin-standard": "^4.0.0",
|
|
35
|
-
"eslint-plugin-vue": "^7.0.0-0",
|
|
36
|
-
"typescript": "~3.9.3"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
Binary file
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
-
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
7
|
-
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
|
8
|
-
<link href="https://static.fontawesome.com/css/fontawesome-app.css" rel="stylesheet">
|
|
9
|
-
<title><%= htmlWebpackPlugin.options.title %></title>
|
|
10
|
-
</head>
|
|
11
|
-
<body>
|
|
12
|
-
<noscript>
|
|
13
|
-
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
|
14
|
-
</noscript>
|
|
15
|
-
<div id="app"></div>
|
|
16
|
-
<!-- built files will be auto injected -->
|
|
17
|
-
</body>
|
|
18
|
-
</html>
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div id="app">
|
|
3
|
-
<main class="w-100 min-vh-100 bg-gray8 white sans-serif pa6 flex flex-column justify-center items-center">
|
|
4
|
-
<div class="mw8 center overflow-hidden">
|
|
5
|
-
<h2 class="tc ttu tracked3 b f2 mt0 mb2 teal0 o-30">vue-fontawesome</h2>
|
|
6
|
-
|
|
7
|
-
<ul class="list ma0 pa0 flex flex-row flex-wrap teal4">
|
|
8
|
-
<li class="pv3 ph2 ma0 link grow">
|
|
9
|
-
<font-awesome-icon icon="coffee" size="4x" />
|
|
10
|
-
</li>
|
|
11
|
-
<li class="pv3 ph2 ma0 link grow">
|
|
12
|
-
<font-awesome-icon :icon="['fas', 'coffee']" flip="horizontal" size="4x" />
|
|
13
|
-
</li>
|
|
14
|
-
<li class="pv3 ph2 ma0 link grow">
|
|
15
|
-
<font-awesome-icon :icon="['far', 'comment']" size="4x" />
|
|
16
|
-
</li>
|
|
17
|
-
<li class="pv3 ph2 ma0 link grow">
|
|
18
|
-
<font-awesome-icon icon="child" transform="shrink-4 down-2 right-2" :mask="['fas', 'circle']" size="4x" />
|
|
19
|
-
</li>
|
|
20
|
-
<li class="pv3 ph2 ma0 link grow">
|
|
21
|
-
<font-awesome-icon :icon="['fab', 'twitter']" size="4x" />
|
|
22
|
-
</li>
|
|
23
|
-
<li class="pv3 ph2 ma0 link grow">
|
|
24
|
-
<font-awesome-icon :icon="queen" size="4x" />
|
|
25
|
-
</li>
|
|
26
|
-
<li class="pv3 ph2 ma0 link grow">
|
|
27
|
-
<font-awesome-icon :icon="queen" size="4x" inverse/>
|
|
28
|
-
</li>
|
|
29
|
-
<li class="pv3 ph2 ma0 link grow">
|
|
30
|
-
<font-awesome-layers full-width class="fa-4x">
|
|
31
|
-
<font-awesome-icon :icon="['fas', 'archive']"/>
|
|
32
|
-
<font-awesome-layers-text class="red8" transform="down-3 shrink-14" value="SECRET" />
|
|
33
|
-
</font-awesome-layers>
|
|
34
|
-
</li>
|
|
35
|
-
<li class="pv3 ph2 ma0 link grow">
|
|
36
|
-
<font-awesome-layers full-width class="fa-4x">
|
|
37
|
-
<font-awesome-icon :icon="['fas', 'envelope']"/>
|
|
38
|
-
<font-awesome-layers-text class="red8" value="1" position="top-right" />
|
|
39
|
-
</font-awesome-layers>
|
|
40
|
-
</li>
|
|
41
|
-
</ul>
|
|
42
|
-
</div>
|
|
43
|
-
</main>
|
|
44
|
-
</div>
|
|
45
|
-
</template>
|
|
46
|
-
|
|
47
|
-
<script lang="ts">
|
|
48
|
-
import { computed, defineComponent } from 'vue'
|
|
49
|
-
import { faChessQueen } from '@fortawesome/free-solid-svg-icons'
|
|
50
|
-
import { FontAwesomeIcon, FontAwesomeLayers, FontAwesomeLayersText } from '@fortawesome/vue-fontawesome'
|
|
51
|
-
|
|
52
|
-
export default defineComponent({
|
|
53
|
-
name: 'App',
|
|
54
|
-
|
|
55
|
-
setup () {
|
|
56
|
-
const queen = computed(() => faChessQueen)
|
|
57
|
-
|
|
58
|
-
return { queen }
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
components: {
|
|
62
|
-
FontAwesomeIcon,
|
|
63
|
-
FontAwesomeLayers,
|
|
64
|
-
FontAwesomeLayersText
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
</script>
|
|
68
|
-
|
|
69
|
-
<style>
|
|
70
|
-
body {
|
|
71
|
-
margin: 0;
|
|
72
|
-
padding: 0;
|
|
73
|
-
}
|
|
74
|
-
</style>
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { createApp } from 'vue'
|
|
2
|
-
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
3
|
-
import { faCoffee, faChild, faCircle, faArchive, faEnvelope } from '@fortawesome/free-solid-svg-icons'
|
|
4
|
-
import { faComment } from '@fortawesome/free-regular-svg-icons'
|
|
5
|
-
import { faTwitter } from '@fortawesome/free-brands-svg-icons'
|
|
6
|
-
import App from './App.vue'
|
|
7
|
-
|
|
8
|
-
library.add(
|
|
9
|
-
faCoffee,
|
|
10
|
-
faChild,
|
|
11
|
-
faCircle,
|
|
12
|
-
faArchive,
|
|
13
|
-
faEnvelope,
|
|
14
|
-
faComment,
|
|
15
|
-
faTwitter
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
createApp(App).mount('#app')
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "esnext",
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"strict": true,
|
|
6
|
-
"jsx": "preserve",
|
|
7
|
-
"importHelpers": true,
|
|
8
|
-
"moduleResolution": "node",
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"allowSyntheticDefaultImports": true,
|
|
12
|
-
"sourceMap": true,
|
|
13
|
-
"baseUrl": ".",
|
|
14
|
-
"types": [
|
|
15
|
-
"webpack-env"
|
|
16
|
-
],
|
|
17
|
-
"paths": {
|
|
18
|
-
"@/*": [
|
|
19
|
-
"src/*"
|
|
20
|
-
]
|
|
21
|
-
},
|
|
22
|
-
"lib": [
|
|
23
|
-
"esnext",
|
|
24
|
-
"dom",
|
|
25
|
-
"dom.iterable",
|
|
26
|
-
"scripthost"
|
|
27
|
-
]
|
|
28
|
-
},
|
|
29
|
-
"include": [
|
|
30
|
-
"src/**/*.ts",
|
|
31
|
-
"src/**/*.tsx",
|
|
32
|
-
"src/**/*.vue",
|
|
33
|
-
"tests/**/*.ts",
|
|
34
|
-
"tests/**/*.tsx"
|
|
35
|
-
],
|
|
36
|
-
"exclude": [
|
|
37
|
-
"node_modules"
|
|
38
|
-
]
|
|
39
|
-
}
|
package/rollup.config.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import resolve from 'rollup-plugin-node-resolve'
|
|
2
|
-
import commonJs from 'rollup-plugin-commonjs'
|
|
3
|
-
import babel from 'rollup-plugin-babel'
|
|
4
|
-
|
|
5
|
-
const name = 'vue-fontawesome'
|
|
6
|
-
const globals = {
|
|
7
|
-
'@fortawesome/fontawesome-svg-core': 'FontAwesome'
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default {
|
|
11
|
-
external: [
|
|
12
|
-
'@fortawesome/fontawesome-svg-core',
|
|
13
|
-
'vue',
|
|
14
|
-
],
|
|
15
|
-
input: 'src/index.js',
|
|
16
|
-
output: [
|
|
17
|
-
{
|
|
18
|
-
name,
|
|
19
|
-
globals,
|
|
20
|
-
format: 'umd',
|
|
21
|
-
exports: 'named',
|
|
22
|
-
file: 'index.js',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
name,
|
|
26
|
-
globals,
|
|
27
|
-
format: 'es',
|
|
28
|
-
file: 'index.es.js'
|
|
29
|
-
}
|
|
30
|
-
],
|
|
31
|
-
plugins: [
|
|
32
|
-
resolve({
|
|
33
|
-
jsnext: true,
|
|
34
|
-
main: true
|
|
35
|
-
}),
|
|
36
|
-
commonJs({
|
|
37
|
-
include: 'node_modules/**'
|
|
38
|
-
}),
|
|
39
|
-
babel({
|
|
40
|
-
babelrc: false,
|
|
41
|
-
presets: [
|
|
42
|
-
['env', {
|
|
43
|
-
debug: true,
|
|
44
|
-
targets: {"browsers": ["> 1%", "last 2 versions", "ie > 9"]},
|
|
45
|
-
modules: false
|
|
46
|
-
}],
|
|
47
|
-
'stage-3'
|
|
48
|
-
],
|
|
49
|
-
plugins: [
|
|
50
|
-
'external-helpers'
|
|
51
|
-
],
|
|
52
|
-
exclude: 'node_modules/**'
|
|
53
|
-
})
|
|
54
|
-
]
|
|
55
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { mount } from '@vue/test-utils'
|
|
2
|
-
import FontAwesomeIcon from '../FontAwesomeIcon'
|
|
3
|
-
|
|
4
|
-
export function compileAndMount (definition, props = {}) {
|
|
5
|
-
return mount(definition, { props })
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function mountFromProps (props = {}) {
|
|
9
|
-
return mount(FontAwesomeIcon, { props })
|
|
10
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export const faCoffee = {
|
|
2
|
-
prefix: 'fas',
|
|
3
|
-
iconName: 'coffee',
|
|
4
|
-
icon: [
|
|
5
|
-
640,
|
|
6
|
-
512,
|
|
7
|
-
[],
|
|
8
|
-
"f001",
|
|
9
|
-
"..."
|
|
10
|
-
]
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const faCircle = {
|
|
14
|
-
prefix: 'fas',
|
|
15
|
-
iconName: 'circle',
|
|
16
|
-
icon: [
|
|
17
|
-
640,
|
|
18
|
-
512,
|
|
19
|
-
[],
|
|
20
|
-
"f002",
|
|
21
|
-
"..."
|
|
22
|
-
]
|
|
23
|
-
}
|
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
2
|
-
import { faCoffee, faCircle } from '../__fixtures__/icons'
|
|
3
|
-
import { compileAndMount, mountFromProps } from '../__fixtures__/helpers'
|
|
4
|
-
import FontAwesomeIcon from '../FontAwesomeIcon'
|
|
5
|
-
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
library.add(faCoffee, faCircle)
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
test('using array format', () => {
|
|
11
|
-
const wrapper = mountFromProps({ icon: ['fas', 'coffee'] })
|
|
12
|
-
|
|
13
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
14
|
-
expect(wrapper.element.classList.contains('fa-coffee')).toBeTruthy()
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
test('using string format', () => {
|
|
18
|
-
const wrapper = mountFromProps({ icon: 'coffee' })
|
|
19
|
-
|
|
20
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
21
|
-
expect(wrapper.element.classList.contains('fa-coffee')).toBeTruthy()
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
test('missing icon', () => {
|
|
25
|
-
const wrapper = mountFromProps({ icon: ['fas', 'noicon'] })
|
|
26
|
-
|
|
27
|
-
expect(wrapper.element.tagName).toBeFalsy()
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
test('using iconDefinition', () => {
|
|
31
|
-
const wrapper = mountFromProps({ icon: faCoffee })
|
|
32
|
-
|
|
33
|
-
expect(wrapper.element.tagName).toBe('svg')
|
|
34
|
-
expect(wrapper.element.classList.contains('fa-coffee')).toBeTruthy()
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
describe('unrelated Vue data options', () => {
|
|
38
|
-
test('with extra static class', () => {
|
|
39
|
-
const wrapper = compileAndMount({
|
|
40
|
-
template: '<font-awesome-icon class="extra" :icon="icon" />',
|
|
41
|
-
data () {
|
|
42
|
-
return { icon: faCoffee }
|
|
43
|
-
},
|
|
44
|
-
components: {
|
|
45
|
-
FontAwesomeIcon
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
expect(wrapper.element.classList.contains('extra')).toBeTruthy()
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
test('with extra bound class', () => {
|
|
53
|
-
const wrapper = compileAndMount({
|
|
54
|
-
template: `<font-awesome-icon :class="['extra1', {'extra2': true}]" :icon="icon" />`,
|
|
55
|
-
data() {
|
|
56
|
-
return { icon: faCoffee }
|
|
57
|
-
},
|
|
58
|
-
components: {
|
|
59
|
-
FontAwesomeIcon
|
|
60
|
-
}
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
expect(wrapper.element.classList.contains('extra1')).toBeTruthy()
|
|
64
|
-
expect(wrapper.element.classList.contains('extra2')).toBeTruthy()
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
test('with extra style', () => {
|
|
68
|
-
const wrapper = compileAndMount({
|
|
69
|
-
template: `<font-awesome-icon :style="{'font-size': '42px'}" :icon="icon" />`,
|
|
70
|
-
data () {
|
|
71
|
-
return { icon: faCoffee }
|
|
72
|
-
},
|
|
73
|
-
components: {
|
|
74
|
-
FontAwesomeIcon
|
|
75
|
-
}
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
expect(wrapper.element.style.getPropertyValue('font-size')).toBe('42px')
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
test('with extra DOM property', () => {
|
|
82
|
-
const wrapper = compileAndMount({
|
|
83
|
-
template: `<font-awesome-icon rel="local" :icon="icon" />`,
|
|
84
|
-
data () {
|
|
85
|
-
return { icon: faCoffee }
|
|
86
|
-
},
|
|
87
|
-
components: {
|
|
88
|
-
FontAwesomeIcon
|
|
89
|
-
}
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
expect(wrapper.element.getAttribute('rel')).toBe('local')
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
test('with listener', async () => {
|
|
96
|
-
let hasBeenClicked = false
|
|
97
|
-
|
|
98
|
-
const wrapper = compileAndMount({
|
|
99
|
-
template: '<font-awesome-icon @click="clicked" :icon="icon" />',
|
|
100
|
-
data () {
|
|
101
|
-
return { icon: faCoffee }
|
|
102
|
-
},
|
|
103
|
-
methods: {
|
|
104
|
-
clicked () {
|
|
105
|
-
hasBeenClicked = true
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
components: {
|
|
109
|
-
FontAwesomeIcon
|
|
110
|
-
}
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
expect(hasBeenClicked).toBeFalsy()
|
|
114
|
-
await wrapper.trigger('click')
|
|
115
|
-
expect(hasBeenClicked).toBeTruthy()
|
|
116
|
-
})
|
|
117
|
-
})
|
|
118
|
-
|
|
119
|
-
test('using border', () => {
|
|
120
|
-
const wrapper = mountFromProps({ icon: faCoffee, border: true })
|
|
121
|
-
|
|
122
|
-
expect(wrapper.element.classList.contains('fa-border')).toBeTruthy()
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
test('using fixedWidth', () => {
|
|
126
|
-
const wrapper = mountFromProps({ icon: faCoffee, fixedWidth: true })
|
|
127
|
-
|
|
128
|
-
expect(wrapper.element.classList.contains('fa-fw')).toBeTruthy()
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
describe('using flip', () => {
|
|
132
|
-
test('horizontal', () => {
|
|
133
|
-
const wrapper = mountFromProps({ icon: faCoffee, flip: "horizontal" })
|
|
134
|
-
|
|
135
|
-
expect(wrapper.element.classList.contains('fa-flip-horizontal')).toBeTruthy()
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
test('vertical', () => {
|
|
139
|
-
const wrapper = mountFromProps({ icon: faCoffee, flip: "vertical" })
|
|
140
|
-
|
|
141
|
-
expect(wrapper.element.classList.contains('fa-flip-vertical')).toBeTruthy()
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
test('both', () => {
|
|
145
|
-
const wrapper = mountFromProps({ icon: faCoffee, flip: "both" })
|
|
146
|
-
|
|
147
|
-
expect(wrapper.element.classList.contains('fa-flip-horizontal')).toBeTruthy()
|
|
148
|
-
expect(wrapper.element.classList.contains('fa-flip-vertical')).toBeTruthy()
|
|
149
|
-
})
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
test('using listItem', () => {
|
|
153
|
-
const wrapper = mountFromProps({ icon: faCoffee, listItem: true })
|
|
154
|
-
|
|
155
|
-
expect(wrapper.element.classList.contains('fa-li')).toBeTruthy()
|
|
156
|
-
})
|
|
157
|
-
|
|
158
|
-
describe('using pull', () => {
|
|
159
|
-
test('right', () => {
|
|
160
|
-
const wrapper = mountFromProps({ icon: faCoffee, pull: "right" })
|
|
161
|
-
|
|
162
|
-
expect(wrapper.element.classList.contains('fa-pull-right')).toBeTruthy()
|
|
163
|
-
})
|
|
164
|
-
|
|
165
|
-
test('left', () => {
|
|
166
|
-
const wrapper = mountFromProps({ icon: faCoffee, pull: "left" })
|
|
167
|
-
|
|
168
|
-
expect(wrapper.element.classList.contains('fa-pull-left')).toBeTruthy()
|
|
169
|
-
})
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
test('using pulse', () => {
|
|
173
|
-
const wrapper = mountFromProps({ icon: faCoffee, pulse: true })
|
|
174
|
-
|
|
175
|
-
expect(wrapper.element.classList.contains('fa-pulse')).toBeTruthy()
|
|
176
|
-
})
|
|
177
|
-
|
|
178
|
-
describe('using rotation', () => {
|
|
179
|
-
test('90', () => {
|
|
180
|
-
const wrapper = mountFromProps({ icon: faCoffee, rotation: 90 })
|
|
181
|
-
|
|
182
|
-
expect(wrapper.element.classList.contains('fa-rotate-90')).toBeTruthy()
|
|
183
|
-
})
|
|
184
|
-
|
|
185
|
-
test('180', () => {
|
|
186
|
-
const wrapper = mountFromProps({ icon: faCoffee, rotation: 180 })
|
|
187
|
-
|
|
188
|
-
expect(wrapper.element.classList.contains('fa-rotate-180')).toBeTruthy()
|
|
189
|
-
})
|
|
190
|
-
|
|
191
|
-
test('270', () => {
|
|
192
|
-
const wrapper = mountFromProps({ icon: faCoffee, rotation: 270 })
|
|
193
|
-
|
|
194
|
-
expect(wrapper.element.classList.contains('fa-rotate-270')).toBeTruthy()
|
|
195
|
-
})
|
|
196
|
-
|
|
197
|
-
test('as a string', () => {
|
|
198
|
-
const wrapper = mountFromProps({ icon: faCoffee, rotation: '90' })
|
|
199
|
-
|
|
200
|
-
expect(wrapper.element.classList.contains('fa-rotate-90')).toBeTruthy()
|
|
201
|
-
})
|
|
202
|
-
})
|
|
203
|
-
|
|
204
|
-
test('swap opacity', () => {
|
|
205
|
-
const wrapper = mountFromProps({ icon: faCoffee, swapOpacity: true })
|
|
206
|
-
|
|
207
|
-
expect(wrapper.element.classList.contains('fa-swap-opacity')).toBeTruthy()
|
|
208
|
-
})
|
|
209
|
-
|
|
210
|
-
test('using size', () => {
|
|
211
|
-
['lg', 'xs', 'sm', '1x', '2x', '3x', '4x', '5x', '6x', '7x', '8x', '9x', '10x'].forEach(size => {
|
|
212
|
-
const wrapper = mountFromProps({ icon: faCoffee, size: size })
|
|
213
|
-
|
|
214
|
-
expect(wrapper.element.classList.contains(`fa-${size}`)).toBeTruthy()
|
|
215
|
-
})
|
|
216
|
-
})
|
|
217
|
-
|
|
218
|
-
test('using spin', () => {
|
|
219
|
-
const wrapper = mountFromProps({ icon: faCoffee, spin: true })
|
|
220
|
-
|
|
221
|
-
expect(wrapper.element.classList.contains('fa-spin')).toBeTruthy()
|
|
222
|
-
})
|
|
223
|
-
|
|
224
|
-
test('using inverse', () => {
|
|
225
|
-
const wrapper = mountFromProps({ icon: faCoffee, inverse: true })
|
|
226
|
-
|
|
227
|
-
expect(wrapper.element.classList.contains('fa-inverse')).toBeTruthy()
|
|
228
|
-
})
|
|
229
|
-
|
|
230
|
-
describe('using transform', () => {
|
|
231
|
-
test('string', () => {
|
|
232
|
-
const wrapper = mountFromProps({ icon: faCoffee, transform: 'grow-40 left-4 rotate-15' })
|
|
233
|
-
|
|
234
|
-
expect(wrapper.element).toBeTruthy()
|
|
235
|
-
})
|
|
236
|
-
|
|
237
|
-
test('object', () => {
|
|
238
|
-
const wrapper = mountFromProps({ icon: faCoffee, transform: { flipX: false, flipY: false, rotate: 15, size: 56, x: -4, y: 0 } })
|
|
239
|
-
|
|
240
|
-
expect(wrapper.element).toBeTruthy()
|
|
241
|
-
})
|
|
242
|
-
})
|
|
243
|
-
|
|
244
|
-
describe('mask', () => {
|
|
245
|
-
test('will add icon', () => {
|
|
246
|
-
const wrapper = mountFromProps({ icon: faCoffee, mask: faCircle })
|
|
247
|
-
|
|
248
|
-
expect(wrapper.element.innerHTML).toMatch(/clipPath/)
|
|
249
|
-
})
|
|
250
|
-
|
|
251
|
-
test('will add icon referencing library', () => {
|
|
252
|
-
const wrapper = mountFromProps({ icon: ['fas', 'coffee'], mask: ['fas', 'circle'] })
|
|
253
|
-
|
|
254
|
-
// missing assertion here
|
|
255
|
-
})
|
|
256
|
-
})
|
|
257
|
-
|
|
258
|
-
describe('symbol', () => {
|
|
259
|
-
test("will not create a symbol", () => {
|
|
260
|
-
const wrapper = mountFromProps({ icon: faCoffee })
|
|
261
|
-
|
|
262
|
-
expect(wrapper.element.style.getPropertyValue('display')).toBe('')
|
|
263
|
-
})
|
|
264
|
-
|
|
265
|
-
test("will create a symbol", () => {
|
|
266
|
-
const wrapper = mountFromProps({ icon: faCoffee, symbol: 'coffee-icon' })
|
|
267
|
-
|
|
268
|
-
expect(wrapper.element.style.getPropertyValue('display')).toBe('none')
|
|
269
|
-
expect(wrapper.element.children[0].tagName).toBe('symbol')
|
|
270
|
-
})
|
|
271
|
-
})
|
|
272
|
-
|
|
273
|
-
describe('title', () => {
|
|
274
|
-
test('using title', () => {
|
|
275
|
-
const wrapper = mountFromProps({ icon: faCoffee, title: 'Coffee' })
|
|
276
|
-
|
|
277
|
-
expect(wrapper.element.getElementsByTagName('title')[0].innerHTML).toBe('Coffee')
|
|
278
|
-
})
|
|
279
|
-
|
|
280
|
-
test('not using title', () => {
|
|
281
|
-
const wrapper = mountFromProps({ icon: faCoffee })
|
|
282
|
-
|
|
283
|
-
expect(wrapper.element.getElementsByTagName('title').length).toBe(0)
|
|
284
|
-
})
|
|
285
|
-
})
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
2
|
-
import { faCoffee, faCircle } from '../__fixtures__/icons'
|
|
3
|
-
import { compileAndMount, mountFromProps } from '../__fixtures__/helpers'
|
|
4
|
-
import FontAwesomeLayers from '../FontAwesomeLayers'
|
|
5
|
-
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
library.add(faCoffee, faCircle)
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
test('empty layers', () => {
|
|
11
|
-
const wrapper = compileAndMount({
|
|
12
|
-
template: '<font-awesome-layers />',
|
|
13
|
-
components: {
|
|
14
|
-
FontAwesomeLayers
|
|
15
|
-
}
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
expect(wrapper.element.children.length).toBe(0)
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
test('empty layers', () => {
|
|
22
|
-
const wrapper = compileAndMount({
|
|
23
|
-
template: '<font-awesome-layers><i /><i /></font-awesome-layers>',
|
|
24
|
-
components: {
|
|
25
|
-
FontAwesomeLayers
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
expect(wrapper.element.children.length).toBe(2)
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
describe('class handling', () => {
|
|
33
|
-
test('extra static', () => {
|
|
34
|
-
const wrapper = compileAndMount({
|
|
35
|
-
template: '<font-awesome-layers class="extra" />',
|
|
36
|
-
components: {
|
|
37
|
-
FontAwesomeLayers
|
|
38
|
-
}
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
expect(wrapper.element.classList.contains('extra')).toBeTruthy()
|
|
42
|
-
expect(wrapper.element.classList.contains('fa-layers')).toBeTruthy()
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
test('extra bound', () => {
|
|
46
|
-
const wrapper = compileAndMount({
|
|
47
|
-
template: `<font-awesome-layers :class="['extra']" />`,
|
|
48
|
-
components: {
|
|
49
|
-
FontAwesomeLayers
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
expect(wrapper.element.getAttribute('class')).toBe('fa-layers extra')
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
test('fixed width', () => {
|
|
57
|
-
const wrapper = compileAndMount({
|
|
58
|
-
template: '<font-awesome-layers fixed-width />',
|
|
59
|
-
components: {
|
|
60
|
-
FontAwesomeLayers
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
expect(wrapper.element.getAttribute('class')).toBe('fa-layers fa-fw')
|
|
65
|
-
})
|
|
66
|
-
})
|