File tree Expand file tree Collapse file tree 2 files changed +34
-4
lines changed
Expand file tree Collapse file tree 2 files changed +34
-4
lines changed Original file line number Diff line number Diff line change @@ -8,13 +8,22 @@ import {MultiBuildingPart} from './multibuildingpart.js';
88 * XML data from the API.
99 */
1010class Building {
11- // Latitude and longitude that transitioned to (0, 0)
11+ /**
12+ * Latitude and longitude that transitions to (0, 0)
13+ * @type {number[2] }
14+ */
1215 home = [ ] ;
1316
14- // the parts
17+ /**
18+ * The parts.
19+ * @type {BuildingPart[] }
20+ */
1521 parts = [ ] ;
1622
17- // the BuildingPart of the outer building parimeter
23+ /**
24+ * The building part of the outer parimeter.
25+ * @type {BuildingPart }
26+ */
1827 outerElement ;
1928
2029 // DOM Tree of all elements to render
@@ -139,7 +148,10 @@ class Building {
139148 const mesh = [ ] ;
140149 if ( this . parts . length > 0 ) {
141150 this . outerElement . options . building . visible = false ;
142- mesh . push ( ...this . outerElement . render ( ) ) ;
151+ const outerMeshes = this . outerElement . render ( ) ;
152+ outerMeshes [ 0 ] . visible = false ;
153+ outerMeshes [ 1 ] . visible = false ;
154+ mesh . push ( ...outerMeshes ) ;
143155 for ( let i = 0 ; i < this . parts . length ; i ++ ) {
144156 mesh . push ( ...this . parts [ i ] . render ( ) ) ;
145157 }
Original file line number Diff line number Diff line change @@ -77,6 +77,24 @@ test('Create Nodelist', () => {
7777 expect ( errors . length ) . toBe ( 0 ) ;
7878} ) ;
7979
80+
81+ test ( 'Invisible Outer Building' , ( ) => {
82+ const bldg = new Building ( '31361386' , data ) ;
83+ bldg . parts = [ bldg . outerElement ] ;
84+ const mesh = bldg . render ( ) ;
85+ //expect outer building and roof to not be visible
86+ expect ( mesh [ 0 ] . visible ) . toBe ( false ) ;
87+ expect ( mesh [ 1 ] . visible ) . toBe ( false ) ;
88+ } ) ;
89+
90+ test ( 'Visible Outer Building' , ( ) => {
91+ const bldg = new Building ( '31361386' , data ) ;
92+ const mesh = bldg . render ( ) ;
93+ //expect outer building and roof to be visible
94+ expect ( mesh [ 0 ] . visible ) . toBe ( true ) ;
95+ expect ( mesh [ 1 ] . visible ) . toBe ( true ) ;
96+ } ) ;
97+
8098window . printError = printError ;
8199
82100var errors = [ ] ;
You can’t perform that action at this time.
0 commit comments