-
Notifications
You must be signed in to change notification settings - Fork 112
FireEvent not getting resolved #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi! if you I tried to replicate your example assuming a dummy Thanks! |
When i console log i get this
|
Great then! It might have something to do with your use case. First thing I'd do is await for its result, If that doesn't fix your issue, we might need a repro env to see what's going on in your Thx! |
That did not solve it, could it be because i am trying to click on an |
Hm, you should be able to send a click event to a |
<template>
<div class="mb-4">
<div class="ec-login-type-toggle" v-if="loginMethod === 'phone'">
<i role="button" data-testid="toggle-icon" class="fas fa-at" @click="setPreferredLoginMethod('email')"></i>
<vue-tel-input
v-model="phone"
:inputClasses="'appearance-none rounded w-full py-2 px-3 text-gray-700 leading-tight'"
:wrapperClasses="'focus:shadow-outline focus:outline-none'"
:defaultCountry="'Nigeria'"
:disabledFetchingCountry="true">
</vue-tel-input>
</div>
<div class="ec-login-type-toggle" v-if="loginMethod === 'email'">
<i data-testid="toggle-icon" class="fas fa-sms" @click="setPreferredLoginMethod('phone')" v-tooltip="'You can also login/sign-up with phone number'"></i>
<input v-if="loginMethod === 'email'"
class="appearance-none rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
id="email"
type="email"
placeholder="Email">
</div>
</div>
</template> <script>
import VueTelInput from 'vue-tel-input';
export default {
components: {
VueTelInput,
},
data() {
return {
phone: '',
loginMethod: 'phone',
};
},
methods: {
setPreferredLoginMethod(method) {
this.loginMethod = method
}
}
}
</script> import { render, fireEvent, cleanup } from '@testing-library/vue'
import Input from '../input.vue';
import VTooltip from 'v-tooltip';
import VueTelInput from 'vue-tel-input';
describe('Test the Input component function', () => {
afterEach(cleanup)
const props = {
loginMethod: 'phone'
}
test('input toggle when icon is clicked', async () => {
const {getByPlaceholderText, getByTestId} = render(Input, {props}, vue => {
vue.use(VTooltip)
vue.use(VueTelInput)
})
getByPlaceholderText('Enter a phone number')
const icon = getByTestId('toggle-icon');
await fireEvent.click(icon)
getByPlaceholderText('Email')
})
}) |
Okay I got it failing. If I replace
Have never used |
Thanks for your time @afontcu i really appreciate it. |
No problem! Let me know if you find a workaround to properly render vue-tel-input :) |
I just installed the library
But when i do
import { render, fireEvent, cleanup } from '@testing-library/vue'
and use it my testI get this

And even my IDE (webstorm) cannot resolve
fireEvent
Please what am i doing wrong ?
The text was updated successfully, but these errors were encountered: