@@ -27,7 +27,7 @@ function buildMind({ scaleVal = 1, direction = 1, isFocusMode = false } = {}) {
2727 } ) ;
2828
2929 // As the map does: it is laid out afresh, and says only that its branches have been drawn.
30- const relayOut = ( value : 0 | 1 | 2 ) => vi . fn ( ( ) => {
30+ const relayOut = ( value : 0 | 1 | 2 | 3 ) => vi . fn ( ( ) => {
3131 mind . direction = value ;
3232 fire ( "linkDiv" ) ;
3333 } ) ;
@@ -48,6 +48,7 @@ function buildMind({ scaleVal = 1, direction = 1, isFocusMode = false } = {}) {
4848 initLeft : relayOut ( 0 ) ,
4949 initRight : relayOut ( 1 ) ,
5050 initSide : relayOut ( 2 ) ,
51+ initDown : relayOut ( 3 ) ,
5152 // As the map does: it is laid out afresh, showing all it has again.
5253 cancelFocus : vi . fn ( ( ) => {
5354 mind . isFocusMode = false ;
@@ -79,6 +80,7 @@ const FULLSCREEN = 4;
7980const LEFT = 0 ;
8081const RIGHT = 1 ;
8182const SIDE = 2 ;
83+ const DOWN = 3 ;
8284
8385/** Builds a bar and settles it, so that what it listens to is listened to before it is spoken to. */
8486function renderBar ( bar : ComponentChild ) {
@@ -260,13 +262,16 @@ describe("MapToolbar", () => {
260262} ) ;
261263
262264describe ( "DirectionToolbar" , ( ) => {
263- it ( "offers the three layouts the map's own bar did, each wearing its own mark" , ( ) => {
265+ // The three the map's own bar offered, and the downward one Mind Elixir added without ever
266+ // putting it in that bar.
267+ it ( "offers every layout the map can take, each wearing its own mark" , ( ) => {
264268 const container = renderDirections ( buildMind ( ) ) ;
265269
266270 expect ( buttons ( container ) . map ( ( button ) => button . className ) ) . toEqual ( [
267271 expect . stringContaining ( "mind-map-direction-left" ) ,
268272 expect . stringContaining ( "mind-map-direction-right" ) ,
269- expect . stringContaining ( "mind-map-direction-side" )
273+ expect . stringContaining ( "mind-map-direction-side" ) ,
274+ expect . stringContaining ( "mind-map-direction-down" )
270275 ] ) ;
271276 } ) ;
272277
@@ -280,6 +285,9 @@ describe("DirectionToolbar", () => {
280285 press ( container , SIDE ) ;
281286 expect ( mind . initSide ) . toHaveBeenCalled ( ) ;
282287
288+ press ( container , DOWN ) ;
289+ expect ( mind . initDown ) . toHaveBeenCalled ( ) ;
290+
283291 press ( container , RIGHT ) ;
284292 expect ( mind . initRight ) . toHaveBeenCalled ( ) ;
285293 } ) ;
@@ -289,12 +297,17 @@ describe("DirectionToolbar", () => {
289297 const container = renderDirections ( mind ) ;
290298
291299 expect ( buttons ( container ) . map ( ( button ) => button . classList . contains ( "active" ) ) )
292- . toEqual ( [ false , true , false ] ) ;
300+ . toEqual ( [ false , true , false , false ] ) ;
293301
294302 press ( container , SIDE ) ;
295303
296304 expect ( buttons ( container ) . map ( ( button ) => button . classList . contains ( "active" ) ) )
297- . toEqual ( [ false , false , true ] ) ;
305+ . toEqual ( [ false , false , true , false ] ) ;
306+
307+ press ( container , DOWN ) ;
308+
309+ expect ( buttons ( container ) . map ( ( button ) => button . classList . contains ( "active" ) ) )
310+ . toEqual ( [ false , false , false , true ] ) ;
298311 } ) ;
299312
300313 it ( "catches up with a map that took a direction from the content it was filled with" , ( ) => {
@@ -306,6 +319,6 @@ describe("DirectionToolbar", () => {
306319 act ( ( ) => mind . bus . fire ( "linkDiv" ) ) ;
307320
308321 expect ( buttons ( container ) . map ( ( button ) => button . classList . contains ( "active" ) ) )
309- . toEqual ( [ true , false , false ] ) ;
322+ . toEqual ( [ true , false , false , false ] ) ;
310323 } ) ;
311324} ) ;
0 commit comments