@@ -5,7 +5,7 @@ import { transmogrify } from '../transmogrify';
5
5
import type { Program as EsProgram } from 'estree' ;
6
6
7
7
const COMPILED_CMP = `
8
- async function* tmpl (props, attrs, slottedContent, Cmp, instance) {
8
+ async function* __lwcTmpl (props, attrs, slottedContent, Cmp, instance) {
9
9
yield "<p";
10
10
yield stylesheetScopeTokenClass;
11
11
yield ">Hello</p>";
@@ -27,7 +27,7 @@ const COMPILED_CMP = `
27
27
}
28
28
}
29
29
const __REFLECTED_PROPS__ = [];
30
- async function* generateMarkup (tagName, props, attrs, slotted) {
30
+ async function* __lwcGenerateMarkup (tagName, props, attrs, slotted) {
31
31
attrs = attrs ?? ({});
32
32
const instance = new Basic({
33
33
tagName: tagName.toUpperCase()
@@ -65,10 +65,10 @@ describe('transmogrify', () => {
65
65
} ) ;
66
66
67
67
describe ( 'in sync mode' , ( ) => {
68
- test ( 'generateMarkup is transformed into sync mode' , ( ) => {
69
- expect ( COMPILED_CMP_SYNC ) . not . toContain ( 'async function* generateMarkup ' ) ;
70
- expect ( COMPILED_CMP_SYNC ) . not . toContain ( 'async function generateMarkup ' ) ;
71
- expect ( COMPILED_CMP_SYNC ) . toContain ( 'function generateMarkup ($$emit' ) ;
68
+ test ( '__lwcGenerateMarkup is transformed into sync mode' , ( ) => {
69
+ expect ( COMPILED_CMP_SYNC ) . not . toContain ( 'async function* __lwcGenerateMarkup ' ) ;
70
+ expect ( COMPILED_CMP_SYNC ) . not . toContain ( 'async function __lwcGenerateMarkup ' ) ;
71
+ expect ( COMPILED_CMP_SYNC ) . toContain ( 'function __lwcGenerateMarkup ($$emit' ) ;
72
72
73
73
expect ( COMPILED_CMP_SYNC ) . not . toContain ( 'yield* renderAttrs' ) ;
74
74
expect ( COMPILED_CMP_SYNC ) . toContain ( 'renderAttrs($$emit' ) ;
@@ -78,10 +78,10 @@ describe('transmogrify', () => {
78
78
expect ( COMPILED_CMP_SYNC ) . toContain ( '$$emit(">")' ) ;
79
79
} ) ;
80
80
81
- test ( 'tmpl is transformed into sync mode' , ( ) => {
82
- expect ( COMPILED_CMP_SYNC ) . not . toContain ( 'async function* tmpl ' ) ;
83
- expect ( COMPILED_CMP_SYNC ) . not . toContain ( 'async function tmpl ' ) ;
84
- expect ( COMPILED_CMP_SYNC ) . toContain ( 'function tmpl ($$emit' ) ;
81
+ test ( '__lwcTmpl is transformed into sync mode' , ( ) => {
82
+ expect ( COMPILED_CMP_SYNC ) . not . toContain ( 'async function* __lwcTmpl ' ) ;
83
+ expect ( COMPILED_CMP_SYNC ) . not . toContain ( 'async function __lwcTmpl ' ) ;
84
+ expect ( COMPILED_CMP_SYNC ) . toContain ( 'function __lwcTmpl ($$emit' ) ;
85
85
86
86
expect ( COMPILED_CMP_SYNC ) . not . toContain ( 'yield "<p"' ) ;
87
87
expect ( COMPILED_CMP_SYNC ) . toContain ( '$$emit("<p")' ) ;
@@ -102,9 +102,9 @@ describe('transmogrify', () => {
102
102
} ) ;
103
103
104
104
describe ( 'in async mode' , ( ) => {
105
- test ( 'generateMarkup is transformed into async mode' , ( ) => {
106
- expect ( COMPILED_CMP_ASYNC ) . not . toContain ( 'async function* generateMarkup ' ) ;
107
- expect ( COMPILED_CMP_ASYNC ) . toContain ( 'async function generateMarkup ($$emit' ) ;
105
+ test ( '__lwcGenerateMarkup is transformed into async mode' , ( ) => {
106
+ expect ( COMPILED_CMP_ASYNC ) . not . toContain ( 'async function* __lwcGenerateMarkup ' ) ;
107
+ expect ( COMPILED_CMP_ASYNC ) . toContain ( 'async function __lwcGenerateMarkup ($$emit' ) ;
108
108
109
109
expect ( COMPILED_CMP_ASYNC ) . not . toContain ( 'yield* renderAttrs' ) ;
110
110
expect ( COMPILED_CMP_ASYNC ) . toContain ( 'renderAttrs($$emit' ) ;
@@ -114,9 +114,9 @@ describe('transmogrify', () => {
114
114
expect ( COMPILED_CMP_ASYNC ) . toContain ( '$$emit(">")' ) ;
115
115
} ) ;
116
116
117
- test ( 'tmpl is transformed into async mode' , ( ) => {
118
- expect ( COMPILED_CMP_ASYNC ) . not . toContain ( 'async function* tmpl ' ) ;
119
- expect ( COMPILED_CMP_ASYNC ) . toContain ( 'async function tmpl ($$emit' ) ;
117
+ test ( '__lwcTmpl is transformed into async mode' , ( ) => {
118
+ expect ( COMPILED_CMP_ASYNC ) . not . toContain ( 'async function* __lwcTmpl ' ) ;
119
+ expect ( COMPILED_CMP_ASYNC ) . toContain ( 'async function __lwcTmpl ($$emit' ) ;
120
120
121
121
expect ( COMPILED_CMP_ASYNC ) . not . toContain ( 'yield "<p"' ) ;
122
122
expect ( COMPILED_CMP_ASYNC ) . toContain ( '$$emit("<p")' ) ;
0 commit comments