Skip to content
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 39 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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 Nov 9, 2023
30b34a2
Add tests
khalidadil Dec 20, 2023
ad290cb
Merge branch 'master' into bugfix/issue-6693
khalidadil Dec 20, 2023
5889376
Add tests
khalidadil Dec 20, 2023
6ab76ba
Remove accidental commit
khalidadil Dec 20, 2023
e28abcb
first pass
unlikelyzero Dec 22, 2023
b462c6d
drive-by to improve flex layout git blame
unlikelyzero Dec 22, 2023
3aaf74b
drive-by to improve watch mode
unlikelyzero Dec 22, 2023
aef2432
fix flexlayout toolbar options
unlikelyzero Dec 22, 2023
8bd5757
fix roles for flexlayout to be a grid instead of group
unlikelyzero Dec 22, 2023
3b56b67
driveby git blame ignore
unlikelyzero Dec 23, 2023
8190388
Some more testability improvements
unlikelyzero Dec 26, 2023
8165117
Improving the tests
unlikelyzero Dec 26, 2023
742e8e0
fixes
unlikelyzero Dec 26, 2023
c4a7292
Merge branch 'master' into bugfix/issue-6693
ozyx Dec 27, 2023
5f5c07e
test(e2e): fix styling tests
ozyx Dec 28, 2023
08ed4be
Merge branch 'master' into bugfix/issue-6693
khalidadil Dec 28, 2023
70ad074
test(e2e): fix flex layout toolbar test
ozyx Dec 28, 2023
a8ac603
test(e2e): fix row/column layout test
ozyx Dec 28, 2023
877b54a
a11y: "More options" -> "More actions"
ozyx Dec 29, 2023
3e16f0f
Change name of computed property for options label from getLabel to o…
khalidadil Dec 30, 2023
9945814
split up tests and work on stackedPlotStyling
unlikelyzero Jan 2, 2024
de1f511
Merge branch 'bugfix/issue-6693' of https://github.com/nasa/openmct i…
unlikelyzero Jan 2, 2024
3644534
add border styling
unlikelyzero Jan 2, 2024
72320b2
break out conditional and style inspector
unlikelyzero Jan 2, 2024
5001f66
update flexlayout tests and add stackedplot (wip)
unlikelyzero Jan 2, 2024
2aa76b0
Merge branch 'master' of https://github.com/nasa/openmct into bugfix/…
unlikelyzero Jan 2, 2024
d0fadd3
fix imports
unlikelyzero Jan 3, 2024
ffdba24
Add visual test
unlikelyzero Jan 3, 2024
46d4a29
update stackedplot test
unlikelyzero Jan 3, 2024
8eb5856
Add a11y label
unlikelyzero Jan 3, 2024
f3409b3
add font styles checks
unlikelyzero Jan 3, 2024
5371591
add font checking
unlikelyzero Jan 3, 2024
1b7f0b3
add visual tests
unlikelyzero Jan 3, 2024
cf2681e
Update toolbar to use aria
unlikelyzero Jan 3, 2024
4971bce
linting and comments
unlikelyzero Jan 3, 2024
1df1f72
lint fix
unlikelyzero Jan 3, 2024
6e5fd05
update comments
unlikelyzero Jan 3, 2024
8cf081d
skip test for bug
unlikelyzero Jan 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions e2e/helper/stylingUtils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*****************************************************************************
* 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.
*****************************************************************************/

const { expect } = require('../pluginFixtures');
unlikelyzero marked this conversation as resolved.
Show resolved Hide resolved

/**
* 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
Copy link
Contributor

Choose a reason for hiding this comment

The 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);
}

// eslint-disable-next-line no-undef
module.exports = {
checkStyles,
setStyles,
hexToRGB
};
unlikelyzero marked this conversation as resolved.
Show resolved Hide resolved
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
*/

const { test } = require('../../../../pluginFixtures');

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
}
);
});
Loading
Loading