Преглед изворни кода

improve x-on click error assertion

Hugo Di Francesco пре 4 година
родитељ
комит
a8bb81e041
1 измењених фајлова са 5 додато и 1 уклоњено
  1. 5 1
      test/error.spec.js

+ 5 - 1
test/error.spec.js

@@ -110,6 +110,10 @@ test('error in x-on eval contains element, expression and original error', async
     await Alpine.start()
     document.querySelector('div').click()
     await wait(() => {
-        expect(mockConsoleError).toHaveBeenCalled()
+        expect(mockConsoleError).toHaveBeenCalledWith(
+            "Alpine: error in expression \"hello.world\" in component:",
+            document.querySelector('[x-data]'),
+            "due to \"TypeError: Cannot read property 'world' of null\""
+        )
     })
 })