소스 검색

tests: x-bind with nested undefined property

Ryan Chandler 4 년 전
부모
커밋
56c08770a2
1개의 변경된 파일9개의 추가작업 그리고 0개의 파일을 삭제
  1. 9 0
      tests/cypress/integration/directives/x-bind.spec.js

+ 9 - 0
tests/cypress/integration/directives/x-bind.spec.js

@@ -9,6 +9,15 @@ test('sets attribute bindings on initialize',
     ({ get }) => get('span').should(haveAttribute('foo', 'bar'))
 )
 
+test('sets undefined nested keys to empty string',
+    html`
+        <div x-data="{ nested: {} }">
+            <input x-bind:value="nested.field">
+        </div>
+    `,
+    ({ get }) => get('input').should(haveAttribute('value', ''))
+)
+
 test('style attribute bindings are added by string syntax',
     html`
         <div x-data="{ initialClass: 'foo' }">