Skip to content
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

Enables child component stubs #12

Closed
wants to merge 1 commit into from

Conversation

tim-maguire
Copy link
Contributor

Hello Daniel.

This PR enables the vue-test-utils stubs options.

Example use case

This:

import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"
import { library, config } from "@fortawesome/fontawesome-svg-core"
import { faSearch } from "@fortawesome/free-solid-svg-icons"
import { render, cleanup } from "../../src"
import Form from "./components/Form"

afterEach(cleanup)

library.add(faSearch)

test("Form contians with search button", () => {
  const { getByText } = render(Form, {}, vue => {
    vue.component(FontAwesomeIcon.name, FontAwesomeIcon)
  })
  getByText("Search now")
})

Can reduce to:

import { render, cleanup } from "../../src"
import Form from "./components/Form"

afterEach(cleanup)

test("Form contians with search button", () => {
  const { getByText } = render(Form, {
    stubs: ['font-awesome-icon']
  })
  getByText("Search now")
})

@coveralls
Copy link

Pull Request Test Coverage Report for Build 72

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.08%) to 95.082%

Totals Coverage Status
Change from base Build 70: 0.08%
Covered Lines: 41
Relevant Lines: 42

💛 - Coveralls

@dfcook
Copy link
Collaborator

dfcook commented Dec 27, 2018

I like this but wonder can it be taken further, should we use rest params to allow the full range of options to be passed to mount?

I've created an alternative PR, #12 . Do you want to take a look and give me your thoughts?

@tim-maguire tim-maguire deleted the stubs branch December 27, 2018 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants