@@ -16,7 +16,7 @@ export async function clearTestPage(testController: TestController): Promise<voi
1616 const widgetNames = $widgetElement . data ( ) . dxComponents ;
1717 widgetNames ?. forEach ( ( name ) => {
1818 if ( $widgetElement . hasClass ( 'dx-widget' ) ) {
19- // @ts -expect-error ts-erroe
19+ // @ts -expect-error ts-error
2020 $widgetElement [ name ] ?.( 'dispose' ) ;
2121 }
2222 } ) ;
@@ -66,3 +66,206 @@ export async function loadAxeCore(t: TestController): Promise<void> {
6666 document . head . appendChild ( script ) ;
6767 } ) ) ;
6868}
69+
70+ export async function loadQuill ( t : TestController ) : Promise < void > {
71+ await t . eval ( ( ) => new Promise < void > ( ( resolve , reject ) => {
72+ // @ts -expect-error ts-error
73+ if ( window . Quill ) {
74+ resolve ( ) ;
75+ return ;
76+ }
77+
78+ const script = document . createElement ( 'script' ) ;
79+ script . src = '../../../packages/devextreme/artifacts/js/dx-quill.min.js' ;
80+ // @ts -expect-error ts-error
81+ script . onload = resolve ;
82+ script . onerror = reject ;
83+ document . head . appendChild ( script ) ;
84+ } ) ) ;
85+ }
86+
87+ export async function loadGantt ( t : TestController ) : Promise < void > {
88+ await t . eval ( ( ) => new Promise < void > ( ( resolve , reject ) => {
89+ // @ts -expect-error ts-error
90+ if ( window . DevExpress ?. ui ?. dxGantt ) {
91+ resolve ( ) ;
92+ return ;
93+ }
94+
95+ const script = document . createElement ( 'script' ) ;
96+ script . src = '../../../packages/devextreme/artifacts/js/dx-gantt.min.js' ;
97+ // @ts -expect-error ts-error
98+ script . onload = resolve ;
99+ script . onerror = reject ;
100+ document . head . appendChild ( script ) ;
101+ } ) ) ;
102+ }
103+
104+ export async function loadAspNetData ( t : TestController ) : Promise < void > {
105+ await t . eval ( ( ) => new Promise < void > ( ( resolve , reject ) => {
106+ // @ts -expect-error ts-error
107+ if ( window . DevExpress ?. data ?. AspNet ) {
108+ resolve ( ) ;
109+ return ;
110+ }
111+
112+ const script = document . createElement ( 'script' ) ;
113+ script . src = '../../../packages/devextreme/artifacts/js/dx.aspnet.data.js' ;
114+ // @ts -expect-error ts-error
115+ script . onload = resolve ;
116+ script . onerror = reject ;
117+ document . head . appendChild ( script ) ;
118+ } ) ) ;
119+ }
120+
121+ // interface LoadOptions {
122+ // basePath?: string;
123+ // checkExists?: string;
124+ // }
125+
126+ // // async function loadResources(
127+ // // t: TestController,
128+ // // urls: string[],
129+ // // type: 'script' | 'style',
130+ // // options?: LoadOptions,
131+ // // ): Promise<void> {
132+ // // await t.eval(
133+ // // ({
134+ // // urls: urlList, type: resourceType, basePath, checkExists,
135+ // // }) => new Promise<void>((resolve, reject) => {
136+ // // if (!urlList.length) {
137+ // // resolve();
138+ // // return;
139+ // // }
140+
141+ // // let remaining = urlList.length;
142+
143+ // // const handleLoad = () => {
144+ // // remaining -= 1;
145+ // // if (remaining === 0) resolve();
146+ // // };
147+
148+ // // const handleError = (err: Event) => reject(err);
149+
150+ // // const createResource = (url: string): void => {
151+ // // const fullUrl = basePath ? `${basePath}${url}` : url;
152+
153+ // // if (resourceType === 'script') {
154+ // // if (document.querySelector(`script[src*="${fullUrl}"]`) || (checkExists && (window as any)[checkExists])) {
155+ // // handleLoad();
156+ // // return;
157+ // // }
158+
159+ // // if (document.querySelector(`script[src*="${fullUrl}"]`)) {
160+ // // handleLoad();
161+ // // return;
162+ // // }
163+ // // const el = document.createElement('script');
164+ // // el.src = fullUrl;
165+ // // el.async = true;
166+ // // el.onload = () => setTimeout(handleLoad, 0);
167+ // // el.onerror = handleError;
168+ // // document.head.appendChild(el);
169+ // // } else {
170+ // // if (document.querySelector(`link[href*="${fullUrl}"]`)) {
171+ // // handleLoad();
172+ // // return;
173+ // // }
174+ // // const el = document.createElement('link');
175+ // // el.rel = 'stylesheet';
176+ // // el.type = 'text/css';
177+ // // el.href = fullUrl;
178+ // // el.onload = () => setTimeout(handleLoad, 0);
179+ // // el.onerror = handleError;
180+ // // document.head.appendChild(el);
181+ // // }
182+ // // };
183+
184+ // // urls.forEach(createResource);
185+ // // }),
186+ // // {
187+ // // dependencies: {
188+ // // urls,
189+ // // type,
190+ // // basePath: options?.basePath,
191+ // // checkExists: options?.checkExists,
192+ // // },
193+ // // },
194+ // // );
195+ // // }
196+
197+ // async function loadResource(
198+ // t: TestController,
199+ // url: string,
200+ // type: 'script' | 'style',
201+ // options?: LoadOptions,
202+ // ): Promise<void> {
203+ // await t.eval(
204+ // ({
205+ // // eslint-disable-next-line @typescript-eslint/no-shadow
206+ // url, type, basePath, checkExists,
207+ // }) => new Promise<void>((resolve, reject) => {
208+ // const fullUrl = basePath ? `${basePath}${url}` : url;
209+
210+ // if (type === 'script') {
211+ // if (document.querySelector(`script[src*="${fullUrl}"]`) || (checkExists && (window as any)[checkExists])) {
212+ // resolve();
213+ // return;
214+ // }
215+
216+ // const el = document.createElement('script');
217+ // el.src = fullUrl;
218+ // el.async = true;
219+ // el.onload = () => {
220+ // if (checkExists) {
221+ // const interval = setInterval(() => {
222+ // if ((window as any)[checkExists]) {
223+ // clearInterval(interval);
224+ // resolve();
225+ // }
226+ // }, 10);
227+ // } else {
228+ // resolve();
229+ // }
230+ // };
231+ // el.onerror = reject;
232+ // document.head.appendChild(el);
233+ // } else {
234+ // if (document.querySelector(`link[href*="${fullUrl}"]`)) {
235+ // resolve();
236+ // return;
237+ // }
238+
239+ // const el = document.createElement('link');
240+ // el.rel = 'stylesheet';
241+ // el.type = 'text/css';
242+ // el.href = fullUrl;
243+ // // @ts -expect-error ts-error
244+ // el.onload = resolve;
245+ // el.onerror = reject;
246+ // document.head.appendChild(el);
247+ // }
248+ // }),
249+ // {
250+ // dependencies: {
251+ // url, type, basePath: options?.basePath, checkExists: options?.checkExists,
252+ // },
253+ // },
254+ // );
255+ // }
256+
257+ // export async function loadScripts(
258+ // t: TestController,
259+ // script: string,
260+ // options?: LoadOptions,
261+ // ): Promise<void> {
262+ // await loadResource(t, script, 'script', options);
263+ // }
264+
265+ // export async function loadStyles(
266+ // t: TestController,
267+ // style: string,
268+ // options?: LoadOptions,
269+ // ): Promise<void> {
270+ // await loadResource(t, style, 'style', options);
271+ // }
0 commit comments