diff --git a/editor/src/components/inspector/flex-section.tsx b/editor/src/components/inspector/flex-section.tsx index 8e8849af509b..00bc1e1fd8f0 100644 --- a/editor/src/components/inspector/flex-section.tsx +++ b/editor/src/components/inspector/flex-section.tsx @@ -18,7 +18,7 @@ import { FlexGapControl } from './sections/layout-section/flex-container-subsect import { FlexContainerControls } from './sections/layout-section/flex-container-subsection/flex-container-subsection' import { FlexCol } from 'utopia-api' -const areElementsFlexContainersSelector = createSelector( +export const areElementsFlexContainersSelector = createSelector( metadataSelector, selectedViewsSelector, detectAreElementsFlexContainers, @@ -57,9 +57,6 @@ export const FlexSection = React.memo(() => { - - - , )} diff --git a/editor/src/components/inspector/inspector.spec.browser2.tsx b/editor/src/components/inspector/inspector.spec.browser2.tsx index 168dd2abf430..e1b26fe4c331 100644 --- a/editor/src/components/inspector/inspector.spec.browser2.tsx +++ b/editor/src/components/inspector/inspector.spec.browser2.tsx @@ -4,7 +4,7 @@ import { assertNever } from '../../core/shared/utils' import { CanvasControlsContainerID } from '../canvas/controls/new-canvas-controls' import { mouseClickAtPoint, mouseMoveToPoint } from '../canvas/event-helpers.test-utils' import { getPrintedUiJsCode, renderTestEditorWithCode } from '../canvas/ui-jsx.test-utils' -import { selectComponents } from '../editor/actions/action-creators' +import { clearSelection, selectComponents } from '../editor/actions/action-creators' import { AspectRatioLockButtonTestId } from './sections/layout-section/self-layout-subsection/gigantic-size-pins-subsection' import { cmdModifier } from '../../utils/modifiers' import { wait } from '../../utils/utils.test-utils' @@ -80,6 +80,65 @@ export var storyboard = ( ` } +function exampleProjectToCheckPaddingControls(): string { + return `import * as React from "react"; +import { Scene, Storyboard, jsx } from "utopia-api"; + +export var App = (props) => { + return ( +
+
+
+
+ ); +}; + +export var storyboard = ( + + + + + +); +` +} + function exampleProjectForSectionRemoval(): string { return `import * as React from 'react' import { Storyboard, jsx } from 'utopia-api' @@ -195,6 +254,36 @@ export var storyboard = ( // Click on the blue div. await clickOnElementCheckTop('div-blue', '270') }) + it('check that only one pair of padding controls shows up at a time', async () => { + const editor = await renderTestEditorWithCode( + exampleProjectToCheckPaddingControls(), + 'await-first-dom-report', + ) + + function validatePaddingControlCount(): void { + const paddingHControls = editor.renderedDOM.queryAllByTestId('padding-H') + const paddingVControls = editor.renderedDOM.queryAllByTestId('padding-V') + expect(paddingHControls).toHaveLength(1) + expect(paddingVControls).toHaveLength(1) + } + + await editor.dispatch([clearSelection()], true) + await editor.getDispatchFollowUpActionsFinished() + validatePaddingControlCount() + + const appRootPath = elementPath([['storyboard', 'scene-1', 'app'], ['app-root']]) + await editor.dispatch([selectComponents([appRootPath], false)], true) + await editor.getDispatchFollowUpActionsFinished() + validatePaddingControlCount() + + const divPath = elementPath([ + ['storyboard', 'scene-1', 'app'], + ['app-root', 'div-green'], + ]) + await editor.dispatch([selectComponents([divPath], false)], true) + await editor.getDispatchFollowUpActionsFinished() + validatePaddingControlCount() + }) it('removes the transform property when clicking the cross on that section', async () => { const resultCode = await setupRemovalTest('inspector-transform-remove-all') expect(resultCode).toEqual(`import * as React from 'react'