-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[Flexible Layouts] Flexible Layout styling fixes #7319
Merged
Merged
Changes from 35 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
39f30c0
Add css class to flexible layouts to allow them to be styled, reset s…
khalidadil 30b34a2
Add tests
khalidadil ad290cb
Merge branch 'master' into bugfix/issue-6693
khalidadil 5889376
Add tests
khalidadil 6ab76ba
Remove accidental commit
khalidadil e28abcb
first pass
unlikelyzero b462c6d
drive-by to improve flex layout git blame
unlikelyzero 3aaf74b
drive-by to improve watch mode
unlikelyzero aef2432
fix flexlayout toolbar options
unlikelyzero 8bd5757
fix roles for flexlayout to be a grid instead of group
unlikelyzero 3b56b67
driveby git blame ignore
unlikelyzero 8190388
Some more testability improvements
unlikelyzero 8165117
Improving the tests
unlikelyzero 742e8e0
fixes
unlikelyzero c4a7292
Merge branch 'master' into bugfix/issue-6693
ozyx 5f5c07e
test(e2e): fix styling tests
ozyx 08ed4be
Merge branch 'master' into bugfix/issue-6693
khalidadil 70ad074
test(e2e): fix flex layout toolbar test
ozyx a8ac603
test(e2e): fix row/column layout test
ozyx 877b54a
a11y: "More options" -> "More actions"
ozyx 3e16f0f
Change name of computed property for options label from getLabel to o…
khalidadil 9945814
split up tests and work on stackedPlotStyling
unlikelyzero de1f511
Merge branch 'bugfix/issue-6693' of https://github.com/nasa/openmct i…
unlikelyzero 3644534
add border styling
unlikelyzero 72320b2
break out conditional and style inspector
unlikelyzero 5001f66
update flexlayout tests and add stackedplot (wip)
unlikelyzero 2aa76b0
Merge branch 'master' of https://github.com/nasa/openmct into bugfix/…
unlikelyzero d0fadd3
fix imports
unlikelyzero ffdba24
Add visual test
unlikelyzero 46d4a29
update stackedplot test
unlikelyzero 8eb5856
Add a11y label
unlikelyzero f3409b3
add font styles checks
unlikelyzero 5371591
add font checking
unlikelyzero 1b7f0b3
add visual tests
unlikelyzero cf2681e
Update toolbar to use aria
unlikelyzero 4971bce
linting and comments
unlikelyzero 1df1f72
lint fix
unlikelyzero 6e5fd05
update comments
unlikelyzero 8cf081d
skip test for bug
unlikelyzero File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/***************************************************************************** | ||
* Open MCT, Copyright (c) 2014-2023, United States Government | ||
* as represented by the Administrator of the National Aeronautics and Space | ||
* Administration. All rights reserved. | ||
* | ||
* Open MCT is licensed under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
* Open MCT includes source code licensed under additional open source | ||
* licenses. See the Open Source Licenses file (LICENSES.md) included with | ||
* this source code distribution or the Licensing information page available | ||
* at runtime from the About dialog for additional information. | ||
*****************************************************************************/ | ||
|
||
import { expect } from '../pluginFixtures.js'; | ||
|
||
/** | ||
* Converts a hex color value to its RGB equivalent. | ||
* | ||
* @param {string} hex - The hex color value. | ||
ozyx marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* @returns {string} The RGB equivalent of the hex color. | ||
*/ | ||
function hexToRGB(hex) { | ||
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); | ||
return result | ||
? `rgb(${parseInt(result[1], 16)}, ${parseInt(result[2], 16)}, ${parseInt(result[3], 16)})` | ||
: null; | ||
} | ||
|
||
/** | ||
* Sets the background and text color of a given element. | ||
* | ||
* @param {import('@playwright/test').Page} page - The Playwright page object. | ||
* @param {string} borderColorHex - The hex value of the border color to set, or 'No Style'. | ||
* @param {string} backgroundColorHex - The hex value of the background color to set, or 'No Style'. | ||
* @param {string} textColorHex - The hex value of the text color to set, or 'No Style'. | ||
* @param {import('@playwright/test').Locator} locator - The Playwright locator for the element whose style is to be set. | ||
*/ | ||
async function setStyles(page, borderColorHex, backgroundColorHex, textColorHex, locator) { | ||
await locator.click(); // Assuming the locator is clickable and opens the style setting UI | ||
await page.getByLabel('Set border color').click(); | ||
await page.getByLabel(borderColorHex).click(); | ||
await page.getByLabel('Set background color').click(); | ||
await page.getByLabel(backgroundColorHex).click(); | ||
await page.getByLabel('Set text color').click(); | ||
await page.getByLabel(textColorHex).click(); | ||
} | ||
Comment on lines
+38
to
+55
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. this rocks |
||
|
||
/** | ||
* Checks if the styles of an element match the expected values. | ||
* | ||
* @param {string} expectedBorderColor - The expected border color in RGB format. Default is '#e6b8af' or 'rgb(230, 184, 175)' | ||
* @param {string} expectedBackgroundColor - The expected background color in RGB format. | ||
* @param {string} expectedTextColor - The expected text color in RGB format. Default is #aaaaaa or 'rgb(170, 170, 170)' | ||
* @param {import('@playwright/test').Locator} locator - The Playwright locator for the element whose style is to be checked. | ||
*/ | ||
async function checkStyles( | ||
expectedBorderColor, | ||
expectedBackgroundColor, | ||
expectedTextColor, | ||
locator | ||
) { | ||
const layoutStyles = await locator.evaluate((el) => { | ||
return { | ||
border: window.getComputedStyle(el).getPropertyValue('border-top-color'), //infer the left, right, and bottom | ||
background: window.getComputedStyle(el).getPropertyValue('background-color'), | ||
fontColor: window.getComputedStyle(el).getPropertyValue('color') | ||
}; | ||
}); | ||
expect(layoutStyles.border).toContain(expectedBorderColor); | ||
expect(layoutStyles.background).toContain(expectedBackgroundColor); | ||
expect(layoutStyles.fontColor).toContain(expectedTextColor); | ||
} | ||
|
||
/** | ||
* Checks if the font Styles of an element match the expected values. | ||
* | ||
* @param {string} expectedFontSize - The expected border color in RGB format. Default is '#e6b8af' or 'rgb(230, 184, 175)' | ||
* @param {string} expectedFontType - The expected text color in RGB format. Default is #aaaaaa or 'rgb(170, 170, 170)' | ||
* @param {import('@playwright/test').Locator} locator - The Playwright locator for the element whose style is to be checked. | ||
*/ | ||
async function checkFontStyles(expectedFontSize, expectedFontType, locator) { | ||
const layoutStyles = await locator.evaluate((el) => { | ||
return { | ||
fontSize: window.getComputedStyle(el).getPropertyValue('font-size'), | ||
fontType: window.getComputedStyle(el).getPropertyValue('font-family') | ||
}; | ||
}); | ||
expect(layoutStyles.fontSize).toContain(expectedFontSize); | ||
expect(layoutStyles.fontFamily).toContain(expectedFontType); | ||
} | ||
|
||
export { checkFontStyles, checkStyles, hexToRGB, setStyles }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
e2e/tests/functional/plugins/styling/conditionalStyling.e2e.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/***************************************************************************** | ||
* Open MCT, Copyright (c) 2014-2023, United States Government | ||
* as represented by the Administrator of the National Aeronautics and Space | ||
* Administration. All rights reserved. | ||
* | ||
* Open MCT is licensed under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
* | ||
* Open MCT includes source code licensed under additional open source | ||
* licenses. See the Open Source Licenses file (LICENSES.md) included with | ||
* this source code distribution or the Licensing information page available | ||
* at runtime from the About dialog for additional information. | ||
*****************************************************************************/ | ||
|
||
/** | ||
* This test is dedicated to test conditional styling | ||
*/ | ||
|
||
import { test } from '../../../../pluginFixtures.js'; | ||
|
||
test.describe('Conditional Styling', () => { | ||
test.fixme( | ||
'Conditional Styling can be applied to Flex Layout and its children', | ||
async ({ page }) => { | ||
//test | ||
} | ||
); | ||
test.fixme( | ||
'Conditional Styling can be applied to Overlay Plot and its children', | ||
async ({ page }) => { | ||
//test | ||
} | ||
); | ||
test.fixme( | ||
'Conditional Styling changes the styling of the object the condition changes state', | ||
async ({ page }) => { | ||
//test | ||
} | ||
); | ||
}); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
drive-by to make it easier to work with flex layouts
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.
this is so cool