describe:是用來將一至多組有相關的測試組合在一起的區塊。
attributes:判斷屬性
attributes:判斷屬性。
classes:尋找 class 屬性,語法查詢的話將得到一個陣列的結果。。
target:尋找target 屬性。
mount:掛載。
data-test:在html綁定。
props:父傳子。
find():使用 Document.querySelector() 的語法,find() 沒有找到目標元素時不會拋出錯誤。
expect(value):攥寫每一筆測試時都會使用 expect(value) 和匹配器 (matcher) 來『斷言』某個值,expect (value) 的參數 value 會是程式碼產生的值
toContain('C'):包含
案例父傳子attributes判斷屬性 單元測試
defineProps
1 | //html |
單元測試
引入描述、它、斷言 =>引入測試mount程式 =>引入組件 =>定義 =>斷言
1 | //引入描述、它、斷言 |