Fixed broken unit test and removed test no longer needed
This commit is contained in:
parent
71555378d5
commit
9e08f5d259
1 changed files with 12 additions and 15 deletions
|
|
@ -4,6 +4,8 @@ import textareaQuestion from "./textarea-question";
|
||||||
// Supporting Files
|
// Supporting Files
|
||||||
import { shallowMount } from "@vue/test-utils";
|
import { shallowMount } from "@vue/test-utils";
|
||||||
|
|
||||||
|
const maska = jest.fn();
|
||||||
|
|
||||||
const questionText = "textareaQuestionText";
|
const questionText = "textareaQuestionText";
|
||||||
const mockMixin = {
|
const mockMixin = {
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -17,6 +19,11 @@ describe("textarea-question.vue", () => {
|
||||||
it("Should render a textarea", async () => {
|
it("Should render a textarea", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const wrapper = shallowMount(textareaQuestion, {
|
const wrapper = shallowMount(textareaQuestion, {
|
||||||
|
global: {
|
||||||
|
directives: {
|
||||||
|
maska: maska,
|
||||||
|
},
|
||||||
|
},
|
||||||
propsData: {
|
propsData: {
|
||||||
modelValue: "",
|
modelValue: "",
|
||||||
},
|
},
|
||||||
|
|
@ -35,6 +42,11 @@ describe("textarea-question.vue", () => {
|
||||||
it("Should emit new value when modelValue is changed", async () => {
|
it("Should emit new value when modelValue is changed", async () => {
|
||||||
// Act
|
// Act
|
||||||
const wrapper = shallowMount(textareaQuestion, {
|
const wrapper = shallowMount(textareaQuestion, {
|
||||||
|
global: {
|
||||||
|
directives: {
|
||||||
|
maska: maska,
|
||||||
|
},
|
||||||
|
},
|
||||||
propsData: {
|
propsData: {
|
||||||
modelValue: "val",
|
modelValue: "val",
|
||||||
},
|
},
|
||||||
|
|
@ -47,19 +59,4 @@ describe("textarea-question.vue", () => {
|
||||||
expect(wrapper.emitted("update:modelValue")).toEqual([["val2"]]);
|
expect(wrapper.emitted("update:modelValue")).toEqual([["val2"]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should limit the number of characters entered to the max length value property passed in", async () => {
|
|
||||||
// Act
|
|
||||||
const wrapper = shallowMount(textareaQuestion, {
|
|
||||||
propsData: {
|
|
||||||
modelValue: "123456789",
|
|
||||||
maxLength: 10,
|
|
||||||
},
|
|
||||||
mixins: [mockMixin],
|
|
||||||
});
|
|
||||||
|
|
||||||
wrapper.vm.value = "12345678910";
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(wrapper.vm.value).toEqual("1234567891");
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue