Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Now, the choice is restricted to the _timeslice/snapshot_ type that match the gr
- https://github.com/eclipse-syson/syson/issues/2270[#2270] [diagram] Add dedicated tools to diagram elements palette to create/edit/delete expressions.
- https://github.com/eclipse-syson/syson/issues/2269[#2269] [diagram] When using direct edit on feature elements which have a value expression (e.g. an `Attribute` with a default value defined), the expression part (after the `=` sign) is no longer part of the initial direct edit value, and will be ignored if supplied in the new text value.
Users should use the dedicated tools to edit expressions instead, as they ensure only valid expressions (with all names resolving) are accepted.
- https://github.com/eclipse-syson/syson/issues/2287[#2287] [details] Use a label instead of a text field to display Expressions in the Details view

=== New features

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ import {
PropertySectionLabel,
TextfieldStyleProps,
} from '@eclipse-sirius/sirius-components-forms';
import Typography from '@mui/material/Typography';

import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
import IconButton from '@mui/material/IconButton';
import InputAdornment from '@mui/material/InputAdornment';
import TextField from '@mui/material/TextField';
import Tooltip from '@mui/material/Tooltip';
import { useState } from 'react';
import { makeStyles } from 'tss-react/mui';
Expand Down Expand Up @@ -141,46 +140,14 @@ export const ExpressionPropertySection: PropertySectionComponent<GQLTextfield |
<div className={classes.propertySectionLabel}>
<PropertySectionLabel editingContextId={editingContextId} formId={formId} widget={widgetForLabel} />
</div>
<TextField
name={labelOverride}
placeholder={labelOverride}
variant="standard"
value={widget.stringValue}
spellCheck={false}
margin="dense"
multiline={true}
maxRows={4}
fullWidth
data-testid={labelOverride}
disabled={true}
error={widget.diagnostics.length > 0}
helperText={widget.diagnostics[0]?.message}
className={classes.textfield}
InputProps={
widget.style
? {
className: classes.style,
}
: {}
}
inputProps={{
'data-testid': `input-${labelOverride}`,
className: classes.input,
}}
slotProps={{
input: {
endAdornment: (
<InputAdornment position="end">
<Tooltip title={'Edit'}>
<IconButton size="small" onClick={onEditExpression}>
<MoreHorizIcon />
</IconButton>
</Tooltip>
</InputAdornment>
),
},
}}
/>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between' }}>
<Typography data-testid={`details-expression-value`}>{widget.stringValue}</Typography>
<Tooltip title={'Edit'}>
<IconButton size="small" onClick={onEditExpression}>
<MoreHorizIcon />
</IconButton>
</Tooltip>
</div>
{modalElement}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ describe('Details View Tests', () => {
explorer.select('vehicle.actualSpeed <= maxSpeed');
});
it("Then the Details view shows the expression's textual value", () => {
details.getTextField('Expression value').should('exist');
details.getTextField('Expression value').should('have.value', 'vehicle.actualSpeed <= maxSpeed');
cy.getByTestId('details-expression-value').should('exist');
cy.getByTestId('details-expression-value').should('have.text', 'vehicle.actualSpeed <= maxSpeed');
});
});

Expand All @@ -106,8 +106,8 @@ describe('Details View Tests', () => {
explorer.select('length');
});
it("Then the Details view shows the child expression's textual value", () => {
details.getTextField('Expression value').should('exist');
details.getTextField('Expression value').should('have.value', '80 [SI::centimetre]');
cy.getByTestId('details-expression-value').should('exist');
cy.getByTestId('details-expression-value').should('have.text', '80 [SI::centimetre]');
});
});
});
Expand Down
Loading