0

How can I select b-form-input component according to its type such as email, password..

using vue-utils-library's find method?

in my login.html

<b-form-input
  id="email"
  type="email"
  v-model="credentials.email"
  :class="{ 'is-invalid': submitted && $v.credentials.email.$error }" />

my wrapper

wrapper = mount(Login,
      {
        localVue,
        store,
        mocks: {
          $route: {},
          $router: {
            push: jest.fn()
          }
        }
      })

in my test.spec file

it ('select', () => {
    const d = wrapper.find('BFormInput[type="email"]')
    console.log(d)
  })

but it returns

ErrorWrapper { selector: 'BFormInput[type="email"]' }
Abdulsamet ILERI
  • 155
  • 2
  • 10

1 Answers1

1

I suggest you should find your input like this:

const d = wrapper.find('input.form-control[type="email"]')
Anatoly
  • 20,799
  • 3
  • 28
  • 42