Skip to content

Commit 771eb0c

Browse files
.
1 parent 12a4f01 commit 771eb0c

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

packages/devextreme-cli/testing/app-template.test.shared.js

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -217,23 +217,6 @@ module.exports = (env, { port = 8080, urls = {} } = {}) => {
217217
compareSnapshot(image, 'toggle');
218218
});
219219

220-
function getPopulatedProperties(elementStyles) {
221-
for(const prop in elementStyles) {
222-
if(
223-
// Check the property belongs to the CSSStyleProperties instance
224-
// Check property has a numeric index (indicates inline/dash-named style)
225-
Object.hasOwn(elementStyles, prop) &&
226-
!Number.isNaN(Number.parseInt(prop, 10))
227-
) {
228-
console.log(
229-
`${elementStyles[prop]} = '${elementStyles.getPropertyValue(
230-
elementStyles[prop],
231-
)}'`,
232-
);
233-
}
234-
}
235-
}
236-
237220
it('User panel', async() => {
238221
await openPage(getPageURL('profile'));
239222
const isCompact = await page.$('.dx-toolbar-item-invisible .user-button');
@@ -244,10 +227,31 @@ module.exports = (env, { port = 8080, urls = {} } = {}) => {
244227
if(env.engine.startsWith('nextjs')) {
245228
const html = await page.$eval('.header-component .dx-toolbar-before', el => el.innerHTML);
246229
console.log('********** Toolbar Inner HTML', html);
247-
// eslint-disable-next-line
248-
const styles = await page.$eval('.header-component .dx-toolbar .dx-item div::-p-text(My App)', el => window.getComputedStyle(el));
230+
231+
const styleStr = await page.$eval('.header-component .dx-toolbar .dx-item div::-p-text(My App)', el => {
232+
// eslint-disable-next-line
233+
const styles = window.getComputedStyle(el);
234+
let result = '';
235+
236+
for(const prop in styles) {
237+
if(
238+
// Check the property belongs to the CSSStyleProperties instance
239+
// Check property has a numeric index (indicates inline/dash-named style)
240+
Object.hasOwn(styles, prop) &&
241+
!Number.isNaN(Number.parseInt(prop, 10))
242+
) {
243+
result +=
244+
`${styles[prop]} = '${styles.getPropertyValue(
245+
styles[prop],
246+
)}'\n`;
247+
}
248+
}
249+
250+
return result;
251+
});
252+
249253
console.log('********** Title Styles');
250-
getPopulatedProperties(styles);
254+
console.log(styleStr);
251255
}
252256
const image = await takeScreenshot({
253257
clip: {

0 commit comments

Comments
 (0)