File tree Expand file tree Collapse file tree 1 file changed +22
-18
lines changed
packages/@lwc/integration-not-karma/test/custom-elements-registry Expand file tree Collapse file tree 1 file changed +22
-18
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,28 @@ const injectableCreateVanilla = String(function createVanilla({ skipInject = fal
8888 }
8989} ) ;
9090
91+ /**
92+ * The text of a function that creates a vanilla custom element with an `adoptedCallback`.
93+ * The function is injected into an iframe, and must not reference any variables in this file.
94+ */
95+ const injectableDefineVanillaAdopted = String ( function defineVanillaAdopted ( ) {
96+ customElements . define (
97+ 'x-adopted' ,
98+ class extends HTMLElement {
99+ constructor ( ) {
100+ super ( ) ;
101+ // avoid class properties so Babel doesn't transform this class
102+ this . _adopted = false ;
103+ }
104+
105+ adoptedCallback ( ) {
106+ this . _adopted = true ;
107+ }
108+ }
109+ ) ;
110+ document . body . appendChild ( document . createElement ( 'x-adopted' ) ) ;
111+ } ) ;
112+
91113describe ( 'custom elements registry' , ( ) => {
92114 let iframe ;
93115 let engineCode ;
@@ -263,24 +285,6 @@ describe('custom elements registry', () => {
263285
264286 describe ( 'adoptedCallback' , ( ) => {
265287 describe ( 'calls adoptedCallback when element moves between documents' , ( ) => {
266- const injectableDefineVanillaAdopted = String ( function defineVanillaAdopted ( ) {
267- customElements . define (
268- 'x-adopted' ,
269- class extends HTMLElement {
270- constructor ( ) {
271- super ( ) ;
272- // avoid class properties so Babel doesn't transform this class
273- this . _adopted = false ;
274- }
275-
276- adoptedCallback ( ) {
277- this . _adopted = true ;
278- }
279- }
280- ) ;
281- document . body . appendChild ( document . createElement ( 'x-adopted' ) ) ;
282- } ) ;
283-
284288 const scenarios = [
285289 {
286290 name : 'element defined before engine loads' ,
You can’t perform that action at this time.
0 commit comments