-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LPS-119066 [Page Audit] Display the Google PageSpeed issues sections with total count #1005
Changes from all commits
1d69da0
91f73be
fbb7a87
593a504
99adc64
99c478b
8685c22
60cbe1d
c155105
9cf793e
a428404
97bf589
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Copyright (c) 2000-present Liferay, Inc. All rights reserved. | ||
* | ||
* This library is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU Lesser General Public License as published by the Free | ||
* Software Foundation; either version 2.1 of the License, or (at your option) | ||
* any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
* details. | ||
*/ | ||
|
||
window.Liferay.Util.sub = function (string = '', data) { | ||
const REGEX_SUB = /(?<=-|^)x(?=-|\s)/g; | ||
|
||
if ( | ||
arguments.length > 2 || | ||
(typeof data !== 'object' && typeof data !== 'function') | ||
) { | ||
data = Array.prototype.slice.call(arguments, 1); | ||
} | ||
|
||
const dataCopy = [...data]; | ||
const max = REGEX_SUB.exec(string).length; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mini-nit: Non-blocking feedback though, especially because this file might go away based on liferay/liferay-frontend-projects#519 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the nit. Hopefully, this file will be removed soon and provide it by default in our tests 🍀 |
||
let replacedValues = 0; | ||
|
||
const replacestring = string.replace | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another non-blocking mini-nit: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also here...Hopefully, this file will be removed soon and provide it by default in our tests 🍀 |
||
? string.replace(REGEX_SUB, () => { | ||
replacedValues = replacedValues + 1; | ||
const lastReplacement = replacedValues >= max; | ||
|
||
if (lastReplacement) { | ||
return dataCopy.join(''); | ||
} | ||
else { | ||
return dataCopy.shift(); | ||
} | ||
}) | ||
: string; | ||
|
||
return replacestring; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
{ | ||
"dependencies": { | ||
"@clayui/alert": "3.26.0", | ||
"@clayui/badge": "3.2.0", | ||
"@clayui/button": "3.6.0", | ||
"@clayui/drop-down": "3.25.1", | ||
"@clayui/icon": "3.1.0", | ||
"@clayui/label": "3.4.1", | ||
"@clayui/layout": "3.3.0", | ||
"@clayui/loading-indicator": "3.2.0", | ||
"@clayui/panel": "3.25.0", | ||
"@clayui/progress-bar": "3.2.0", | ||
"@clayui/tooltip": "3.4.5", | ||
"@liferay/frontend-js-react-web": "*", | ||
"classnames": "2.2.6", | ||
|
@@ -15,6 +18,11 @@ | |
"react": "16.12.0", | ||
"recharts": "1.8.5" | ||
}, | ||
"jest": { | ||
"setupFiles": [ | ||
"<rootDir>/jest-setup.config.js" | ||
] | ||
}, | ||
Comment on lines
+21
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Outside the scope of this PR, but this is another thing that is more or less repeated verbatim in about 10 places in |
||
"name": "layout-reports-web", | ||
"private": true, | ||
"scripts": { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,3 +53,7 @@ | |
margin-bottom: 0.5rem; | ||
} | ||
} | ||
|
||
.dropdown-menu__languages { | ||
max-height: 295px; | ||
} | ||
Comment on lines
+57
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just referencing prior discussion about this pattern from your other pull, in case anybody wants to look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we have similar logic now in:
modules/dxp/apps/segments/segments-experiment-web/jest-setup.config.js
modules/dxp/apps/analytics/analytics-reports-web/jest-setup.config.js
I'm making an issue to remove this duplication by baking a reasonable substitute into our default mock environment. Will come back and update the link here once I've done that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the link: liferay/liferay-frontend-projects#519
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That config is used to substitute the
x
in the message keys to check the full text in the tests. It will be awesome to not be required to add it each module. I saw that we are the only team using it in our tests 🤔layout-reports-web
,segments-experiment-web
andanalytics-reports-web
.