Created
October 10, 2019 14:03
-
-
Save earnubs/87e6e54cf29d346dbb2305183fca7dd8 to your computer and use it in GitHub Desktop.
vue-test-utils patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/packages/shared/compile-template.js b/packages/shared/compile-template.js | |
index f505702..8ace3db 100644 | |
--- a/packages/shared/compile-template.js | |
+++ b/packages/shared/compile-template.js | |
@@ -17,6 +17,18 @@ export function compileFromString(str: string) { | |
export function compileTemplate(component: Component): void { | |
if (component.template) { | |
+ if (component.template.charAt('#') === '#') { | |
+ var el = document.querySelector(component.template); | |
+ if (!el) { | |
+ throwError( | |
+ "Cannot find element" + component.template | |
+ ); | |
+ | |
+ el = document.createElement('div'); | |
+ } | |
+ component.template = el.innerHTML; | |
+ } | |
+ | |
Object.assign(component, compileToFunctions(component.template)) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment