Created
March 16, 2019 10:18
-
-
Save mfaridzia/c9b4fe8f6cf5c7719091a99013b4987b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { shallowMount } from '@vue/test-utils' | |
import TestComponent from '@/components/TestComponent.vue' | |
describe('TestComponent.vue', () => { | |
it('Merender judul text', () => { | |
const wrapper = shallowMount(TestComponent, { | |
data() { | |
return { | |
title: 'Input Data' | |
} | |
} | |
}) | |
expect(wrapper.find('.title').text()).toEqual('Input Data') | |
}) | |
it('Menampilkan pesan ketika data sudah di submit', () => { | |
const wrapper = shallowMount(TestComponent) | |
wrapper.find(".name").setValue("fulana") | |
wrapper.find("button").trigger("click") | |
expect(wrapper.find(".success").text()).toBe("Thank You fulana") | |
}) | |
it("Menampilkan pesan fulana jika isFulana bernilai true", () => { | |
const wrapper = shallowMount(TestComponent, { | |
propsData: { | |
isFulana: true | |
} | |
}) | |
console.log(wrapper.html()) | |
expect(wrapper.find("h2").text()).toBe("Ente Fulana Euy!") | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment