diff --git a/dist/__snapshots__/oscd-designer.spec.snap.js b/dist/__snapshots__/oscd-designer.spec.snap.js index a614d36..35c4fdd 100644 --- a/dist/__snapshots__/oscd-designer.spec.snap.js +++ b/dist/__snapshots__/oscd-designer.spec.snap.js @@ -334,7 +334,7 @@ snapshots["Designer given conducting equipment connects equipment on connection `; /* end snapshot Designer given conducting equipment connects equipment on connection point and equipment click */ -snapshots["Designer given conducting equipment with established connectivity uniquely names new connectivity nodes"] = +snapshots["Designer given conducting equipment connects equipment on connect menu item select"] = ` - - @@ -431,11 +426,21 @@ snapshots["Designer given conducting equipment with established connectivity uni > + + + + @@ -464,11 +469,11 @@ snapshots["Designer given conducting equipment with established connectivity uni > @@ -481,11 +486,20 @@ snapshots["Designer given conducting equipment with established connectivity uni > + + @@ -496,6 +510,15 @@ snapshots["Designer given conducting equipment with established connectivity uni name="NEW1" type="NEW" > + + + + + + + + +
+ + + + + + +
+
+
+ + +
+ + + + + + + + +
+
+
`; -/* end snapshot Designer given conducting equipment with established connectivity uniquely names new connectivity nodes */ +/* end snapshot Designer given conducting equipment connects equipment on connect menu item select */ -snapshots["Designer given conducting equipment with established connectivity connects equipment on connection point and connectivity node click"] = +snapshots["Designer given conducting equipment with established connectivity uniquely names new connectivity nodes"] = ` + +
-
-
- -
+
+
+ +
@@ -650,8 +758,8 @@ snapshots["Designer given conducting equipment with established connectivity con > `; -/* end snapshot Designer given conducting equipment with established connectivity connects equipment on connection point and connectivity node click */ +/* end snapshot Designer given conducting equipment with established connectivity uniquely names new connectivity nodes */ -snapshots["Designer given conducting equipment with established connectivity avoids short circuit connections"] = +snapshots["Designer given conducting equipment with established connectivity connects equipment on connection point and connectivity node click"] = ` + + +
+
+ + + + + + +
+
+ + + + `; -/* end snapshot Designer given conducting equipment with established connectivity avoids short circuit connections */ +/* end snapshot Designer given conducting equipment with established connectivity connects equipment on connection point and connectivity node click */ -snapshots["Designer given conducting equipment with established connectivity keeps connection paths simple"] = +snapshots["Designer given conducting equipment with established connectivity avoids short circuit connections"] = `
-
- - - - - - -
-
- + + + + + + + + + + + + + + + + + + + + + + + + + +`; +/* end snapshot Designer given conducting equipment with established connectivity avoids short circuit connections */ + +snapshots["Designer given conducting equipment with established connectivity keeps connection paths simple"] = +` + + + + + + + + + +
+ + + + +
+
+ + + + + + +
+
+ @@ -2333,7 +2627,38 @@ snapshots["Designer given conducting equipment with established connectivity bet `; /* end snapshot Designer given conducting equipment with established connectivity between more than two pieces of equipment removes superfluous connectivity nodes when disconnecting */ -snapshots["Designer given conducting equipment connects equipment on connect menu item select"] = +snapshots["Designer given a voltage level allows placing a new bus bar"] = +` + + +
+ + + + +
+
+
+
+`; +/* end snapshot Designer given a voltage level allows placing a new bus bar */ + +snapshots["Designer given conducting equipment with established connectivity between more than two pieces of equipment keeps internal connectivity nodes when moving containers"] = ` + + + + + + + + + + + +
+ esld:x="18.5" + esld:y="7.5" + > + + + + + +
+
+
+
+
+ + + + + + + + + +
+`; +/* end snapshot Designer given conducting equipment with established connectivity between more than two pieces of equipment keeps internal connectivity nodes when moving containers */ + +snapshots["Designer given conducting equipment with established connectivity between more than two pieces of equipment and a bus bar keeps the bus bar when moving containers"] = +` + + + + + +
+ + + + +
+
+
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+
+
+
+
+
+
+`; +/* end snapshot Designer given conducting equipment with established connectivity between more than two pieces of equipment and a bus bar keeps the bus bar when moving containers */ + +snapshots["Designer given conducting equipment with established connectivity between more than two pieces of equipment and a bus bar resizes the bus bar on first menu item select"] = +` + + + + + +
+ + + + +
+
+
+
+ + + + + + + +
+ + + + +
+
+ + + + + + +
+
+ + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+
+
+
+
+
+
+`; +/* end snapshot Designer given conducting equipment with established connectivity between more than two pieces of equipment and a bus bar resizes the bus bar on first menu item select */ + +snapshots["Designer given conducting equipment with established connectivity between more than two pieces of equipment and a bus bar moves the bus bar on first menu item select"] = +` + + + + + +
+ + + + +
+
+
+
+ + + + + + + +
+ + + + +
+
+ + + + + + +
+
+ + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+
+
+
+
+`; +/* end snapshot Designer given conducting equipment with established connectivity between more than two pieces of equipment and a bus bar moves the bus bar on first menu item select */ + +snapshots["Designer given conducting equipment with established connectivity between more than two pieces of equipment and a bus bar removes the bus bar on third menu item select"] = +` + + + + + + +
+
+
+ + + +
+
+ + +
@@ -2475,6 +3656,15 @@ snapshots["Designer given conducting equipment connects equipment on connect men voltageLevelName="V2" > + + - - @@ -2509,15 +3690,6 @@ snapshots["Designer given conducting equipment connects equipment on connect men name="NEW1" type="NEW" > - - - - - - + + - - -
- - - - - - -
-
-
`; -/* end snapshot Designer given conducting equipment connects equipment on connect menu item select */ +/* end snapshot Designer given conducting equipment with established connectivity between more than two pieces of equipment and a bus bar removes the bus bar on third menu item select */ diff --git a/icons.ts b/icons.ts index 7295f23..a2857f4 100644 --- a/icons.ts +++ b/icons.ts @@ -1,12 +1,10 @@ -import { svg, TemplateResult } from 'lit'; +import { html, svg, TemplateResult } from 'lit'; export const resizePath = svg``; -export const movePath = svg``; +export const movePath = svg``; export const voltageLevelIcon = svg` `; -export function equipmentPath(equipmentType: string): TemplateResult<2> { - if (equipmentType in equipmentPaths) return equipmentPaths[equipmentType]!; +export function equipmentPath(equipmentType: string | null): TemplateResult<2> { + if (equipmentType && equipmentType in equipmentPaths) + return equipmentPaths[equipmentType]!; return defaultEquipmentPath; } -export function equipmentGraphic(equipmentType: string): TemplateResult<2> { - return svg` -${equipmentPath(equipmentType)} -`; +export function equipmentGraphic( + equipmentType: string | null +): TemplateResult<1> { + return html` + ${equipmentPath(equipmentType)} + `; } -export function equipmentIcon(equipmentType: string): TemplateResult<2> { - return svg` -${equipmentPath(equipmentType)} -`; +export function equipmentIcon(equipmentType: string): TemplateResult<1> { + return html` + ${equipmentPath(equipmentType)} + `; } function equipmentSymbol(equipmentType: string): TemplateResult<2> { return svg` -${equipmentPath(equipmentType)} -`; + id="${equipmentType}" + viewBox="0 0 25 25" + width="1" height="1" + > + ${equipmentPath(equipmentType)} + `; } export const connectivityNodeMarker = svg` { const sldEditor = element.shadowRoot!.querySelector('sld-editor')!; const moveHandle = - sldEditor.shadowRoot!.querySelectorAll('a.handle')[1]; + sldEditor.shadowRoot!.querySelectorAll('.handle')[1]; moveHandle.dispatchEvent(new PointerEvent('click')); expect(element) .property('resizing') @@ -308,7 +308,7 @@ describe('Designer', () => { const sldEditor = element.shadowRoot!.querySelector('sld-editor')!; const moveHandle = - sldEditor.shadowRoot!.querySelector('a.handle')!; + sldEditor.shadowRoot!.querySelector('.handle')!; moveHandle.dispatchEvent(new PointerEvent('click')); expect(element) .property('placing') @@ -325,7 +325,7 @@ describe('Designer', () => { const sldEditor = element.shadowRoot!.querySelector('sld-editor')!; const moveHandle = - sldEditor.shadowRoot!.querySelector('a.handle')!; + sldEditor.shadowRoot!.querySelector('.handle')!; moveHandle.dispatchEvent(new PointerEvent('click')); expect(element) .property('placing') @@ -355,6 +355,27 @@ describe('Designer', () => { expect(bay).to.have.attribute('w', '7'); expect(bay).to.have.attribute('h', '8'); }); + + it('allows placing a new bus bar', async () => { + element + .shadowRoot!.querySelector