Skip to content
Merged
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
2 changes: 1 addition & 1 deletion dist/datamodel/node/container/SectionNode.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion dist/datamodel/node/container/SectionNode.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/datamodel/node/container/SectionNode.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/datamodel/node/container/SectionNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ const ALLOWED_TYPES: Record<string, string[]> = {
],
arch: [
'Constant',
'Simulink.Signal',
// No Simulink.Signal: a signal is design data. Architectural data models
// interfaces, and its bus/connection-bus entries are the interface types.
'Simulink.Bus',
'Simulink.ConnectionBus',
'Simulink.ServiceBus',
Expand Down
17 changes: 13 additions & 4 deletions test/archPresentation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,14 @@ describe('ValueType defaultName and isDerived icon', () => {
// into Design Data and into Architectural Data is byte-identical on disk apart from
// `isderived`, so the icon is the ONLY thing in the tree that says which section an
// entry belongs to. A class whose ternary collapsed to one glyph would make an arch
// entry indistinguishable from a design one, and these four are the classes both
// entry indistinguishable from a design one, and these three are the classes both
// sections admit (see ALLOWED_TYPES), so they are exactly the ones it can happen to.
describe('Design Data and Architectural Data icons for the classes both sections admit', () => {
const CASES: [string, string, string][] = [
// className, Design Data icon, Architectural Data icon
['Simulink.NumericType', 'wsNumeric', 'typeNumeric'],
['Simulink.AliasType', 'wsAlias', 'typeAlias'],
['Simulink.ValueType', 'wsValue', 'typeSignalUI'],
// A derived Signal shares the serviceInterfaces glyph with a derived
// Simulink.ServiceBus; what matters here is that it is NOT the wsSignal one.
['Simulink.Signal', 'wsSignal', 'serviceInterfaces'],
];

it('gives each class a different glyph in each section', () => {
Expand All @@ -141,6 +138,18 @@ describe('Design Data and Architectural Data icons for the classes both sections
}
});

it('still gives a derived Signal the arch glyph, which only parsing can reach now', () => {
// Architectural Data no longer ADMITS Simulink.Signal, so addEntry and paste
// cannot produce one and this case cannot be driven from the section the way
// the three above are. Parsing is unaffected by allowsType, so a dictionary
// that already holds an arch signal still loads — and still needs the glyph
// that says so, rather than looking like design data.
const node = SignalNode.parse(rawVal('Simulink.Signal', {}), 'sig', null);
expect(node.icon).toBe('wsSignal');
node.metadata = { isderived: '1' };
expect(node.icon).toBe('serviceInterfaces');
});

it('follows the entry when it is moved between the two sections', () => {
// Paste and drag between Design and Architectural Data rebind `isderived` and
// re-read the entry, so the icon has to be derived from the metadata every time it
Expand Down
Loading
Loading