This commit resolves an issue causing horizontal UI layout shift when a script is selected for the first time, and when all selected scripts are deselected. This issue was only observed on Chromium-based browsers on Linux environment when using macOS and Windows script collections. The underlying cause was identified as the use of percentage-based values for CSS margin and padding. To resolve this issue, these values were updated to absolute measurements. This adjustment maintains layout consistency across user interactions without compromising the responsiveness. The underlying cause was identified as the use of percentage-based values for CSS margin and padding within certain elements. To resolve this issue, these values were updated to absolute measurements. This adjustment maintains layout consistency across user interactions without compromising the responsiveness of the application. Additionally, an end-to-end (E2E) test has been introduced to monitor for future regressions of this layout shift bug, ensuring that the fix remains effective over subsequent updates.
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import { expectExists } from '@tests/shared/Assertions/ExpectExists';
|
|
import { getCurrentHighlightRange } from './support/interactions/code-area';
|
|
import { selectAllScripts } from './support/interactions/script-selection';
|
|
import { openCard } from './support/interactions/card';
|
|
|
|
describe('script selection highlighting', () => {
|
|
// Regression test for a bug where selecting multiple scripts only highlighted the last one.
|
|
it('highlights more when multiple scripts are selected', () => {
|
|
cy.visit('/');
|
|
selectLastScript();
|
|
getNonZeroCurrentHighlightRangeValue().then((lastScriptHighlightRange) => {
|
|
cy.log(`Highlight height for last script: ${lastScriptHighlightRange}`);
|
|
expect(lastScriptHighlightRange).to.be.greaterThan(0);
|
|
cy.visit('/');
|
|
selectAllScripts();
|
|
getNonZeroCurrentHighlightRangeValue().then((allScriptsHighlightRange) => {
|
|
cy.log(`Highlight height for all scripts: ${allScriptsHighlightRange}`);
|
|
expect(allScriptsHighlightRange).to.be.greaterThan(lastScriptHighlightRange);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
function getNonZeroCurrentHighlightRangeValue() {
|
|
return getCurrentHighlightRange()
|
|
.should('not.equal', '0')
|
|
.then((rangeValue) => {
|
|
expectExists(rangeValue);
|
|
return parseInt(rangeValue, 10);
|
|
});
|
|
}
|
|
|
|
function selectLastScript() {
|
|
openCard({
|
|
cardIndex: -1, // last card
|
|
});
|
|
cy.get('.node')
|
|
.last()
|
|
.click({ force: true });
|
|
}
|