66import selectionModule from 'lib/features/selection' ;
77
88import {
9- query as domQuery
9+ matches
1010} from 'min-dom' ;
1111
1212
@@ -27,7 +27,7 @@ describe('features/selection/SelectionVisuals', function() {
2727
2828 describe ( 'selection box' , function ( ) {
2929
30- var shape , shape2 , connection ;
30+ var shape , shape2 , connection , label ;
3131
3232 beforeEach ( inject ( function ( elementFactory , canvas ) {
3333
@@ -53,6 +53,14 @@ describe('features/selection/SelectionVisuals', function() {
5353 } ) ;
5454
5555 canvas . addConnection ( connection ) ;
56+
57+ label = elementFactory . createLabel ( {
58+ id : 'label' ,
59+ x : 250 , y : 200 , width : 20 , height : 20 ,
60+ labelTarget : connection
61+ } ) ;
62+
63+ canvas . addShape ( label ) ;
5664 } ) ) ;
5765
5866
@@ -63,11 +71,39 @@ describe('features/selection/SelectionVisuals', function() {
6371
6472 // then
6573 var gfx = canvas . getGraphics ( connection ) ,
66- outline = domQuery ( '.djs-outline' , gfx ) ;
74+ hasOutline = matches ( gfx , '.selected' ) ;
6775
68- expect ( outline ) . to . exist ;
76+ expect ( hasOutline ) . to . be . true ;
6977 } ) ) ;
7078
79+
80+ it ( 'should show box on connection-labels on select' ,
81+ inject ( function ( selection , canvas ) {
82+
83+ // when
84+ selection . select ( connection ) ;
85+
86+ // then
87+ var gfx = canvas . getGraphics ( label ) ,
88+ hasOutline = matches ( gfx , '.selected' ) ;
89+
90+ expect ( hasOutline ) . to . be . true ;
91+ } ) ) ;
92+
93+
94+ it ( 'should show box on connection on selecting label' ,
95+ inject ( function ( selection , canvas ) {
96+
97+ // when
98+ selection . select ( label ) ;
99+
100+ // then
101+ var gfx = canvas . getGraphics ( connection ) ,
102+ hasOutline = matches ( gfx , '.selected' ) ;
103+
104+ expect ( hasOutline ) . to . be . true ;
105+ } ) ) ;
106+
71107 } ) ;
72108
73109} ) ;
0 commit comments