<template> <divclass="hello"> <p> For a guide and recipes on how to configure / customize this project,<br /> check out the <ahref="https://cli.vuejs.org"target="_blank"rel="noopener"> vue-cli documentation </a> </p> </div> </template>
使用 html 若直接 console 出會將 template 呈現出來
1 2 3
html=> <div class="hello"> <p> For a guide and recipes on how to configure / customize this project,<br> check out the <a href="https://cli.vuejs.org" target="_blank" rel="noopener"> vue-cli documentation </a></p> </div>
Using find to search for a Component is deprecated and will be removed. Use findComponent instead. The find method will continue to work for finding elements using any valid selector(tag selectors (div, foo, bar), attribute selectors ([foo], [foo="bar"])...).
測試 class and attribute
可以使用在狀態的切換或是驗證資料的對錯,可以用 class 存在與否驗證。
attribute
資料在渲染的時候,是否有正確的塞入到 attribute。
在做資料的渲然,將拿到的內容塞入 attribute 中,如 a link 的 href, img src
<template> <divclass="content"> <h1:class="['card_title', props.styleColor]"> Vue vue-test-utils </h1> <ahref="javascript:;">click</a> <pclass="card_text"> Vue Test Utils (VTU) is a set of utility functions aimed to simplify testing Vue.js components. It provides some methods to mount and interact with Vue components in an isolated manner! </p> </div> </template>