File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -381,6 +381,17 @@ h1 { color: red }
381
381
} )
382
382
} )
383
383
384
+ describe ( 'vapor mode' , ( ) => {
385
+ test ( 'on empty script' , ( ) => {
386
+ const { descriptor } = parse ( `<script vapor></script>` )
387
+ expect ( descriptor . vapor ) . toBe ( true )
388
+ } )
389
+ test ( 'on template' , ( ) => {
390
+ const { descriptor } = parse ( `<template vapor><div/></template>` )
391
+ expect ( descriptor . vapor ) . toBe ( true )
392
+ } )
393
+ } )
394
+
384
395
describe ( 'warnings' , ( ) => {
385
396
function assertWarning ( errors : Error [ ] , msg : string ) {
386
397
expect ( errors . some ( e => e . message . match ( msg ) ) ) . toBe ( true )
Original file line number Diff line number Diff line change @@ -162,8 +162,9 @@ export function parse(
162
162
ignoreEmpty &&
163
163
node . tag !== 'template' &&
164
164
isEmpty ( node ) &&
165
- ! hasSrc ( node )
165
+ ! hasProp ( node , 'src' )
166
166
) {
167
+ descriptor . vapor ||= hasProp ( node , 'vapor' )
167
168
return
168
169
}
169
170
switch ( node . tag ) {
@@ -409,12 +410,12 @@ function padContent(
409
410
}
410
411
}
411
412
412
- function hasSrc ( node : ElementNode ) {
413
+ function hasProp ( node : ElementNode , name : string ) {
413
414
return node . props . some ( p => {
414
415
if ( p . type !== NodeTypes . ATTRIBUTE ) {
415
416
return false
416
417
}
417
- return p . name === 'src'
418
+ return p . name === name
418
419
} )
419
420
}
420
421
You can’t perform that action at this time.
0 commit comments