bulky-sundown-74498
05/03/2021, 9:03 PMbulky-sundown-74498
05/05/2021, 3:31 AMbulky-sundown-74498
05/05/2021, 3:32 AMbulky-sundown-74498
05/05/2021, 3:32 AMsome-air-72294
05/07/2021, 8:07 PM@nuxt/fontawesome
doesn't have FontAwesomeIcon
but it uses @fortawesome/vue-fontawesome
so the following seems to work. import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
That lead to me getting a error that could not find one or more icons {prefix: "fas", iconName: "filter"}
which lead me to think i should use import { faFilter } from '@fortawesome/free-solid-svg-icons'
and then pass faFilter
to stubs as key/value. But that results in error options.sutb values must be passed a string or component
. I'm not sure what I need to send and i'm not sure how i should go about figuring that out.stocky-dream-36427
05/07/2021, 9:37 PMfaFilter
is an svg. What you really want to do is register the FontAwesome plugin with Vue.stocky-dream-36427
05/07/2021, 9:42 PMstocky-dream-36427
05/07/2021, 9:42 PMstocky-dream-36427
05/07/2021, 9:43 PMstocky-dream-36427
05/07/2021, 9:43 PMsome-air-72294
05/10/2021, 1:48 PMimport { mount } from '@cypress/vue'
import { BButton } from 'bootstrap-vue'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import { library } from '@fortawesome/fontawesome-svg-core'
import { fas } from '@fortawesome/free-solid-svg-icons'
import { fab } from '@fortawesome/free-brands-svg-icons'
import Button from './Button.vue'
library.add(fas)
library.add(fab)
const stubs = {
// used to register custom or third-party components
'b-btn': BButton,
'font-awesome-icon': FontAwesomeIcon,
}
stocky-dream-36427
05/10/2021, 5:21 PMstocky-dream-36427
05/10/2021, 5:22 PMstocky-dream-36427
05/10/2021, 5:22 PM@cypress/vue
you would grab your own. Then you don't need to write the stubs at the beginning of each teststocky-dream-36427
05/10/2021, 5:25 PMjs
// support.js within cypress.json's supportFile
import { mount: cyMount } from '@cypress/mount'
Cypress.Commands.add('mount', (options) => {
const globalOptions = { stubs: { /* your stubs */ } }
return cyMount({ ...globalOptions, ...options})
})
// MyComponent.spec.js
const MyComponent = {
template: '<h1>Hello World</h1>'
}
it('renders', () => {
cy.mount(MyComponent).get('h1').should('contain', 'Hello World')
})
stocky-dream-36427
05/10/2021, 5:27 PMsome-air-72294
05/13/2021, 9:29 PM<div v-else-if="buttonType === 'popover'">
<b-btn
id="showHideColContainer"
ref="button"
class="tst-btn-group"
variant="primary"
@click="
(e) => {
e.target.blur()
}
"
>
{{ title }}
</b-btn>
<b-popover
ref="popover"
target="showHideColContainer"
triggers="click"
:show.sync="selectHiddenCol"
placement="auto"
container="my-container"
@show="() => {}"
>
<template slot="title">
<b-button
class="close"
aria-label="Close"
@click="selectHiddenCol = false"
>
<span class="d-inline-block" aria-hidden="true">×</span>
</b-button>
{{ title }}
</template>
<div style="max-height: 150px; overflow: auto">
<div v-for="(field, index) in fields" :key="index">
<b-form-checkbox
v-if="field.label !== '*'"
v-model="field.hide"
style="margin-left: 10px; width: 150px"
>
{{ field.label }}
</b-form-checkbox>
</div>
</div>
<b-button size="sm" variant="primary" @click="selectHiddenCol = false"
>Ok</b-button
>
</b-popover>
</div>
My test:
it('renders button with popover', () => {
const fields = [
{ label: 'id', hide: true },
{ label: 'name', hide: false },
{ label: 'date', hide: true },
]
shallowMount(Button, {
stubs,
propsData: { buttonType: 'popover', fields, title: 'Hidden Columns' },
})
cy.get('button').should('include.text', 'Hidden')
cy.get('button').click()
cy.get('.popover').find('label').should('have.length', 3))
})
some-air-72294
05/13/2021, 9:29 PMunknown custom element b-button
)some-air-72294
05/13/2021, 9:31 PMsome-air-72294
05/13/2021, 10:17 PMstocky-dream-36427
05/13/2021, 10:20 PM{ components: { 'b-button': BootstrapButton } }
) it doesn't know what components are availablesome-air-72294
05/13/2021, 10:21 PMstocky-dream-36427
05/13/2021, 10:21 PMstocky-dream-36427
05/13/2021, 10:22 PMcreateApp
(or new Vue()
)some-air-72294
05/13/2021, 10:23 PMstocky-dream-36427
05/13/2021, 10:23 PMsome-air-72294
05/13/2021, 10:23 PMstocky-dream-36427
05/13/2021, 10:23 PMstocky-dream-36427
05/13/2021, 10:23 PM