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

Question: possibility of testing options passed in $t() method #1620

Open
3 tasks done
sniperadmin opened this issue Dec 7, 2022 · 0 comments
Open
3 tasks done

Question: possibility of testing options passed in $t() method #1620

sniperadmin opened this issue Dec 7, 2022 · 0 comments
Labels
Status: Proposal Request for comments

Comments

@sniperadmin
Copy link

sniperadmin commented Dec 7, 2022

Clear and concise description of the problem

Could we cover branching in the following working example in unit testing?

<template>
    <v-subheader data-test="subtitle">
        {{ $t('auth.subtitle', { status: isRegister ? $t('auth.status.create') : $t('auth.status.login') }) }}
    </v-subheader>
</template>

<script>
export default {
  name: 'SomeComponent',
  props: {
    isRegister: {
      type: Boolean,
      default: true
    },
    isEditor: {
      type: Boolean,
      default: false
    }
  }
}
</script>

It looks like it is not possible to access the options passed in the $t method because in this case, the SFC is already mounted, and the requested JSON keys have been processed

Suggested solution

I don't have any ideas about a proper solution. I think mocking the whole thing won't be an option.
Yes, we could test the printed out text and works fine. However, in coverage, it does not count that

Alternative

No response

Additional context

No response

Validations

@sniperadmin sniperadmin added the Status: Proposal Request for comments label Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Proposal Request for comments
Projects
None yet
Development

No branches or pull requests

1 participant