Skip to content

Commit

Permalink
make label visible for trust boundary box
Browse files Browse the repository at this point in the history
  • Loading branch information
jgadsden committed Feb 10, 2025
1 parent 090ade4 commit c074f58
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 36 deletions.
2 changes: 1 addition & 1 deletion td.vue/src/service/x6/shapes/actor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ports } from '../ports.js';

const name = 'actor';

// actor (rectangle, white background)
// actor (rectangle, transparent background)
export const ActorShape = Shape.Rect.define({
constructorName: name,
width: 150,
Expand Down
26 changes: 7 additions & 19 deletions td.vue/src/service/x6/shapes/trust-boundary-box.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { tc } from '@/i18n/index.js';

const name = 'trust-boundary-box';

// trust boundary box (dotted line, gray opaque background)
// trust boundary box (dotted line, transparent background)
export const TrustBoundaryBox = Shape.Rect.define({
constructorName: name,
width: 500,
Expand All @@ -19,32 +19,20 @@ export const TrustBoundaryBox = Shape.Rect.define({
fill: 'transparent',
fillOpacity: 0
},
headerText: {
label: {
text: tc('threatmodel.shapes.trustBoundary'),
fill: '#333',
strokeWidth: 0
},
header: {
rx: 10,
ry: 10,
strokeWidth: 0,
fillOpacity: 0
textAnchor : 'bottom',
textVerticalAnchor : 'top',
refX: '15%',
refY: '12'
}
}
});

TrustBoundaryBox.prototype.setLabel = function (label) {
this.setAttrByPath('headerText/text', label);
};

TrustBoundaryBox.prototype.getLabel = function () {
return this.getAttrByPath('headerText/text');
};

TrustBoundaryBox.prototype.type = 'tm.BoundaryBox';

TrustBoundaryBox.prototype.setName = function (name) {
this.setAttrByPath('headerText/text', name);
this.setAttrByPath('label/text', name);
};

TrustBoundaryBox.prototype.updateStyle = function () {};
Expand Down
17 changes: 1 addition & 16 deletions td.vue/tests/unit/service/x6/shapes/trust-boundary-box.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,7 @@ describe('service/x6/shapes/trust-boundary-box.js', () => {
it('sets the name', () => {
const name = 'tbbName';
victim.setName(name);
expect(victim.setAttrByPath).toHaveBeenCalledWith('headerText/text', name);
});
});

describe('getLabel', () => {
it('gets the label', () => {
victim.getLabel();
expect(victim.getAttrByPath).toHaveBeenCalledWith('headerText/text');
});
});

describe('setLabel', () => {
it('sets the label', () => {
const name = 'tbbName';
victim.setLabel(name);
expect(victim.setAttrByPath).toHaveBeenCalledWith('headerText/text', name);
expect(victim.setAttrByPath).toHaveBeenCalledWith('label/text', name);
});
});

Expand Down

0 comments on commit c074f58

Please sign in to comment.