๏ผComposition API + Jest ใซใใใ้ฉๅใชในใใใใทใงใใ่จญ่จ๏ผ
ในใใใใทใงใใใฏ
โ โ ใใฉใใๅคใใฃใใใใๆ็ขบใซใใใใใซใ
โ โ
find()
ใง็ตใฃใฆ html()
ใๆฎใ่จญ่จใๅบๆฌใ
const wrapper = shallowMount(MyComponent);
expect(wrapper.html()).toMatchSnapshot(); // โ ๅ
จ้จๆฎใฃใฆใใพใ
โ ๅบๅใๅคงใใใจใใฉใใๅคใใฃใใใใใใใใชใ
โ ใกใใฃใจใใ class ๅใฎๅคๆดใงใๅคง้ใฎๅทฎๅใๅบใฆใใพใใ
const wrapper = shallowMount(MyComponent);
expect(wrapper.find('p.message').html()).toMatchSnapshot();
โ ๅฟ
่ฆใช <p class="message">
ใ ใใๆฎใใ