@@ -3748,24 +3748,29 @@ Detail: https://github.com/jrblevin/markdown-mode/issues/79"
37483748 'around 'markdown-create-fake-eww )
37493749 (ad-activate #'markdown-live-preview-window-eww )))))
37503750
3751+ (defun markdown-test/live-preview-wait ()
3752+ (unless markdown-live-preview-current-buffer-sync-async
3753+ (sit-for (* markdown-live-preview-idle-delay 10 ))
3754+ (accept-process-output )))
3755+
37513756(defun markdown-test/live-preview-exports ()
37523757 (markdown-test-temp-file " inline.text"
37533758 (unless (require 'eww nil t )
37543759 (should-error (markdown-live-preview-mode )))
37553760 (let ((markdown-live-preview-idle-delay .01 ))
37563761 (markdown-temp-eww
37573762 (markdown-live-preview-mode )
3758- (sit-for (* markdown-live-preview-idle-delay 3 ))
3759- (accept-process-output )
3763+ (markdown-test/live-preview-wait)
37603764 (should (buffer-live-p markdown-live-preview-view-buffer))
37613765 (should (eq (current-buffer )
37623766 (with-current-buffer markdown-live-preview-view-buffer
37633767 markdown-live-preview-source-buffer)))
37643768 (kill-buffer markdown-live-preview-view-buffer)
37653769 (should (null markdown-live-preview-view-buffer))
3766- (markdown-live-preview-async-export)
3767- (sit-for (* markdown-live-preview-idle-delay 3 ))
3768- (accept-process-output )
3770+ (if markdown-live-preview-current-buffer-sync-async
3771+ (markdown-live-preview-sync-export)
3772+ (markdown-live-preview-async-export)
3773+ (markdown-test/live-preview-wait))
37693774 (should (buffer-live-p markdown-live-preview-view-buffer))))))
37703775
37713776(ert-deftest test-markdown-ext/live-preview-exports-sync ()
@@ -3782,22 +3787,19 @@ Detail: https://github.com/jrblevin/markdown-mode/issues/79"
37823787 (let ((markdown-live-preview-delete-export 'delete-on-destroy ))
37833788 (markdown-test-temp-file " inline.text"
37843789 (markdown-live-preview-mode )
3785- (sit-for (* markdown-live-preview-idle-delay 3 ))
3786- (accept-process-output )
3790+ (markdown-test/live-preview-wait)
37873791 (setq file-output (markdown-export-file-name)))
37883792 (should-not (file-exists-p file-output)))
37893793 (let ((markdown-live-preview-delete-export 'delete-on-export ))
37903794 (markdown-test-temp-file " inline.text"
37913795 (markdown-live-preview-mode )
3792- (sit-for (* markdown-live-preview-idle-delay 3 ))
3793- (accept-process-output )
3796+ (markdown-test/live-preview-wait)
37943797 (setq file-output (markdown-export-file-name))
37953798 (should-not (file-exists-p file-output))))
37963799 (unwind-protect
37973800 (markdown-test-temp-file " inline.text"
37983801 (markdown-live-preview-mode )
3799- (sit-for (* markdown-live-preview-idle-delay 3 ))
3800- (accept-process-output )
3802+ (markdown-test/live-preview-wait)
38013803 (setq file-output (markdown-export-file-name))
38023804 (setq markdown-live-preview-delete-export nil )
38033805 (should (file-exists-p file-output)))
0 commit comments